judgeval 0.14.0__py3-none-any.whl → 0.14.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
judgeval/api/api_types.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: .openapi.json
3
- # timestamp: 2025-09-24T18:25:18+00:00
3
+ # timestamp: 2025-09-29T19:54:47+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
  from typing import Any, Dict, List, Literal, Optional, TypedDict, Union
@@ -54,6 +54,8 @@ class SavePromptScorerRequest(TypedDict):
54
54
  threshold: float
55
55
  model: NotRequired[str]
56
56
  is_trace: NotRequired[bool]
57
+ options: NotRequired[Optional[Dict[str, float]]]
58
+ description: NotRequired[Optional[str]]
57
59
 
58
60
 
59
61
  class SavePromptScorerResponse(TypedDict):
@@ -143,6 +145,8 @@ class PromptScorer(TypedDict):
143
145
  prompt: str
144
146
  threshold: float
145
147
  model: NotRequired[str]
148
+ options: NotRequired[Optional[Dict[str, float]]]
149
+ description: NotRequired[Optional[str]]
146
150
  created_at: NotRequired[Optional[str]]
147
151
  updated_at: NotRequired[Optional[str]]
148
152
  is_trace: NotRequired[Optional[bool]]
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: .openapi.json
3
- # timestamp: 2025-09-24T18:25:17+00:00
3
+ # timestamp: 2025-09-29T19:54:46+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
  from typing import Annotated, Any, Dict, List, Optional, Union
@@ -56,6 +56,8 @@ class SavePromptScorerRequest(BaseModel):
56
56
  threshold: Annotated[float, Field(title="Threshold")]
57
57
  model: Annotated[Optional[str], Field(title="Model")] = "gpt-5"
58
58
  is_trace: Annotated[Optional[bool], Field(title="Is Trace")] = False
59
+ options: Annotated[Optional[Dict[str, float]], Field(title="Options")] = None
60
+ description: Annotated[Optional[str], Field(title="Description")] = None
59
61
 
60
62
 
61
63
  class SavePromptScorerResponse(BaseModel):
@@ -156,6 +158,8 @@ class PromptScorer(BaseModel):
156
158
  prompt: Annotated[str, Field(title="Prompt")]
157
159
  threshold: Annotated[float, Field(title="Threshold")]
158
160
  model: Annotated[Optional[str], Field(title="Model")] = "gpt-5"
161
+ options: Annotated[Optional[Dict[str, float]], Field(title="Options")] = None
162
+ description: Annotated[Optional[str], Field(title="Description")] = None
159
163
  created_at: Annotated[Optional[AwareDatetime], Field(title="Created At")] = None
160
164
  updated_at: Annotated[Optional[AwareDatetime], Field(title="Updated At")] = None
161
165
  is_trace: Annotated[Optional[bool], Field(title="Is Trace")] = False
@@ -4,19 +4,21 @@ from judgeval.scorers.api_scorer import (
4
4
  TraceAPIScorerConfig,
5
5
  )
6
6
  from judgeval.constants import APIScorerType
7
- from typing import Dict, Any
7
+ from typing import Dict, Any, Optional
8
8
  from judgeval.api import JudgmentSyncClient
9
9
  from judgeval.exceptions import JudgmentAPIError
10
10
  import os
11
11
  from judgeval.logger import judgeval_logger
12
12
  from abc import ABC
13
13
  from judgeval.env import JUDGMENT_DEFAULT_GPT_MODEL
14
+ from copy import copy
14
15
 
15
16
 
