Skip to content

Commit

Permalink
chore: added an e2e test in Makefile (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjmachan authored Jul 27, 2023
1 parent 90db3ba commit 234354d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ run-benchmarks: ## Run benchmarks
test: ## Run tests
@echo "Running tests..."
@pytest tests/unit $(shell if [ -n "$(k)" ]; then echo "-k $(k)"; fi)
test-e2e: ## Run end2end tests
echo "running end2end tests..."
@pytest tests/e2e -s
6 changes: 6 additions & 0 deletions src/ragas/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def evaluate(
later. If the top 3 metrics are provided then it also returns the `ragas_score`
for the entire pipeline.
Raises
------
ValueError
if validation fails because the columns required for the metrics are missing or
if the columns are of the wrong format.
Examples
--------
the basic usage is as follows:
Expand Down
14 changes: 14 additions & 0 deletions tests/e2e/test_fullflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from datasets import load_dataset

from ragas import evaluate
from ragas.metrics import answer_relevancy, context_relevancy, faithfulness
from ragas.metrics.critique import harmfulness


def test_evaluate_e2e():
ds = load_dataset("explodinggradients/fiqa", "ragas_eval")["baseline"]
result = evaluate(
ds.select(range(5)),
metrics=[answer_relevancy, context_relevancy, faithfulness, harmfulness],
)
assert result is not None

0 comments on commit 234354d

Please sign in to comment.