Skip to content

Commit 4a223b1

Browse files
committed
Fix model definitions on evaluators
1 parent 3a2d442 commit 4a223b1

File tree

3 files changed

+129
-83
lines changed

3 files changed

+129
-83
lines changed

evaluators/haystack/langevals_haystack/faithfulness.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@
33
# Haystack telemetry breaks for AWS lambdas because it tries to write to home folder which is read-only
44
os.environ["HAYSTACK_TELEMETRY_ENABLED"] = "false"
55

6-
from typing import Literal
76
from langevals_core.base_evaluator import (
87
BaseEvaluator,
98
EvaluatorEntry,
109
EvaluationResult,
1110
EvaluationResultSkipped,
12-
EvaluatorSettings,
1311
SingleEvaluationResult,
14-
Money,
15-
LLMEvaluatorSettings
12+
LLMEvaluatorSettings,
1613
)
17-
from pydantic import BaseModel, Field
1814
from haystack.components.evaluators import FaithfulnessEvaluator
1915

2016
from langevals_haystack.lib.common import (
@@ -30,14 +26,7 @@ class HaystackFaithfulnessEntry(EvaluatorEntry):
3026

3127

3228
class HaystackFaithfulnessSettings(LLMEvaluatorSettings):
33-
model: str = Field(
34-
default="azure/gpt-35-turbo-1106",
35-
description="The model to use for evaluation.",
36-
)
37-
max_tokens: int = Field(
38-
default=2048,
39-
description="The maximum number of tokens allowed for evaluation, a too high number can be costly. Entries above this amount will be skipped.",
40-
)
29+
pass
4130

4231

4332
class HaystackFaithfulnessResult(EvaluationResult):

evaluators/ragas/langevals_ragas/lib/common.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
from langevals_core.base_evaluator import (
77
BaseEvaluator,
88
EvaluationResult,
9-
LLMEvaluatorSettings,
9+
EvaluatorSettings,
1010
Money,
1111
EvaluationResultSkipped,
12-
EvaluatorEntry
12+
EvaluatorEntry,
1313
)
14-
from pydantic import BaseModel, Field
14+
from pydantic import Field
1515
from ragas import evaluate
1616
from ragas.metrics.base import Metric
1717
from ragas.llms import LangchainLLMWrapper
@@ -38,34 +38,34 @@
3838
from tqdm.notebook import tqdm as tqdm_notebook
3939
from functools import partialmethod
4040

41-
import json
42-
import re
4341
from typing import List, Optional
4442
from datasets import Dataset
4543
from ragas import evaluate
4644
from ragas.metrics import faithfulness, Faithfulness
4745
from ragas.llms import LangchainLLMWrapper
48-
from ragas.llms.prompt import PromptValue
49-
from langchain_core.callbacks import Callbacks
50-
from pydantic import BaseModel, Field
51-
import litellm
52-
from langchain.schema.output import LLMResult
53-
from langchain_core.outputs.generation import Generation
46+
from pydantic import Field
5447
from langevals_core.utils import calculate_total_tokens
5548

5649
env_vars = []
5750

5851

59-
class RagasSettings(LLMEvaluatorSettings):
60-
model: str = Field(
61-
default="azure/gpt-35-turbo-16k",
52+
class RagasSettings(EvaluatorSettings):
53+
model: Literal[
54+
"openai/gpt-3.5-turbo-16k",
55+
"openai/gpt-4o",
56+
"openai/gpt-4o-mini",
57+
"azure/gpt-35-turbo-16k",
58+
"azure/gpt-4o",
59+
"anthropic/claude-3-5-sonnet-20240620",
60+
] = Field(
61+
default="openai/gpt-3.5-turbo-16k",
6262
description="The model to use for evaluation.",
6363
)
6464
embeddings_model: Literal[
6565
"openai/text-embedding-ada-002",
6666
"azure/text-embedding-ada-002",
6767
] = Field(
68-
default="azure/text-embedding-ada-002",
68+
default="openai/text-embedding-ada-002",
6969
description="The model to use for embeddings.",
7070
)
7171
max_tokens: int = Field(

0 commit comments

Comments
 (0)