What this thread does
Do first: Collect rows containing user_input, retrieved_contexts, response and reference; use EvaluationDataset.from_list(dataset) for the tutorial route.
Short answer
Separate evidence recall, answer grounding and factual agreement. The tutorial and current metric pages show different API generations; choose one route explicitly.
What to do
| Data / metric | Value / action |
|---|---|
| Dataset | user_input: query; retrieved_contexts: retrieved text list; response: generated answer; reference: expected answer |
| Tutorial models | ChatOpenAI(model="gpt-4o"); LangchainLLMWrapper(llm) supplies the evaluator |
| Tutorial execution | Import EvaluationDataset, evaluate from ragas; import LLMContextRecall, Faithfulness, FactualCorrectness from ragas.metrics |
| Recall | LLMContextRecall() measures reference claims supported by retrieved contexts; requires a reference |
| Grounding | Faithfulness() measures answer claims supported by retrieved contexts; range 0–1, higher means more consistent |
| Answer correctness | FactualCorrectness() compares response with reference; range 0–1; mode defaults to f1, alternatives precision, recall |
| Claim granularity | atomicity and coverage accept low or high; higher settings request more detailed/comprehensive claims |
After collecting dataset and configuring llm, the tutorial's evaluation calls are:
from ragas import EvaluationDataset, evaluate
from ragas.llms import LangchainLLMWrapper
from ragas.metrics import LLMContextRecall, Faithfulness, FactualCorrectness
evaluation_dataset = EvaluationDataset.from_list(dataset)
result = evaluate(dataset=evaluation_dataset, metrics=[LLMContextRecall(), Faithfulness(), FactualCorrectness()], llm=LangchainLLMWrapper(llm))
For new projects, import ContextRecall, Faithfulness, FactualCorrectness from ragas.metrics.collections. Configure the evaluator with llm_factory("gpt-4o-mini", client=client) from ragas.llms using an AsyncOpenAI client. Instantiate each scorer with llm=llm; call .ascore(...) asynchronously or .score(...) synchronously, and read result.value. The new recall class is ContextRecall, replacing the tutorial's LLMContextRecall pattern.
The tutorial embedding wrapper uses ragas.embeddings.OpenAIEmbeddings: embed_texts for documents and embed_text for a query, rather than embed_documents / embed_query.
Limits and open questions
Metric pages say the legacy API will be deprecated in version 0.4 and removed in 1.0; they do not establish the installed version. The tutorial still shows the legacy batch route. Its golden answers are optional when collecting rows, but reference-based recall and factual correctness need them. The pages state no universal passing threshold. Example scores are illustrative, not a result for your application.
Not for: LangSmith trace instrumentation or Ragas agent tool-call evaluation.
Sources
- Ragas Evaluate a simple RAG system, Ragas.
- Ragas Context Recall, Ragas.
- Ragas Faithfulness, Ragas.
- Ragas Factual Correctness, Ragas.
Checked
2026-11-16; read Ragas Evaluate a simple RAG system; Ragas Context Recall; Ragas Faithfulness; Ragas Factual Correctness; no command was run.
Started from a post by @Ragas maintainers, packaged by the editor. Original post