inspect-ai 0.3.77__py3-none-any.whl → 0.3.79__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.
inspect_ai/_eval/run.py CHANGED
@@ -115,16 +115,6 @@ async def eval_run(
115
115
  eval_solver = None
116
116
  eval_solver_spec = None
117
117
 
118
- # resolve the task scorers
119
- eval_scorer_specs = (
120
- [as_scorer_spec(scorer) for scorer in task.scorer]
121
- if task.scorer is not None
122
- else None
123
- )
124
-
125
- # resolve task metrics
126
- eval_metrics = to_metric_specs(task.metrics) if task.metrics is not None else None
127
-
128
118
  try:
129
119
  # create run tasks
130
120
  task_run_options: list[TaskRunOptions] = []
@@ -137,6 +127,18 @@ async def eval_run(
137
127
  task = resolved_task.task
138
128
  task_eval_config = eval_config.model_copy()
139
129
 
130
+ # resolve the task scorers
131
+ eval_scorer_specs = (
132
+ [as_scorer_spec(scorer) for scorer in task.scorer]
133
+ if task.scorer is not None
134
+ else None
135
+ )
136
+
137
+ # resolve task metrics
138
+ eval_metrics = (
139
+ to_metric_specs(task.metrics) if task.metrics is not None else None
140
+ )
141
+
140
142
  # epochs
141
143
  if task_eval_config.epochs is None:
142
144
  task_eval_config.epochs = task.epochs
@@ -73,11 +73,17 @@ async def openai_responses_input(
73
73
  elif message.role == "assistant":
74
74
  reasoning_content = openai_responses_reasponing_content_params(message.content)
75
75
  if message.content:
76
+ formatted_id = str(message.id).replace("resp_", "msg_", 1)
77
+ if not formatted_id.startswith("msg_"):
78
+ # These messages MUST start with `msg_`.
79
+ # As `store=False` for this provider, OpenAI doesn't validate the IDs.
80
+ # This will keep them consistent across calls though.
81
+ formatted_id = f"msg_{formatted_id}"
76
82
  text_content = [
77
83
  ResponseOutputMessageParam(
78
84
  type="message",
79
85
  role="assistant",
80
- id=str(message.id).replace("resp_", "msg_", 1),
86
+ id=formatted_id,
81
87
  content=openai_responses_text_content_params(message.content),
82
88
  status="completed",
83
89
  )
@@ -177,15 +177,10 @@ class GoogleGenAIAPI(ModelAPI):
177
177
  self.api_key = os.environ.get(GOOGLE_API_KEY, None)
178
178
 
179
179
  # custom base_url
180
- base_url = model_base_url(base_url, "GOOGLE_BASE_URL")
180
+ self.base_url = model_base_url(self.base_url, "GOOGLE_BASE_URL")
181
181
 
182
- # create client
183
- self.client = Client(
184
- vertexai=self.is_vertex(),
185
- api_key=self.api_key,
186
- http_options={"base_url": base_url},
187
- **model_args,
188
- )
182
+ # save model args
183
+ self.model_args = model_args
189
184
 
190
185
  @override
191
186
  async def close(self) -> None:
@@ -202,11 +197,19 @@ class GoogleGenAIAPI(ModelAPI):
202
197
  tool_choice: ToolChoice,
203
198
  config: GenerateConfig,
204
199
  ) -> ModelOutput | tuple[ModelOutput | Exception, ModelCall]:
200
+ # create client
201
+ client = Client(
202
+ vertexai=self.is_vertex(),
203
+ api_key=self.api_key,
204
+ http_options={"base_url": self.base_url},
205
+ **self.model_args,
206
+ )
207
+
205
208
  # generate request_id
206
209
  request_id = urllib3_hooks().start_request()
207
210
 
208
211
  # Create google-genai types.
209
- gemini_contents = await as_chat_messages(self.client, input)
212
+ gemini_contents = await as_chat_messages(client, input)
210
213
  gemini_tools = chat_tools(tools) if len(tools) > 0 else None
211
214
  gemini_tool_config = chat_tool_config(tool_choice) if len(tools) > 0 else None
212
215
  parameters = GenerateContentConfig(
@@ -222,9 +225,7 @@ class GoogleGenAIAPI(ModelAPI):
222
225
  safety_settings=safety_settings_to_list(self.safety_settings),
223
226
  tools=gemini_tools,
224
227
  tool_config=gemini_tool_config,
225
- system_instruction=await extract_system_message_as_parts(
226
- self.client, input
227
- ),
228
+ system_instruction=await extract_system_message_as_parts(client, input),
228
229
  )
229
230
  if config.response_schema is not None:
230
231
  parameters.response_mime_type = "application/json"
@@ -246,7 +247,7 @@ class GoogleGenAIAPI(ModelAPI):
246
247
  )
247
248
 
248
249
  try:
249
- response = await self.client.aio.models.generate_content(
250
+ response = await client.aio.models.generate_content(
250
251
  model=self.model_name,
251
252
  contents=gemini_contents,
252
253
  config=parameters,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inspect_ai
3
- Version: 0.3.77
3
+ Version: 0.3.79
4
4
  Summary: Framework for large language model evaluations
5
5
  Author: UK AI Security Institute
6
6
  License: MIT License
@@ -50,7 +50,7 @@ inspect_ai/_eval/evalset.py,sha256=HGrz0LkTMsBbYDPZEMVnZCmFi_pYegZtSoqRVYbRDiE,2
50
50
  inspect_ai/_eval/list.py,sha256=VbZ-2EI6MqrXvCN7VTz21TQSoU5K5_Q0hqhxmj5A_m0,3744
51
51
  inspect_ai/_eval/loader.py,sha256=yOj8HqYBFQntx0_GY4Wxqm6jivlT4N4WiQ1T8J9uRVA,23606
52
52
  inspect_ai/_eval/registry.py,sha256=9Q-Re9uZagQ2nw-W7hA6zhrmCQFmo3KcxncTcG24EG8,5315
53
- inspect_ai/_eval/run.py,sha256=9TtOp1vc18KclxstjvWhEL5VtcLBL3SRbRwsoRXaah8,19179
53
+ inspect_ai/_eval/run.py,sha256=7Cepcyd5KaMcoUQybRifTtFEOLBBvmszhJdH_-yzb3E,19315
54
54
  inspect_ai/_eval/score.py,sha256=qf9T8XwUmfE6A8QK1-D-jUbNlLETVM-HXhucPWZ0Ro0,9591
55
55
  inspect_ai/_eval/task/__init__.py,sha256=6FvojMW3yo36L7xDacppCHDxt6A8_tzj_ftg5bQ6eNk,199
56
56
  inspect_ai/_eval/task/constants.py,sha256=quAKMw-4-3xKd1T_KwXCZvHYoKRXt1ZGuaHbBcWJwnA,72
@@ -460,7 +460,7 @@ inspect_ai/model/_model.py,sha256=LaRXqKvM2fl9HGCQAdrOOkNryfYU970LZGsyOxk1o00,48
460
460
  inspect_ai/model/_model_call.py,sha256=VJ8wnl9Y81JaiClBYM8eyt1jVb3n-yc6Dd88ofRiJDc,2234
461
461
  inspect_ai/model/_model_output.py,sha256=1picjX2Y0NSmEZ-vdQi42QAx3QvMcWVRn8pXP2wtmN8,7733
462
462
  inspect_ai/model/_openai.py,sha256=3_lQ3u-WJ8BOY5bMLM49LvAePzCZAn57Vi2SNLrWPm4,19093
463
- inspect_ai/model/_openai_responses.py,sha256=7xViQD1JZuoAkT_0znFT1-r-q57m2OvL-zaEoWP1FYM,9690
463
+ inspect_ai/model/_openai_responses.py,sha256=qav1Fj2R-DOCkUfkrtGxV_PeT578mBZNwKt-yL4bmT0,10049
464
464
  inspect_ai/model/_reasoning.py,sha256=qmR8WT6t_cb7NIsJOQHPyFZh2eLV0HmYxKo2vtvteQ4,929
465
465
  inspect_ai/model/_registry.py,sha256=Cr2y32EqLnOqLbSWoXHVK4ivTTzCUhJuACxoTyPt8kY,2032
466
466
  inspect_ai/model/_render.py,sha256=rWypNUjgrH4NGp0r-ESAze9gZz7lYNjheEP438vRYZE,922
@@ -469,7 +469,7 @@ inspect_ai/model/_providers/azureai.py,sha256=tDWuePLhnZBcpHLVzX7J3Wx8VRPhW8tmtj
469
469
  inspect_ai/model/_providers/bedrock.py,sha256=mLeMW2JkG4lF0VQGEdku73ZL00EBy-hEvEcyCdjDUDo,24153
470
470
  inspect_ai/model/_providers/cloudflare.py,sha256=0e0HPas21cVC8N9mNJlZnSZyIt6FUB9lTIAqPXJDrtE,4586
471
471
  inspect_ai/model/_providers/goodfire.py,sha256=EzebC1woEjIXfHLP_ixpMR6G1hC-LxbSUxiilq1c-Is,8868
472
- inspect_ai/model/_providers/google.py,sha256=YkgeFxVh9hMWoqiHe39wgt02eNTogMxmlYX6goYWyo0,28697
472
+ inspect_ai/model/_providers/google.py,sha256=zWvANIFJfkrsKfXZXL37gEr318uIRWEP7t7nDC20efA,28731
473
473
  inspect_ai/model/_providers/grok.py,sha256=dS88ueXiD-kHAFr0jCoTpTGLGa2VsUlB_TFP8L_2lBM,995
474
474
  inspect_ai/model/_providers/groq.py,sha256=Fr4fy8NmqllmUW7jhnQ3W94zGlxyr276qaGFS_iDI3Q,11189
475
475
  inspect_ai/model/_providers/hf.py,sha256=EZRiiRSzIoRCdFYKj3Otn5ebsROdjzx5YSQ6CzqOJxk,17969
@@ -627,9 +627,9 @@ inspect_ai/util/_sandbox/docker/internal.py,sha256=c8X8TLrBPOvsfnq5TkMlb_bzTALyc
627
627
  inspect_ai/util/_sandbox/docker/prereqs.py,sha256=0j6_OauBBnVlpBleADcZavIAAQZy4WewVjbRn9c0stg,3355
628
628
  inspect_ai/util/_sandbox/docker/service.py,sha256=hhHIWH1VDFLwehdGd19aUBD_VKfDO3GCPxpw1HSwVQk,2437
629
629
  inspect_ai/util/_sandbox/docker/util.py,sha256=EeInihCNXgUWxaqZ4dNOJd719kXL2_jr63QCoXn68vA,3154
630
- inspect_ai-0.3.77.dist-info/licenses/LICENSE,sha256=xZPCr8gTiFIerrA_DRpLAbw-UUftnLFsHxKeW-NTtq8,1081
631
- inspect_ai-0.3.77.dist-info/METADATA,sha256=7neEk8lnUwF8p-Snz7AFFvKCnxMsClI7B8cTJ2Tpo44,4997
632
- inspect_ai-0.3.77.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
633
- inspect_ai-0.3.77.dist-info/entry_points.txt,sha256=WGGLmzTzDWLzYfiyovSY6oEKuf-gqzSDNOb5V-hk3fM,54
634
- inspect_ai-0.3.77.dist-info/top_level.txt,sha256=Tp3za30CHXJEKLk8xLe9qGsW4pBzJpEIOMHOHNCXiVo,11
635
- inspect_ai-0.3.77.dist-info/RECORD,,
630
+ inspect_ai-0.3.79.dist-info/licenses/LICENSE,sha256=xZPCr8gTiFIerrA_DRpLAbw-UUftnLFsHxKeW-NTtq8,1081
631
+ inspect_ai-0.3.79.dist-info/METADATA,sha256=dT3qQqF-VjPdilNfzt9Lh8PhNbq66fckvnlGimNxAAY,4997
632
+ inspect_ai-0.3.79.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
633
+ inspect_ai-0.3.79.dist-info/entry_points.txt,sha256=WGGLmzTzDWLzYfiyovSY6oEKuf-gqzSDNOb5V-hk3fM,54
634
+ inspect_ai-0.3.79.dist-info/top_level.txt,sha256=Tp3za30CHXJEKLk8xLe9qGsW4pBzJpEIOMHOHNCXiVo,11
635
+ inspect_ai-0.3.79.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.0.2)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5