Ragas提供了两种安装方式:
- Installation via PyPI: Implementation
pip install ragas
- Installation from source: Run
pip install git+https://github.com/explodinggradients/ragas
基本使用流程分为三步:
- Import Module:需要导入评估指标和样本类
from ragas import SingleTurnSample
from ragas.metrics import AspectCritic
- Preparing test data:包含用户输入和系统响应的字典
- Setting up the Evaluator:基于LLM构建评估器实例
评估过程示例:
- 配置GPT-4等LLM作为评估器
- 定义具体的评估指标(如摘要准确性)
- pass (a bill or inspection etc)
single_turn_ascore
方法执行评估
This answer comes from the articleRagas: assessing RAG recall QA accuracy and answer correlationThe