Skip to content

More verbose error handling for #1990 #2014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ make run-ci V=1

## Running Tests

To install the libraries required for testing:
```bash
pip install -e ".[test]"
```

To run the test suite:

```bash
Expand Down
11 changes: 11 additions & 0 deletions src/ragas/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,17 @@ def evaluate(
if dataset is None:
raise ValueError("Provide dataset!")

# Check metrics are correct type
if not isinstance(metrics, None | list):
raise TypeError(
"Metrics should be provded in a list, e.g: metrics=[BleuScore()]"
)

if isinstance(metrics, list) and any(not isinstance(m, Metric) for m in metrics):
raise TypeError(
"All metrics must be initialised metric objects, e.g: metrics=[BleuScore(), AspectCritic()]"
)

# default metrics
if metrics is None:
from ragas.metrics import (
Expand Down