Skip to content

Commit

Permalink
chore: make ragas as extra requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
PanQiWei committed Feb 26, 2024
1 parent 1e448d4 commit ccd2a93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "leaf-eval-tools"
version = "0.1.0"
version = "0.1.1"
description = "A project that provides eval tools for leaf-playground based projects"
authors = [
"The LEAF team (past and future) with the help of all our contributors <leaf@shanda.com>",
Expand All @@ -17,6 +17,9 @@ datasets = "^2.15.0"
ragas = "^0.1.1"
leaf_ai_backends = "^0.1.0"

[tool.poetry.extras]
ragas = ["ragas"]

[tool.black]
line-length = 119
skip-magic-trailing-comma = true
Expand Down
1 change: 1 addition & 0 deletions src/leaf_eval_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.1"
5 changes: 5 additions & 0 deletions src/leaf_eval_tools/ragas_eval_worker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from typing import Any, Dict, Literal, List, Optional, Union

try:
import ragas
except ImportError:
raise ImportError("ragas not installed, please running `pip install leaf-eval-tools[ragas]` to enable ragas.")

from datasets import Dataset
from ragas import evaluate
from ragas.evaluation import Result
Expand Down

0 comments on commit ccd2a93

Please sign in to comment.