构建RAG评测、训练数据库集

介绍

该小工具旨在简化创建数据集的复杂性。
对于初学者在测试 RAG 系统时存在很多不明之处,使用此工具可以通过简单的字符串拼接来生成 RAGAS 的测试数据集。
同时,也可以将后台代码修改为自动收集 RAG 系统的评估数据。

安装教程

conda create -n ragas python==3.10.12 -c http://172.16.21.146:8081/repository/anaconda-proxy/main --override-channels

pip install -i http://172.16.21.146:8081/repository/pypi/simple  --trusted-host 172.16.21.146 --timeout 0 -r ./requirements.txt

使用说明

使用该工具非常简单。通过一个静态页面和一个 FastAPI 服务端将简化的数据格式转换为 RAGAS 数据集,你可以直接通过浏览器将数据集下载到本地。
运行服务端的 python main.py 后,双击打开静态页,即可输入你要转换为数据集的数据。格式如下:

question:法国的首都是什么?,
groundTruths:巴黎,
answer:巴黎,
contexts:巴黎是法国的首都。,

question:《哈利波特》的作者是谁?,
groundTruths:J.K.罗琳,
answer:J.K.罗琳,
contexts:J.K.罗琳写了《哈利波特》。,

question:水的沸点是多少?,
groundTruths:100度摄氏度,
answer:100度摄氏度,
contexts:水在海平面下沸腾的温度是100摄氏度。,

点击提交进行数据集格式转换

构建RAG评测、训练数据库集插图

点击导出会下载生成的数据集.zip

构建RAG评测、训练数据库集插图1


前端代码

关注后解锁

后端代码

关注后解锁

依赖

requirements.txt

aiohttp==3.9.3
aiosignal==1.3.1
annotated-types==0.6.0
anyio==4.3.0
async-timeout==4.0.3
attrs==23.2.0
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
datasets==2.18.0
dill==0.3.8
exceptiongroup==1.2.0
fastapi==0.110.0
filelock==3.13.3
frozenlist==1.4.1
fsspec==2024.2.0
h11==0.14.0
huggingface-hub==0.22.1
idna==3.6
multidict==6.0.5
multiprocess==0.70.16
numpy==1.26.4
packaging==24.0
pandas==2.2.1
pyarrow==15.0.2
pyarrow-hotfix==0.6
pydantic==2.6.4
pydantic_core==2.16.3
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.1
requests==2.31.0
six==1.16.0
sniffio==1.3.1
starlette==0.36.3
tqdm==4.66.2
typing_extensions==4.10.0
tzdata==2024.1
urllib3==2.2.1
uvicorn==0.29.0
xxhash==3.4.1
yarl==1.9.4

毛巳煜

高级软件开发全栈架构师