Azure OpenAI Embeddings QnA 项目教程

Azure OpenAI Embeddings QnA 项目教程

azure-open-ai-embeddings-qnaA simple web application for a OpenAI-enabled document search. This repo uses Azure OpenAI Service for creating embeddings vectors from documents. For answering the question of a user, it retrieves the most relevant document and then uses GPT-3, GPT-3.5 or GPT-4 to extract the matching answer for the question.项目地址:https://gitcode.com/gh_mirrors/az/azure-open-ai-embeddings-qna

1. 项目的目录结构及介绍

azure-open-ai-embeddings-qna/
├── README.md
├── app/
│   ├── __init__.py
│   ├── main.py
│   ├── config.py
│   ├── utils.py
│   └── templates/
│       └── index.html
├── requirements.txt
└── tests/
    └── test_main.py
  • README.md: 项目说明文档。
  • app/: 包含项目的主要代码文件。
    • __init__.py: 初始化文件。
    • main.py: 项目的启动文件。
    • config.py: 项目的配置文件。
    • utils.py: 工具函数文件。
    • templates/: 包含HTML模板文件。
      • index.html: 主页模板。
  • requirements.txt: 项目依赖文件。
  • tests/: 包含测试文件。
    • test_main.py: 主程序的测试文件。

2. 项目的启动文件介绍

app/main.py 是项目的启动文件,负责初始化应用并启动服务器。以下是该文件的主要内容:

from flask import Flask, render_template
from config import Config

app = Flask(__name__)
app.config.from_object(Config)

@app.route('/')
def index():
    return render_template('index.html')

if __name__ == '__main__':
    app.run(debug=True)
  • Flask 是用于创建Web应用的框架。
  • Config 是从 config.py 中导入的配置类。
  • index 函数定义了主页的路由和渲染的模板。
  • app.run(debug=True) 启动Flask应用,并开启调试模式。

3. 项目的配置文件介绍

app/config.py 是项目的配置文件,包含应用的配置信息。以下是该文件的主要内容:

import os

class Config:
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
    OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY')
    DATABASE_URI = os.environ.get('DATABASE_URI') or 'sqlite:///app.db'
  • SECRET_KEY: 应用的密钥,用于加密。
  • OPENAI_API_KEY: OpenAI API的密钥。
  • DATABASE_URI: 数据库的连接URI。

这些配置信息可以通过环境变量设置,也可以使用默认值。

azure-open-ai-embeddings-qnaA simple web application for a OpenAI-enabled document search. This repo uses Azure OpenAI Service for creating embeddings vectors from documents. For answering the question of a user, it retrieves the most relevant document and then uses GPT-3, GPT-3.5 or GPT-4 to extract the matching answer for the question.项目地址:https://gitcode.com/gh_mirrors/az/azure-open-ai-embeddings-qna

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

韩宾信Oliver

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值