Azure-Samples/ai-rag-chat-evaluator 项目使用教程
1. 项目目录结构及介绍
ai-rag-chat-evaluator/
├── devcontainer/
├── github/
├── vscode/
├── docs/
├── example_input/
├── example_results/
├── infra/
├── review_tools/
├── scripts/
├── .env.sample
├── .gitignore
├── .pre-commit-config.yaml
├── LICENSE.md
├── README.md
├── azure.yaml
├── dontknows_config.json
├── example_config.json
├── pyproject.toml
├── requirements-dev.txt
└── requirements.txt
目录结构介绍
- devcontainer/: 包含开发容器的配置文件。
- github/: 包含GitHub相关的配置文件。
- vscode/: 包含VSCode的配置文件。
- docs/: 包含项目的文档文件。
- example_input/: 包含示例输入文件。
- example_results/: 包含示例输出结果文件。
- infra/: 包含基础设施相关的配置文件。
- review_tools/: 包含代码审查工具的配置文件。
- scripts/: 包含项目的脚本文件。
- .env.sample: 环境变量示例文件。
- .gitignore: Git忽略文件配置。
- .pre-commit-config.yaml: 预提交钩子配置文件。
- LICENSE.md: 项目许可证文件。
- README.md: 项目介绍文件。
- azure.yaml: Azure配置文件。
- dontknows_config.json: 未知问题配置文件。
- example_config.json: 示例配置文件。
- pyproject.toml: Python项目配置文件。
- requirements-dev.txt: 开发依赖文件。
- requirements.txt: 项目依赖文件。
2. 项目启动文件介绍
项目的启动文件主要集中在scripts/
目录下,其中包含了多个用于生成、评估和运行项目的脚本。以下是一些关键的启动脚本:
- scripts/generate.py: 用于生成问题和答案的脚本。
- scripts/evaluate.py: 用于评估聊天应用的脚本。
- scripts/run_evaluation.py: 用于运行评估的脚本。
启动示例
python -m scripts.generate --output=example_input/qa.jsonl --numquestions=200 --persource=5
python -m scripts.evaluate --config=example_config.json
3. 项目的配置文件介绍
项目的配置文件主要用于定义环境变量、Azure OpenAI实例的配置、以及生成和评估的参数设置。以下是一些关键的配置文件:
- .env.sample: 环境变量示例文件,包含了Azure OpenAI实例的配置信息。
- example_config.json: 示例配置文件,定义了评估的参数和设置。
- dontknows_config.json: 未知问题配置文件,定义了如何处理未知问题的配置。
配置文件示例
.env.sample:
AZURE_OPENAI_EVAL_DEPLOYMENT="<deployment-name>"
AZURE_OPENAI_ENDPOINT="https://<service-name>.openai.azure.com"
AZURE_OPENAI_KEY="<your-key>"
example_config.json:
{
"evaluators": ["groundedness", "coherence", "relevance"],
"questions_file": "example_input/qa.jsonl",
"output_file": "example_results/evaluation_results.jsonl"
}
通过以上配置文件,可以灵活地调整项目的运行环境和评估参数,以适应不同的需求和场景。
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考