Study track

Ragas LLM Evaluation

How to score an LLM system against a fixed set of examples, then change the system and score it again. The same loop covers a single prompt, a RAG pipeline, a multi-step workflow, and a tool-using agent.

Ragas tutorialsEvaluation-driven development

The evaluation loop Shared pattern

Every tutorial in this track is the same four steps, applied to a different system.

DatasetSystemMetricExperiment CSVrow + output + scorechange the system, keep the dataset, re-run
The dataset stays fixed so a prompt, retriever, or tool change shows up as a score change.

What you install once

pip install ragas[examples] and an OPENAI_API_KEY. Each tutorial then runs as a module under ragas_examples and writes experiments/experiment_name.csv.

Core concepts Foundations

The vocabulary the tutorials assume: an experiment, a dataset, a metric, and a way to grow the test set.

ConceptWhat it isWhere it lives
ExperimentationOne deliberate change, scored against a fixed dataset@experiment() and experiments/*.csv
DatasetsInputs, optional expected outputs, and metadata for slicingdatasets/ via Dataset
Ragas metricsEnd-to-end, component, and custom discrete or numeric scoresragas.metrics
Test data generationSynthetic RAG queries from a knowledge graph of your documentsragas.testset

The four tutorials Roadmap

Start with the prompt. Each later page adds a richer system and a different kind of metric.

TutorialSystem under testHow it is scored
1. Prompt evaluationMovie-review sentiment classifierCode metric: exact match on positive / negative
2. Simple RAGRetrieve from a corpus, then generateLLM judge against grading notes
3. AI workflowEmail triage: extract, route, replyLLM judge against a pass-criteria checklist
4. AI agentMath agent with add / sub / mul / div toolsNumeric tolerance, no LLM in the metric

Cheat sheet Recap

The pieces that show up in every tutorial.

Dataset

  • A few rows of input plus what “good” means
  • Saved as datasets/test_dataset.csv
  • Held fixed while the system changes

Metric

  • Code metric when the answer is checkable
  • LLM DiscreteMetric when it is not
  • Returns a MetricResult (value, reason)

Experiment

  • @experiment() runs one row
  • Calls the system, then metric.score(...)
  • Returns the row plus output and score

Compare

  • arun can take extra args such as model
  • Results land in experiments/*.csv
  • Diff the CSV after each change

Key takeaways

  • A prompt change without a dataset is a guess. The dataset is the test suite.
  • Use a code metric when you can check the answer yourself. Use an LLM judge when “good” is a rubric.
  • The experiment CSV is the artifact you keep: input, output, score, and any log the system produced.