add inline comments to code snippets

This commit is contained in:
Dylan Couzon
2026-04-24 00:27:04 -04:00
parent 648dcf3fa5
commit d14bbd3fc1
2 changed files with 3 additions and 1 deletions
@@ -117,6 +117,7 @@ def retrieval_run(golden_set: list, collection: str, k: int = 10) -> Run:
query=entry["query_vector"],
limit=k,
).points
# p.id type must match the doc_id type in labels (ranx matches by equality).
run[entry["query_id"]] = {p.id: p.score for p in results}
return Run(run)
@@ -119,12 +119,13 @@ Pass the eval samples into `evaluate()` with those three metrics:
```python
from ragas import EvaluationDataset, evaluate
from ragas.metrics import faithfulness, answer_relevancy, context_precision
from ragas.metrics.collections import faithfulness, answer_relevancy, context_precision
dataset = EvaluationDataset(samples=samples)
scores = evaluate(
dataset,
metrics=[faithfulness, answer_relevancy, context_precision],
# For a non-OpenAI judge, pass llm= and embeddings= (see Ragas docs).
)
```