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.
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.
| Concept | What it is | Where it lives |
|---|---|---|
| Experimentation | One deliberate change, scored against a fixed dataset | @experiment() and experiments/*.csv |
| Datasets | Inputs, optional expected outputs, and metadata for slicing | datasets/ via Dataset |
| Ragas metrics | End-to-end, component, and custom discrete or numeric scores | ragas.metrics |
| Test data generation | Synthetic RAG queries from a knowledge graph of your documents | ragas.testset |
The four tutorials Roadmap
Start with the prompt. Each later page adds a richer system and a different kind of metric.
| Tutorial | System under test | How it is scored |
|---|---|---|
| 1. Prompt evaluation | Movie-review sentiment classifier | Code metric: exact match on positive / negative |
| 2. Simple RAG | Retrieve from a corpus, then generate | LLM judge against grading notes |
| 3. AI workflow | Email triage: extract, route, reply | LLM judge against a pass-criteria checklist |
| 4. AI agent | Math agent with add / sub / mul / div tools | Numeric 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
DiscreteMetricwhen 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
aruncan take extra args such asmodel- 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.