Skip to content

Commit

Permalink
fix: added types so you can pass langchain llms and embeddings too (#652
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jjmachan authored Feb 23, 2024
1 parent 2a3c3ab commit 317a2d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/ragas/embeddings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
BaseRagasEmbeddings,
HuggingfaceEmbeddings,
LangchainEmbeddingsWrapper,
embedding_factory,
)

__all__ = [
"HuggingfaceEmbeddings",
"BaseRagasEmbeddings",
"LangchainEmbeddingsWrapper",
"embedding_factory",
]
12 changes: 8 additions & 4 deletions src/ragas/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

from ragas._analytics import EvaluationEvent, track
from ragas.callbacks import new_group
from ragas.embeddings.base import BaseRagasEmbeddings, LangchainEmbeddingsWrapper, embedding_factory
from ragas.embeddings.base import (
BaseRagasEmbeddings,
LangchainEmbeddingsWrapper,
embedding_factory,
)
from ragas.llms import llm_factory
from ragas.exceptions import ExceptionInRunner
from ragas.executor import Executor
Expand All @@ -36,8 +40,8 @@
def evaluate(
dataset: Dataset,
metrics: list[Metric] | None = None,
llm: t.Optional[BaseRagasLLM] = None,
embeddings: t.Optional[BaseRagasEmbeddings] = None,
llm: t.Optional[BaseRagasLLM | LangchainLLM] = None,
embeddings: t.Optional[BaseRagasEmbeddings | LangchainEmbeddings] = None,
callbacks: Callbacks = [],
is_async: bool = False,
max_workers: t.Optional[int] = None,
Expand Down Expand Up @@ -79,7 +83,7 @@ def evaluate(
run_config: RunConfig, optional
Configuration for runtime settings like timeout and retries. If not provided,
default values are used.
raise_exceptions: bool, optional
raise_exceptions: True
Whether to raise exceptions or not. If set to True then the evaluation will
raise an exception if any of the metrics fail. If set to False then the
evaluation will return `np.nan` for the row that failed. Default is True.
Expand Down

0 comments on commit 317a2d8

Please sign in to comment.