ragas은(는) 무엇을 하나요?
자율적인 다중 소스 에이전트 내부에서 직접 Retrieval Augmented Generation 파이프라인을 평가할 수 있게 도와주는 프레임워크입니다.
개요
Ragas는 RAG 시스템을 평가하기 위한 종합적인 프레임워크로, 다음과 같은 주요 기능을 제공합니다:
- 자동 평가: 수동 개입 없이 RAG 파이프라인의 성능을 자동으로 측정
- 다중 지표: 정확성, 관련성, 충실도 등 다양한 평가 지표 지원
- 에이전트 통합: Claude Code, Cursor, Codex 등 AI 에이전트와 원활한 통합
- 설정 가능성: JSON/YAML 설정 파일을 통한 유연한 평가 기준 정의
설치
pip install ragas
또는 소스에서 설치:
git clone https://github.com/explodinggradients/ragas.git
cd ragas
pip install -e .
사용법
기본 평가
from ragas import evaluate
from ragas.metrics import faithfulness, answer_relevancy, context_precision
# 데이터 준비
dataset = {
"question": ["What is RAG?"],
"answer": ["RAG stands for Retrieval Augmented Generation."],
"contexts": [["RAG is a technique that combines retrieval and generation."]],
}
# 평가 실행
results = evaluate(dataset, metrics=[faithfulness, answer_relevancy, context_precision])
print(results)
에이전트와 통합
# 예: Claude Code와 함께 사용
from claude_code import ClaudeCodeAgent
from ragas import evaluate
agent = ClaudeCodeAgent()
response = agent.query("Explain the RAG architecture")
# 평가 지표 계산
scores = evaluate(
{"question": ["Explain the RAG architecture"],
"answer": [response.text],
"contexts": [response.contexts]}
)
지원 플랫폼
- Claude Code
- Cursor
- Codex
- 기타 AI 에이전트
설정 옵션
| 옵션 | 설명 | 기본값 |
|---|---|---|
metrics | 평가 지표 목록 | ["faithfulness"] |
threshold | 통과 기준 점수 | 0.7 |
output_format | 결과 출력 형식 | "json" |
참고 자료
라이선스
Apache 2.0