16
17
  def push_prompt_scorer(
17
18
  name: str,
18
19
  prompt: str,
19
20
  threshold: float,
21
+ options: Optional[Dict[str, float]] = None,
20
22
  model: str = JUDGMENT_DEFAULT_GPT_MODEL,
21
23
  judgment_api_key: str = os.getenv("JUDGMENT_API_KEY") or "",
22
24
  organization_id: str = os.getenv("JUDGMENT_ORG_ID") or "",
@@ -29,6 +31,7 @@ def push_prompt_scorer(
29
31
  "name": name,
30
32
  "prompt": prompt,
31
33
  "threshold": threshold,
34
+ "options": options,
32
35
  "model": model,
33
36
  "is_trace": is_trace,
34
37
  }
@@ -98,6 +101,7 @@ def scorer_exists(
98
101
  class BasePromptScorer(ABC, APIScorerConfig):
99
102
  score_type: APIScorerType
100
103
  prompt: str
104
+ options: Optional[Dict[str, float]] = None
101
105
  judgment_api_key: str = os.getenv("JUDGMENT_API_KEY") or ""
102
106
  organization_id: str = os.getenv("JUDGMENT_ORG_ID") or ""
103
107
 
@@ -124,6 +128,7 @@ class BasePromptScorer(ABC, APIScorerConfig):
124
128
  name=name,
125
129
  prompt=scorer_config["prompt"],
126
130
  threshold=scorer_config["threshold"],
131
+ options=scorer_config.get("options"),
127
132
  model=scorer_config.get("model"),
128
133
  judgment_api_key=judgment_api_key,
129
134
  organization_id=organization_id,
@@ -135,6 +140,7 @@ class BasePromptScorer(ABC, APIScorerConfig):
135
140
  name: str,
136
141
  prompt: str,
137
142
  threshold: float = 0.5,
143
+ options: Optional[Dict[str, float]] = None,
138
144
  model: str = JUDGMENT_DEFAULT_GPT_MODEL,
139
145
  judgment_api_key: str = os.getenv("JUDGMENT_API_KEY") or "",
140
146
  organization_id: str = os.getenv("JUDGMENT_ORG_ID") or "",
@@ -150,6 +156,7 @@ class BasePromptScorer(ABC, APIScorerConfig):
150
156
  name,
151
157
  prompt,
152
158
  threshold,
159
+ options,
153
160
  model,
154
161
  judgment_api_key,
155
162
  organization_id,
@@ -161,6 +168,7 @@ class BasePromptScorer(ABC, APIScorerConfig):
161
168
  name=name,
162
169
  prompt=prompt,
163
170
  threshold=threshold,
171
+ options=options,
164
172
  model=model,
165
173
  judgment_api_key=judgment_api_key,
166
174
  organization_id=organization_id,
@@ -199,6 +207,14 @@ class BasePromptScorer(ABC, APIScorerConfig):
199
207
  self.push_prompt_scorer()
200
208
  judgeval_logger.info(f"Successfully updated model for {self.name}")
201
209
 
210
+ def set_options(self, options: Optional[Dict[str, float]]):
211
+ """
212
+ Updates the options of the scorer.
213
+ """
214
+ self.options = options
215
+ self.push_prompt_scorer()
216
+ judgeval_logger.info(f"Successfully updated options for {self.name}")
217
+
202
218
  def append_to_prompt(self, prompt_addition: str):
203
219
  """
204
220
  Appends a string to the prompt.
@@ -226,6 +242,12 @@ class BasePromptScorer(ABC, APIScorerConfig):
226
242
  """
227
243
  return self.model
228
244
 
245
+ def get_options(self) -> Dict[str, float] | None:
246
+ """
247
+ Returns the options of the scorer.
248
+ """
249
+ return copy(self.options) if self.options is not None else None
250
+
229
251
  def get_name(self) -> str | None:
230
252
  """
231
253
  Returns the name of the scorer.
@@ -241,6 +263,7 @@ class BasePromptScorer(ABC, APIScorerConfig):
241
263
  "model": self.model,
242
264
  "prompt": self.prompt,
243
265
  "threshold": self.threshold,
266
+ "options": self.options,
244
267
  }
245
268
 
246
269
  def push_prompt_scorer(self):
@@ -251,6 +274,7 @@ class BasePromptScorer(ABC, APIScorerConfig):
251
274
  self.name,
252
275
  self.prompt,
253
276
  self.threshold,
277
+ self.options,
254
278
  self.model,
255
279
  self.judgment_api_key,
256
280
  self.organization_id,
@@ -258,7 +282,7 @@ class BasePromptScorer(ABC, APIScorerConfig):
258
282
  )
259
283
 
260
284
  def __str__(self):
261
- return f"PromptScorer(name={self.name}, model={self.model}, prompt={self.prompt}, threshold={self.threshold})"
285
+ return f"PromptScorer(name={self.name}, model={self.model}, prompt={self.prompt}, threshold={self.threshold}, options={self.options})"
262
286
 
263
287
  def model_dump(self, *args, **kwargs) -> Dict[str, Any]:
264
288
  base = super().model_dump(*args, **kwargs)
judgeval/version.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.14.0"
1
+ __version__ = "0.14.1"
2
2
 
3
3
 
4
4
  def get_version() -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: judgeval
3
- Version: 0.14.0
3
+ Version: 0.14.1
4
4
  Summary: Judgeval Package
5
5
  Project-URL: Homepage, https://github.com/JudgmentLabs/judgeval
6
6
  Project-URL: Issues, https://github.com/JudgmentLabs/judgeval/issues
@@ -4,14 +4,14 @@ judgeval/constants.py,sha256=JZZJ1MqzZZDVk-5PRPRbmLnM8mXI-RDL5vxa1JFuscs,3408
4
4
  judgeval/env.py,sha256=37Mn4g0OkpFxXCZGlO_CLqKJnyX-jx_R24tC28XJzig,2112
5
5
  judgeval/exceptions.py,sha256=tTbfe4yoOtPXmn22UQz9-6a-5PT9uOko85xaRRwr0Sw,621
6
6
  judgeval/logger.py,sha256=ZWbp0QfT1CJnQIjV-Zle4n489nFCKEmD2-ukx--iiow,1553
7
- judgeval/version.py,sha256=qFLvC9WMqiLgjMPdAqGbBm-v0rO2ePVeM8dvl-2r7WA,74
7
+ judgeval/version.py,sha256=jxLK8GY7YWWLhTk4egDdn5VKiEty1Qpb-C3dLL2m-To,74
8
8
  judgeval/warnings.py,sha256=LbGte14ppiFjrkp-JJYueZ40NWFvMkWRvPXr6r-fUWw,73
9
9
  judgeval/api/__init__.py,sha256=3Pm0qQ4ZQj76jUsJVrnuazRnYcqF3pzM_Wv_Z6lOv0w,13216
10
- judgeval/api/api_types.py,sha256=w45Rh2I31JaqWoUsxCK5_rr_wJ1QkWYxDLjRppXkruE,8785
10
+ judgeval/api/api_types.py,sha256=mtk9xcgYGj1zXV1w_vZ_fbVu9OI4i2IIDLL37lgYnV4,8979
11
11
  judgeval/data/__init__.py,sha256=1tU0EN0ThIfQ1fad5I3dKxAfTcZ5U8cvTLcQ6qLVLU0,407
12
12
  judgeval/data/evaluation_run.py,sha256=O41p99wNAuCAf6lsLNKzkZ6W-kL9LlzCYxVls7IcKkA,4727
13
13
  judgeval/data/example.py,sha256=eGJpF-lyUH734Cg90B7WtU9f8iKoS3VFGeV6R-GVCCc,1039
14
- judgeval/data/judgment_types.py,sha256=rZ4Uq6Va94bHF0Obn3wKB7E5n77R5N5WTkK5o02EAzg,16285
14
+ judgeval/data/judgment_types.py,sha256=fNRqiGEG_nJhVkucagoxxgFqmpwK0-GlwWOwjmBtpXk,16603
15
15
  judgeval/data/result.py,sha256=XufFGSAkBDfevPUmzSgsR9HEqytISkM0U5HkhJmsjpY,2102
16
16
  judgeval/data/scorer_data.py,sha256=HeP15ZgftFTJCF8JmDJCLWXRnZJIaGDJCzl7Hg6gWwE,2006
17
17
  judgeval/data/trace.py,sha256=zSiR3o6xt8Z46XA3M9fJBtViF0BsPO6yKp9jxdscOSc,3881
@@ -39,7 +39,7 @@ judgeval/scorers/judgeval_scorers/api_scorers/answer_correctness.py,sha256=WUeFy
39
39
  judgeval/scorers/judgeval_scorers/api_scorers/answer_relevancy.py,sha256=ciiFBQQC4UDsk9qou9OiKbAR31s82eRUY1ZTt1gdM-0,407
40
40
  judgeval/scorers/judgeval_scorers/api_scorers/faithfulness.py,sha256=ucYOI6ztAjfoYmcgTDzN8u5RrehlVqrkeLEfss9b1fk,441
41
41
  judgeval/scorers/judgeval_scorers/api_scorers/instruction_adherence.py,sha256=V3RdrWhnR_vLBrtWw7QbgN9K_A-Och7-v9I2fN4z8gY,506
42
- judgeval/scorers/judgeval_scorers/api_scorers/prompt_scorer.py,sha256=UiX-qUVokx8W3EIr5i4_H6CGQT2pNBEYWSCtTUx1wLE,9196
42
+ judgeval/scorers/judgeval_scorers/api_scorers/prompt_scorer.py,sha256=FbrXNMedeepYp_bADsysapIIZcr09l9EV9QWfGxvanw,10075
43
43
  judgeval/tracer/__init__.py,sha256=iqFvWok4QBW-1bs2zCmkhw4Y_o2d2mVeiPUtQbG9Nvc,35995
44
44
  judgeval/tracer/constants.py,sha256=ae8tivAW97awJQxdRB9OMqX50wOLX3zqChT_AGkPBu0,85
45
45
  judgeval/tracer/keys.py,sha256=ho4-_w4ngTVejdSKUH80sG6vtYt4c7FEKrYpFrDfPLs,2105
@@ -72,8 +72,8 @@ judgeval/utils/serialize.py,sha256=QXR-8Nj5rqOrI9zLx0oRLdk6DW6Bc7j8eyF4zQ7PLxA,6
72
72
  judgeval/utils/testing.py,sha256=m5Nexv65tmfSj1XvAPK5Ear7aJ7w5xjDtZN0tLZ_RBk,2939
73
73
  judgeval/utils/url.py,sha256=Shf0v3XcbaWpL0m1eGJEEO_z4TsQCnDB2Rl25OTUmiI,195
74
74
  judgeval/utils/version_check.py,sha256=ylZQSqV7kLzEOChxvav9SCHUU4OnaCp36tXHLjdzmw0,1072
75
- judgeval-0.14.0.dist-info/METADATA,sha256=PN_KgV2HavJDSdkoMAnusgLD1kiKNOfXMyWEVFyYx2s,8564
76
- judgeval-0.14.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
77
- judgeval-0.14.0.dist-info/entry_points.txt,sha256=-eoeD-oDLn4A7MSgeBS9Akwanf3_0r0cgEleBcIOjg0,46
78
- judgeval-0.14.0.dist-info/licenses/LICENSE.md,sha256=tKmCg7k5QOmxPK19XMfzim04QiQJPmgIm0pAn55IJwk,11352
79
- judgeval-0.14.0.dist-info/RECORD,,
75
+ judgeval-0.14.1.dist-info/METADATA,sha256=e8rJlBzFrfcadnR6-WiBQaRTKj2LlsnuxAS-Ag_WK1Q,8564
76
+ judgeval-0.14.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
77
+ judgeval-0.14.1.dist-info/entry_points.txt,sha256=-eoeD-oDLn4A7MSgeBS9Akwanf3_0r0cgEleBcIOjg0,46
78
+ judgeval-0.14.1.dist-info/licenses/LICENSE.md,sha256=tKmCg7k5QOmxPK19XMfzim04QiQJPmgIm0pAn55IJwk,11352
79
+ judgeval-0.14.1.dist-info/RECORD,,