示例默认使用 OpenAI,需先设置 OPENAI_API_KEY 环境变量;默认会收集匿名使用数据,可设 RAGAS_DO_NOT_TRACK=true 关闭;quickstart 目前仅提供 rag_eval 模板,其余模板尚未上线
Ragas 是评估和优化 LLM 应用的工具包,用客观指标和自动生成测试集替代主观人工评估
面向 LLM 应用的自动化评测工具,用合成测试集和多种指标量化 RAG 与生成效果,帮你在上线前发现质量问题。
核心能力
- 提供基于 LLM 与传统方法的客观评估指标
- 自动生成覆盖多场景的测试数据集
- 内置 DiscreteMetric 等预置指标,可自定义评估维度
- 与 LangChain 及主流可观测性工具无缝集成
- 用生产数据构建反馈回路持续优化应用
容易踩的坑
- v0.4.3最新正式版2026-01-13 · 2026-01-13 17:47 UTC
What's Changed
- feat: add
DSPyOptimizerwithMIPROv2for advanced prompt optimization by @anistark in https://github.com/vibrantlabsai/ragas/pull/2537 - feat(docs): add llms.txt generation for LLM-friendly documentation by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2539
- feat: dspy caching by @anistark in https://github.com/vibrantlabsai/ragas/pull/2542
- feat: add system prompt support for
InstructorLLMandLiteLLMStructuredLLMby @anistark in https://github.com/vibrantlabsai/ragas/pull/2543 - feat(docs): add copy-to-llm button for easy AI tool integration by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2541
- fix: use PAT token for docs-check CI as docs-apply CI by @anistark in https://github.com/vibrantlabsai/ragas/pull/2546
- feat: add remaining quickstart templates by @anistark in https://github.com/vibrantlabsai/ragas/pull/2547
- fix: enable FactualCorrectness language adaptation by @anistark in https://github.com/vibrantlabsai/ragas/pull/2555
- fix: resolve
DiskCacheBackendpickling issue withInstructorLLMby @anistark in https://github.com/vibrantlabsai/ragas/pull/2556 - fix: lazy init DEFAULT_TOKENIZER to avoid network calls at import time. by @cgaswin in https://github.com/vibrantlabsai/ragas/pull/2545
- fix: comment on failed task by @anistark in https://github.com/vibrantlabsai/ragas/pull/2557
- docs: fix DiscreteMetric llm examples to match API by @cgaswin in https://github.com/vibrantlabsai/ragas/pull/2558
- fix: add repository parameter to checkout action for fork PR support by @anistark in https://github.com/vibrantlabsai/ragas/pull/2559
Full Changelog: https://github.com/vibrantlabsai/ragas/compare/v0.4.2...v0.4.3
- feat: add
- v0.4.22025-12-23 · 2025-12-23 17:13 UTC
查看更新说明
What's Changed
- feat: migrate SQLSemanticEquivalence to collections API by @anistark in https://github.com/vibrantlabsai/ragas/pull/2496
- feat: migrate DataCompyScore to collections API by @anistark in https://github.com/vibrantlabsai/ragas/pull/2499
- fix: migrate CHRF Score to new metrics collections by @anistark in https://github.com/vibrantlabsai/ragas/pull/2500
- Feat/improve rag quickstart by @anistark in https://github.com/vibrantlabsai/ragas/pull/2501
- fix: handle classification array length mismatch in TopicAdherence metric by @anistark in https://github.com/vibrantlabsai/ragas/pull/2503
- feat: migrate quoted spans metric to collections api by @anistark in https://github.com/vibrantlabsai/ragas/pull/2504
- fix: handle instructor modes for json and tools by @anistark in https://github.com/vibrantlabsai/ragas/pull/2505
- docs: remove obsolete 'write your own metric' guides by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2488
- fix: BasePrompt.adapt() structured output + language adaptation guide by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2487
- Add AG-UI Protocol Integration for Agent Evaluation by @contextablemark in https://github.com/vibrantlabsai/ragas/pull/2395
- docs: fix modifying-prompts-metrics guide with correct API by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2486
- fix: handle nested dicts/lists in ToolCallF1 args to prevent unhashable type error by @anistark in https://github.com/vibrantlabsai/ragas/pull/2507
- feat: add Claude docs auto-update workflow by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2508
- fix: allow unannotated parameters to accept any type by @dhyaneesh in https://github.com/vibrantlabsai/ragas/pull/2513
- feat: migrate MultiModalFaithfulness to collections API by @anistark in https://github.com/vibrantlabsai/ragas/pull/2515
- feat: migrate MultiModalRelevance to collections API by @anistark in https://github.com/vibrantlabsai/ragas/pull/2518
- feat: add support for new google-genai SDK with backwards compatibility for deprecated google-generativeai by @anistark in https://github.com/vibrantlabsai/ragas/pull/2517
- fix: use instructor Mode.JSON for litellm and generic providers to fix Dict type validation errors by @anistark in https://github.com/vibrantlabsai/ragas/pull/2514
- [AG-UI] Replacing "OpenAI" with "AsyncOpenAI". by @contextablemark in https://github.com/vibrantlabsai/ragas/pull/2520
- Feat: document PDF export workflow by @cgaswin in https://github.com/vibrantlabsai/ragas/pull/2522
- refactor: deprecate legacy metrics by @anistark in https://github.com/vibrantlabsai/ragas/pull/2519
- fix: claude workflows to use github token by @anistark in https://github.com/vibrantlabsai/ragas/pull/2527
- feat: add HuggingFace tokenizer support in knowledge graph operations by @anistark in https://github.com/vibrantlabsai/ragas/pull/2524
- feat: add generate_with_chunks for pre-chunked documents by @MinseongS in https://github.com/vibrantlabsai/ragas/pull/2526
- feat(docs): add offline mermaid support to PDF export by @cgaswin in https://github.com/vibrantlabsai/ragas/pull/2530
- fix: claude workflows to use pat token instead of github token to support forked PRs by @anistark in https://github.com/vibrantlabsai/ragas/pull/2531
- docs: change query execution to use asyncio.run by @yangzq50 in https://github.com/vibrantlabsai/ragas/pull/2532
- fix: increase max-turns and update prompt by @anistark in https://github.com/vibrantlabsai/ragas/pull/2534
- chore: remove survey link by @anistark in https://github.com/vibrantlabsai/ragas/pull/2535
- feat: add caching support for metrics collections by @anistark in https://github.com/vibrantlabsai/ragas/pull/2533
- feat: add caching support for embeddings by @anistark in https://github.com/vibrantlabsai/ragas/pull/2536
New Contributors
- @contextablemark made their first contribution in https://github.com/vibrantlabsai/ragas/pull/2395
- @cgaswin made their first contribution in https:/
- v0.4.12025-12-10 · 2025-12-10 16:28 UTC
查看更新说明
What's Changed
- feat: add save/load methods to BasePrompt by @anistark in https://github.com/vibrantlabsai/ragas/pull/2465
- docs: update run_config guide to use collections API by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2468
- fix: add anthropic and gemini clients for custom clients by @anistark in https://github.com/vibrantlabsai/ragas/pull/2472
- feat: migrate
ToolCallAccuracyto collections API by @anistark in https://github.com/vibrantlabsai/ragas/pull/2476 - chore: add survey link to readme and docs banner by @anistark in https://github.com/vibrantlabsai/ragas/pull/2478
- Fix: apply_transforms(kg, transforms, run_config=run_config or RunCon… by @narabi in https://github.com/vibrantlabsai/ragas/pull/2480
- feat: migrate ToolCallF1 to collections API with set-based F1 scoring by @anistark in https://github.com/vibrantlabsai/ragas/pull/2483
- New input parameter for the TestsetGenerator Class : LLM_CONTEXT by @narabi in https://github.com/vibrantlabsai/ragas/pull/2474
- feat: migrate TopicAdherence and AgentGoalAccuracy to collections API by @anistark in https://github.com/vibrantlabsai/ragas/pull/2485
- docs: organize integrations nav into collapsible groups by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2492
- aembed_text() replace embed_text() in AnswerRelevancy by @anexplore in https://github.com/vibrantlabsai/ragas/pull/2495
- docs: remove broken reference to train_your_own_metric.md by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2489
- feat: migrate Rubrics Metrics to collections API by @anistark in https://github.com/vibrantlabsai/ragas/pull/2494
New Contributors
- @narabi made their first contribution in https://github.com/vibrantlabsai/ragas/pull/2480
- @anexplore made their first contribution in https://github.com/vibrantlabsai/ragas/pull/2495
Full Changelog: https://github.com/vibrantlabsai/ragas/compare/v0.4.0...v0.4.1
- v0.4.02025-12-03 · 2025-12-03 16:22 UTC
查看更新说明
What's Changed
- docs: complete collections API documentation for remaining metrics by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2420
- feat: support GPT-5 and o-series models with automatic
temperatureandtop_pconstraint handling by @anistark in https://github.com/vibrantlabsai/ragas/pull/2418 - update: add llm options as tabs to quickstart by @anistark in https://github.com/vibrantlabsai/ragas/pull/2421
- feat: migrate to instructor.from_provider for universal provider support by @anistark in https://github.com/vibrantlabsai/ragas/pull/2424
- docs: fix typos in some files by @Edge-Seven in https://github.com/vibrantlabsai/ragas/pull/2429
- feat: implement prompt class for context precision by @anistark in https://github.com/vibrantlabsai/ragas/pull/2433
- fix: docs for quickstart by @anistark in https://github.com/vibrantlabsai/ragas/pull/2434
- Fix 2432: Update import statements for langchain modules by @rvernica in https://github.com/vibrantlabsai/ragas/pull/2436
- Fix 2440 Adjust LLM parameters in evals.py by @rvernica in https://github.com/vibrantlabsai/ragas/pull/2441
- feat: migrate context recall, answer relevancy, and context entity recall metrics to modular BasePrompt architecture by @anistark in https://github.com/vibrantlabsai/ragas/pull/2435
- feat: migrate 6 metrics (ContextRelevance, Response Groundedness, AnswerAccuracy, Faithfulness, AnswerCorrectness, SummaryScore) to BasePrompt by @anistark in https://github.com/vibrantlabsai/ragas/pull/2443
- feat: migrate final metrics (FactualCorrectness, NoiseSensitivity) to modular BasePrompt architecture and update docs by @anistark in https://github.com/vibrantlabsai/ragas/pull/2444
- chore: add COC by @anistark in https://github.com/vibrantlabsai/ragas/pull/2437
- docs: clarify MLflow is required, not optional in RAG evaluation guide by @anistark in https://github.com/vibrantlabsai/ragas/pull/2447
- chore: cleanup old patterns and update links by @anistark in https://github.com/vibrantlabsai/ragas/pull/2449
- chore: rebranding efforts by @jjmachan in https://github.com/vibrantlabsai/ragas/pull/2445
- feat: dual adapter support (Instructor + LiteLLM) by @anistark in https://github.com/vibrantlabsai/ragas/pull/2446
- fix: resolve InstructorLLM detection bug and add EvaluationDataset backend support for experiments by @anistark in https://github.com/vibrantlabsai/ragas/pull/2451
- fix: retrieved_contexts string filtering in LangChain integration by @dhyaneesh in https://github.com/vibrantlabsai/ragas/pull/2452
- fix: correct MultiTurnSample user_input validation logic by @harshil-sanghvi in https://github.com/vibrantlabsai/ragas/pull/2426
- fix: automatic embedding provider matching for LLMs by @anistark in https://github.com/vibrantlabsai/ragas/pull/2454
- fix: make GitPython an optional dependency by @anistark in https://github.com/vibrantlabsai/ragas/pull/2453
- docs: Update customizations how-to guides to use collections API and LLM factory by @sanjeed5 in https://github.com/vibrantlabsai/ragas/pull/2425
- fix: detect async clients in closures for instructor-wrapped litellm routers by @anistark in https://github.com/vibrantlabsai/ragas/pull/2458
- fix: quickstart by @anistark in https://github.com/vibrantlabsai/ragas/pull/2463
- chore: update calendar email by @anistark in https://github.com/vibrantlabsai/ragas/pull/2462
- fix: make GoogleEmbeddings handle GenerativeModel clients by auto-extracting genai module by @anistark in https://github.com/vibrantlabsai/ragas/pull/2466
- docs: add migration guide for v0.4 by @anistark in https://github.com/vibrantlabsai/ragas/pull/2461
New Contributors
- @Edge-Seven made their first contribution in https://github.com/vibrantlabsai/ragas/pull/2429
- @rvernica made their first contribution in https://github.com/vibrantlabsai/ragas/pull/2436
- @dhyaneesh made their first contribution in https://github.com/vibrantlabsai/ragas/pull/2452
Full Changelog: https://github.com/vibrantlabsai/ragas/compare
- v0.3.92025-11-11 · 2025-11-11 17:24 UTC
查看更新说明
What's Changed
- fix(docs): add missing line break so the step title and description a… by @nkch1k in https://github.com/explodinggradients/ragas/pull/2391
- Migrate SummaryScore by @rhlbhatnagar in https://github.com/explodinggradients/ragas/pull/2376
- feat: add metadata fields for synthetic data traceability by @dev-jonathan in https://github.com/explodinggradients/ragas/pull/2389
- Migrate noise sensitivity by @rhlbhatnagar in https://github.com/explodinggradients/ragas/pull/2379
- docs: quickstart guide with interactive LLM and project structure by @anistark in https://github.com/explodinggradients/ragas/pull/2380
- Migrate Faithfullness by @rhlbhatnagar in https://github.com/explodinggradients/ragas/pull/2384
- fix: docs for discrete, numeric and ranking using instructor by @anistark in https://github.com/explodinggradients/ragas/pull/2397
- Migrate Answer Accuracy + Context Relevance by @rhlbhatnagar in https://github.com/explodinggradients/ragas/pull/2390
- refactor: remove aspect critic and simple criteria metrics with discrete metric examples by @anistark in https://github.com/explodinggradients/ragas/pull/2399
- Migrate Context Pricision with + without ref by @rhlbhatnagar in https://github.com/explodinggradients/ragas/pull/2398
- docs: fix recall formula label in SQL metrics by @tysoncung in https://github.com/explodinggradients/ragas/pull/2405
- chore: remove deprecated
ground_truthsby @anistark in https://github.com/explodinggradients/ragas/pull/2402 - docs: Add documentation for metrics.collections API by @sanjeed5 in https://github.com/explodinggradients/ragas/pull/2407
- Migrate factual correctness by @rhlbhatnagar in https://github.com/explodinggradients/ragas/pull/2401
- refactor: remove redundant AnswerSimilarity from collections API in favor of SemanticSimilarity by @anistark in https://github.com/explodinggradients/ragas/pull/2410
- docs: Update documentation structure to reflect experiments-first paradigm by @sanjeed5 in https://github.com/explodinggradients/ragas/pull/2394
- Response Groundedness by @rhlbhatnagar in https://github.com/explodinggradients/ragas/pull/2403
- fix: office hours link update by @anistark in https://github.com/explodinggradients/ragas/pull/2415
- Refactor/removing deprecated by @anistark in https://github.com/explodinggradients/ragas/pull/2412
- fix: handle
max_completeion_tokenserror for newer openai models by @anistark in https://github.com/explodinggradients/ragas/pull/2413 - refactor: make embeddings optional in AnswerCorrectness when using pure factuality mode by @anistark in https://github.com/explodinggradients/ragas/pull/2414
- Feat/migrate context recall by @jjmachan in https://github.com/explodinggradients/ragas/pull/2372
- chore: update quickstart llm config by @anistark in https://github.com/explodinggradients/ragas/pull/2417
New Contributors
- @nkch1k made their first contribution in https://github.com/explodinggradients/ragas/pull/2391
- @dev-jonathan made their first contribution in https://github.com/explodinggradients/ragas/pull/2389
- @tysoncung made their first contribution in https://github.com/explodinggradients/ragas/pull/2405
Full Changelog: https://github.com/explodinggradients/ragas/compare/v0.3.8...v0.3.9
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Objective metrics, intelligent test generation, and data-driven insights for LLM apps
Ragas is your ultimate toolkit for evaluating and optimizing Large Language Model (LLM) applications. Say goodbye to time-consuming, subjective assessments and hello to data-driven, efficient evaluation workflows. Don't have a test dataset ready? We also do production-aligned test set generation.
Key Features
- 🎯 Objective Metrics: Evaluate your LLM applications with precision using both LLM-based and traditional metrics.
- 🧪 Test Data Generation: Automatically create comprehensive test datasets covering a wide range of scenarios.
- 🔗 Seamless Integrations: Works flawlessly with popular LLM frameworks like LangChain and major observability tools.
- 📊 Build feedback loops: Leverage production data to continually improve your LLM applications.
:shield: Installation
Pypi:
pip install ragas
Alternatively, from source:
pip install git+https://github.com/vibrantlabsai/ragas
:fire: Quickstart
Clone a Complete Example Project
The fastest way to get started is to use the ragas quickstart command:
# List available templates
ragas quickstart
# Create a RAG evaluation project
ragas quickstart rag_eval
# Specify where you want to create it.
ragas quickstart rag_eval -o ./my-project
Available templates:
rag_eval- Evaluate RAG systems
Coming Soon:
agent_evals- Evaluate AI agentsbenchmark_llm- Benchmark and compare LLMsprompt_evals- Evaluate prompt variationsworkflow_eval- Evaluate complex workflows
Evaluate your LLM App
ragas comes with pre-built metrics for common evaluation tasks. For example, Aspect Critique evaluates any aspect of your output using DiscreteMetric:
import asyncio
from openai import AsyncOpenAI
from ragas.metrics import DiscreteMetric
from ragas.llms import llm_factory
# Setup your LLM
client = AsyncOpenAI()
llm = llm_factory("gpt-4o", client=client)
# Create a custom aspect evaluator
metric = DiscreteMetric(
name="summary_accuracy",
allowed_values=["accurate", "inaccurate"],
prompt="""Evaluate if the summary is accurate and captures key information.
Response: {response}
Answer with only 'accurate' or 'inaccurate'."""
)
# Score your application's output
async def main():
score = await metric.ascore(
llm=llm,
response="The summary of the text is..."
)
print(f"Score: {score.value}") # 'accurate' or 'inaccurate'
print(f"Reason: {score.reason}")
if __name__ == "__main__":
asyncio.run(main())
Note: Make sure your
OPENAI_API_KEYenvironment variable is set.
Find the complete Quickstart Guide
Want help in improving your AI application using evals?
In the past 2 years, we have seen and helped improve many AI applications using evals. If you want help with improving and scaling up your AI application using evals.
🔗 Book a slot or drop us a line: [email protected].
🫂 Community
If you want to get more involved with Ragas, check out our discord server. It's a fun community where we geek out about LLM, Retrieval, Production issues, and more.
Contributors
+----------------------------------------------------------------------------+
| +----------------------------------------------------------------+ |
| | Developers: Those who built with `ragas`. | |
| | (You have `import ragas` somewhere in your project) | |
| | +----------------------------------------------------+ | |
| | | Contributors: Those who make `ragas` better. | | |
| | | (You make PR to this repo) | | |
| | +----------------------------------------------------+ | |
| +----------------------------------------------------------------+ |
+----------------------------------------------------------------------------+
We welcome contributions from the community! Whether it's bug fixes, feature additions, or documentation improvements, your input is valuable.
- Fork the repository
- Create your feature branch (git checkout -b feature/AmazingFeature)
- Commit your changes (git commit -m 'Add some AmazingFeature')
- Push to the branch (git push origin feature/AmazingFeature)
- Open a Pull Request
🔍 Open Analytics
At Ragas, we believe in transparency. We collect minimal, anonymized usage data to improve our product and guide our development efforts.
✅ No personal or company-identifying information
✅ Open-source data collection code
✅ Publicly available aggregated data
To opt-out, set the RAGAS_DO_NOT_TRACK environment variable to true.
Cite Us
@misc{ragas2024,
author = {VibrantLabs},
title = {Ragas: Supercharge Your LLM Application Evaluations},
year = {2024},
howpublished = {\url{https://github.com/vibrantlabsai/ragas}},
}