mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-02 09:28:30 +02:00
add inline comments to code snippets
This commit is contained in:
+1
@@ -117,6 +117,7 @@ def retrieval_run(golden_set: list, collection: str, k: int = 10) -> Run:
|
|||||||
query=entry["query_vector"],
|
query=entry["query_vector"],
|
||||||
limit=k,
|
limit=k,
|
||||||
).points
|
).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}
|
run[entry["query_id"]] = {p.id: p.score for p in results}
|
||||||
return Run(run)
|
return Run(run)
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -119,12 +119,13 @@ Pass the eval samples into `evaluate()` with those three metrics:
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
from ragas import EvaluationDataset, evaluate
|
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)
|
dataset = EvaluationDataset(samples=samples)
|
||||||
scores = evaluate(
|
scores = evaluate(
|
||||||
dataset,
|
dataset,
|
||||||
metrics=[faithfulness, answer_relevancy, context_precision],
|
metrics=[faithfulness, answer_relevancy, context_precision],
|
||||||
|
# For a non-OpenAI judge, pass llm= and embeddings= (see Ragas docs).
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user