verifiers 0.3.1.dev63__py3-none-any.whl → 0.3.1.dev65__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.
@@ -359,12 +359,8 @@ class TrainClient(Client):
359
359
  multi_modal_data = None
360
360
  prompt_attribution: RenderedTokens | None = None
361
361
  model = body["model"]
362
- raw_sampling = sampling.model_dump(exclude_none=True)
363
- sampling_params: dict[str, Any] = dict(
364
- raw_sampling.pop("extra_body", None) or {}
365
- )
362
+ sampling_params = sampling.wire_args()
366
363
  chat_template_kwargs = sampling_params.pop("chat_template_kwargs", None)
367
- sampling_params.update(raw_sampling)
368
364
  pool = ElasticRendererPool(
369
365
  self.config.renderer_model_name or model,
370
366
  self.config.renderer,
@@ -54,6 +54,12 @@ class NetworkPolicyConfig(BaseConfig):
54
54
  def network_restricted(self) -> bool:
55
55
  return "*" not in self.allow or bool(self.block)
56
56
 
57
+ def permits(self, scheme: str, host: str, port: int) -> bool:
58
+ """Whether the destination is allowed by the configured egress rules."""
59
+ return not any(
60
+ network_rule_matches(rule, scheme, host, port) for rule in self.block
61
+ ) and any(network_rule_matches(rule, scheme, host, port) for rule in self.allow)
62
+
57
63
  def with_task_network_policy(self, allow: list[str], block: list[str]) -> Self:
58
64
  values = self.model_dump()
59
65
  if "*" in allow:
@@ -443,6 +443,7 @@ class AnthropicDialect(Dialect[MessageCreateParams, AnthropicMessage]):
443
443
  "top_p",
444
444
  "top_k",
445
445
  "max_tokens",
446
+ "service_tier",
446
447
  "stop_sequences",
447
448
  "thinking",
448
449
  "tool_choice",
@@ -700,19 +701,17 @@ class AnthropicDialect(Dialect[MessageCreateParams, AnthropicMessage]):
700
701
  # Preserve native fields except the eval's model + sampling. `temperature`/`top_p` are
701
702
  # authoritative (always dropped, the eval's applied if set); `max_tokens` is required by
702
703
  # the API, so the program's is kept unless the eval sets one.
703
- s = sampling.model_dump(exclude_none=True)
704
- overrides: dict = {"model": model}
705
- if "temperature" in s:
706
- overrides["temperature"] = s["temperature"]
707
- if "top_p" in s:
708
- overrides["top_p"] = s["top_p"]
709
- if "max_tokens" in s:
710
- overrides["max_tokens"] = s["max_tokens"]
711
- if "reasoning_effort" in s:
704
+ s = sampling.wire_args()
705
+ reasoning_effort = s.pop("reasoning_effort", None)
706
+ sampling_output_config = s.pop("output_config", None)
707
+ overrides: dict = {**s, "model": model}
708
+ if sampling_output_config is not None or reasoning_effort is not None:
712
709
  overrides["output_config"] = {
713
710
  **dict(body.get("output_config") or {}),
714
- "effort": s["reasoning_effort"],
711
+ **dict(sampling_output_config or {}),
715
712
  }
713
+ if reasoning_effort is not None:
714
+ overrides["output_config"]["effort"] = reasoning_effort
716
715
  steered = {
717
716
  k: v
718
717
  for k, v in body.items()
@@ -21,7 +21,7 @@ from urllib.parse import urlsplit
21
21
  from pydantic import AnyHttpUrl, BaseModel, TypeAdapter, ValidationError
22
22
  from pydantic_core import from_json
23
23
 
24
- from verifiers.v1.configs.runtime import NetworkPolicyConfig, network_rule_matches
24
+ from verifiers.v1.configs.runtime import NetworkPolicyConfig
25
25
  from verifiers.v1.types import Request, Response, Sampling, SamplingConfig
26
26
 
27
27
  ReqT = TypeVar("ReqT")
@@ -47,11 +47,7 @@ def blocked_url(value: str, policy: NetworkPolicyConfig) -> bool:
47
47
  except ValidationError:
48
48
  return True
49
49
  host = url.host.lower().rstrip(".").strip("[]")
50
- return any(
51
- network_rule_matches(rule, url.scheme, host, url.port) for rule in policy.block
52
- ) or not any(
53
- network_rule_matches(rule, url.scheme, host, url.port) for rule in policy.allow
54
- )
50
+ return not policy.permits(url.scheme, host, url.port)
55
51
 
56
52
 
57
53
  def provider_allowed_domains(
@@ -347,6 +347,7 @@ class ChatDialect(Dialect[CompletionCreateParams, ChatCompletion]):
347
347
  "presence_penalty",
348
348
  "repetition_penalty",
349
349
  "response_format",
350
+ "service_tier",
350
351
  "tool_choice",
351
352
  "parallel_tool_calls",
352
353
  "extra_body",
@@ -550,7 +551,15 @@ class ChatDialect(Dialect[CompletionCreateParams, ChatCompletion]):
550
551
  # Preserve the program's native fields, overlaying only what the eval owns: the model and
551
552
  # the sampling knobs it set. The selected model is authoritative even if a permissive
552
553
  # sampling config carries an extra field named `model`.
554
+ overrides = sampling.wire_args()
555
+ max_token_keys = {"max_tokens", "max_completion_tokens"}
556
+ max_tokens_overridden = not max_token_keys.isdisjoint(overrides)
557
+ steered = {
558
+ k: v
559
+ for k, v in body.items()
560
+ if not max_tokens_overridden or k not in max_token_keys
561
+ }
553
562
  return cast(
554
563
  CompletionCreateParams,
555
- {**body, **sampling.model_dump(exclude_none=True), "model": model},
564
+ {**steered, **overrides, "model": model},
556
565
  )
@@ -427,6 +427,7 @@ class ResponsesDialect(Dialect[ResponseCreateParams, OpenAIResponse]):
427
427
  "max_output_tokens",
428
428
  "max_tool_calls",
429
429
  "reasoning",
430
+ "service_tier",
430
431
  "text",
431
432
  "tool_choice",
432
433
  "parallel_tool_calls",
@@ -756,32 +757,32 @@ class ResponsesDialect(Dialect[ResponseCreateParams, OpenAIResponse]):
756
757
  ) -> ResponseCreateParams:
757
758
  # Preserve native fields except the eval's model + sampling, mapped to the Responses shape
758
759
  # (`max_tokens` -> `max_output_tokens`); sampling is authoritative.
759
- s = sampling.model_dump(exclude_none=True)
760
+ s = sampling.wire_args()
761
+ max_tokens = s.pop("max_tokens", None)
762
+ reasoning_effort = s.pop("reasoning_effort", None)
763
+ sampling_reasoning = s.pop("reasoning", None)
760
764
  name = model.rsplit("/", 1)[-1]
761
765
  reasoning_model = (
762
766
  name.startswith(("gpt-5", "o1", "o3", "o4"))
763
767
  and "-chat" not in name
764
768
  and ("/" not in model or model.startswith("openai/"))
765
769
  )
766
- overrides: dict = {"model": model}
770
+ overrides: dict = {**s, "model": model}
767
771
  if reasoning_model:
768
772
  # Preserve opaque reasoning state so it can be replayed on the next turn.
769
- include = list(body.get("include") or [])
773
+ include = list(overrides.get("include") or body.get("include") or [])
770
774
  if "reasoning.encrypted_content" not in include:
771
775
  include.append("reasoning.encrypted_content")
772
776
  overrides["include"] = include
773
- if "temperature" in s:
774
- overrides["temperature"] = s["temperature"]
775
- if "top_p" in s:
776
- overrides["top_p"] = s["top_p"]
777
- if "max_tokens" in s:
778
- overrides["max_output_tokens"] = s["max_tokens"]
779
- reasoning = dict(body.get("reasoning") or {})
780
- if reasoning_model:
781
- # Summaries provide the trace's readable reasoning text.
782
- reasoning = {"summary": "auto", **reasoning}
783
- if "reasoning_effort" in s:
784
- reasoning["effort"] = s["reasoning_effort"]
777
+ if max_tokens is not None:
778
+ overrides["max_output_tokens"] = max_tokens
779
+ reasoning = {
780
+ **({"summary": "auto"} if reasoning_model else {}),
781
+ **dict(body.get("reasoning") or {}),
782
+ **dict(sampling_reasoning or {}),
783
+ }
784
+ if reasoning_effort is not None:
785
+ reasoning["effort"] = reasoning_effort
785
786
  if reasoning:
786
787
  overrides["reasoning"] = reasoning
787
788
  steered = {
@@ -261,7 +261,9 @@ class DockerRuntime(Runtime):
261
261
  # Setup is trusted; colocated servers fetch their task from host interception
262
262
  # before the final framework routes are known.
263
263
  self._proxy = EgressProxy(
264
- NetworkPolicy(["*"], [], [HOST_ALIAS], allow_non_global=True)
264
+ NetworkPolicy(
265
+ NetworkPolicyConfig(), [HOST_ALIAS], allow_non_global=True
266
+ )
265
267
  )
266
268
  if sys.platform == "linux":
267
269
  await self._proxy.start(listener=await self._container_listener())
@@ -346,18 +348,14 @@ class DockerRuntime(Runtime):
346
348
  assert self._proxy is not None
347
349
  if routes is None:
348
350
  self._proxy.policy = NetworkPolicy(
349
- ["*"], [], [HOST_ALIAS], allow_non_global=True
351
+ NetworkPolicyConfig(), [HOST_ALIAS], allow_non_global=True
350
352
  )
351
353
  return
352
354
  framework = [
353
355
  urlsplit(url)._replace(path="", query="", fragment="").geturl()
354
356
  for url in routes
355
357
  ]
356
- self._proxy.policy = NetworkPolicy(
357
- self.config.allow,
358
- self.config.block,
359
- framework,
360
- )
358
+ self._proxy.policy = NetworkPolicy(self.config, framework)
361
359
  if self._cut:
362
360
  return
363
361
  script = (
@@ -13,7 +13,7 @@ from urllib.parse import urlsplit, urlunsplit
13
13
 
14
14
  import h11
15
15
 
16
- from verifiers.v1.configs.runtime import network_rule_matches
16
+ from verifiers.v1.configs.runtime import NetworkPolicyConfig, network_rule_matches
17
17
 
18
18
  HOST_ALIAS = "vf.host.internal"
19
19
  _HEADER_TIMEOUT = 10
@@ -30,8 +30,7 @@ async def _drain(writer: asyncio.StreamWriter) -> None:
30
30
 
31
31
  @dataclass
32
32
  class NetworkPolicy:
33
- allow: list[str]
34
- block: list[str]
33
+ config: NetworkPolicyConfig
35
34
  routes: list[str]
36
35
  allow_non_global: bool = False # trusted setup only
37
36
 
@@ -47,7 +46,7 @@ class NetworkPolicy:
47
46
  rule.lower().startswith(f"{scheme}://")
48
47
  and network_rule_matches(rule, scheme, host, port)
49
48
  )
50
- for rule in [*self.routes, *self.allow]
49
+ for rule in [*self.routes, *self.config.allow]
51
50
  )
52
51
  ):
53
52
  return False
@@ -65,11 +64,7 @@ class NetworkPolicy:
65
64
  with contextlib.suppress(ValueError):
66
65
  if ip_address(hostname).is_loopback:
67
66
  return False
68
- if any(network_rule_matches(rule, scheme, host, port) for rule in self.block):
69
- return False
70
- return any(
71
- network_rule_matches(rule, scheme, host, port) for rule in self.allow
72
- )
67
+ return self.config.permits(scheme, host, port)
73
68
 
74
69
 
75
70
  async def _read_client_hello(
verifiers/v1/types.py CHANGED
@@ -250,6 +250,18 @@ class SamplingConfig(BaseModel):
250
250
  None, validation_alias=AliasChoices("max_tokens", "max_completion_tokens")
251
251
  )
252
252
 
253
+ def wire_args(self) -> dict[str, Any]:
254
+ """Flatten OpenAI-style ``extra_body`` before building a provider request."""
255
+ args = self.model_dump(exclude_none=True)
256
+ extra_body = {
257
+ key: value
258
+ for key, value in (args.pop("extra_body", None) or {}).items()
259
+ if value is not None
260
+ }
261
+ if "max_tokens" in args:
262
+ extra_body.pop("max_completion_tokens", None)
263
+ return {**extra_body, **args}
264
+
253
265
 
254
266
  Sampling = SamplingConfig
255
267
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.3.1.dev63
3
+ Version: 0.3.1.dev65
4
4
  Summary: Verifiers: Environments for LLM Reinforcement Learning
5
5
  Project-URL: Homepage, https://github.com/primeintellect-ai/verifiers
6
6
  Project-URL: Documentation, https://github.com/primeintellect-ai/verifiers
@@ -182,7 +182,7 @@ verifiers/v1/state.py,sha256=EckF2bWp-vV4b1jYJ9sLI5xrfGuI5spIgYYwW926toI,595
182
182
  verifiers/v1/task.py,sha256=ZiAE5uGxgHWqz8UF5YJHs80RgSKhxGMGQo4lJusSRus,11375
183
183
  verifiers/v1/taskset.py,sha256=fp2E0IEhL_Ybj9cegZwljfTmW27p_30zTWHFKw_kXE4,4374
184
184
  verifiers/v1/trace.py,sha256=GbuQVcPUFdBYSXqeO36UT6xKBQCtY656Tg8Icgut_xk,24908
185
- verifiers/v1/types.py,sha256=-0MFoN-_94B2GhDDwFOcRp-nlTki53f-5bV-ZOOxCSY,9119
185
+ verifiers/v1/types.py,sha256=P80GZ-_J1lfro6fGQage7ZtKA1ylHlA8HnVx65ySh5M,9592
186
186
  verifiers/v1/acp/__init__.py,sha256=-QQh5ZT0o9j98CzqltsheccmM3Xqqyneu-vN1U0NJ38,10232
187
187
  verifiers/v1/acp/runner.py,sha256=aP7yyXMDp1nkU-L20BSqcwqRo9YEhNnpM8u_dWfFpCw,9528
188
188
  verifiers/v1/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -207,7 +207,7 @@ verifiers/v1/clients/__init__.py,sha256=Ysig0tE_0E4Jsfgfes1XHN-fK1s_RCXdqZD6E7lK
207
207
  verifiers/v1/clients/base.py,sha256=PoDw4GMqrfuPTFVK6n2jDmlD0_lJ5zTrYcNio5yq6K8,1691
208
208
  verifiers/v1/clients/client.py,sha256=zqC_AkiD9pl0kxxIbupNiehbS-YnVdp3EMZ0LOHTd8U,3125
209
209
  verifiers/v1/clients/eval.py,sha256=-OcYUqlj8dBRjyuffMvymc1fMfZcjo-p5q8ZSMvDGzY,8106
210
- verifiers/v1/clients/train.py,sha256=9zcZSRjFLJpFfbulc6hKFr2ITMA-WZx2P7gogy4Gh9M,18684
210
+ verifiers/v1/clients/train.py,sha256=gCsk4zJN1eE5LcTR1_bC5mR-5y4mh4sW0AO3I-LxZUg,18511
211
211
  verifiers/v1/configs/__init__.py,sha256=X7u6X7B3ieD1HZl79Tv1kg-yPHbT0QLvAebaGqxVtvA,317
212
212
  verifiers/v1/configs/agent.py,sha256=L5P6ombAi4U5wwsspMHAuM8111sB9AVdm8q6B5iV1lw,3251
213
213
  verifiers/v1/configs/client.py,sha256=E7ZxeWBFV_AP8MyfxXncTZs-Yn-QKdDS57HCAzqVTrQ,4437
@@ -215,7 +215,7 @@ verifiers/v1/configs/env.py,sha256=-Bcdd4MEPfekVc_fnpiwsb9UDwCNdNCKrAHGoQuuXu8,7
215
215
  verifiers/v1/configs/harness.py,sha256=nk046YBXjSv_cNQJQeOSDddbwbH9BI4GXylixFvL4I4,1640
216
216
  verifiers/v1/configs/judge.py,sha256=CBmGgyHXVpcBctvrFD5GlW75wpeFXVFajq_xiMaAVDk,2142
217
217
  verifiers/v1/configs/retries.py,sha256=-nPlgmz7J_NZ4GOYG6oCc3thXo4La2SufBmvQGvvPGo,821
218
- verifiers/v1/configs/runtime.py,sha256=leFPSRJ9zn21LThTZ6jL4pMmdOHAy4g2hRpNbidKKt0,2624
218
+ verifiers/v1/configs/runtime.py,sha256=IBX3FxiJ2RJaiX2aKghQ15clFHvJpPUXy8GWQOpNhYM,2967
219
219
  verifiers/v1/configs/serve.py,sha256=oa_0BrAVEKboU344w0hYkSaXj8lf26t0H87gvncAo0Q,2716
220
220
  verifiers/v1/configs/task.py,sha256=57OnEGAa6jTiG12Lx_elREU02koYh8UkM0t0Vvxahys,2614
221
221
  verifiers/v1/configs/taskset.py,sha256=N5sFYjzjcmnUEiNiHH69vaOfl8fsVwmqXmWmPixqOOA,777
@@ -227,10 +227,10 @@ verifiers/v1/configs/cli/init.py,sha256=Vmuamb53F79UjGfS6lv-HBhndaM-YuVcjPCU0Jbv
227
227
  verifiers/v1/configs/cli/replay.py,sha256=xvMDZzIkvjgYl-a3ragjXI65DsD6FYl6gEFM5qpdIuA,2913
228
228
  verifiers/v1/configs/cli/validate.py,sha256=0LXGjqc9JxbCGTpMBX5OPsHCWxZw64uE1ky3ukQBULs,3654
229
229
  verifiers/v1/dialects/__init__.py,sha256=p72C7VYrFQzVgTcfmzpHGSwXlvThfc4pvjBxsqw7kHE,786
230
- verifiers/v1/dialects/anthropic.py,sha256=-eG00Rq8pygSwM2IoEy9iUgDb1ZdGQfP7tYb815nDJ8,27380
231
- verifiers/v1/dialects/base.py,sha256=VwMm8RHXr0dK4Y4-wWn853ft1K7UCo1CCAivWhqFh3s,13068
232
- verifiers/v1/dialects/chat.py,sha256=uBo7q7x4bMrQGS1BSlq--CqB7TerGqiTiwmpmAPHrdw,22923
233
- verifiers/v1/dialects/responses.py,sha256=QbEPt7hXMkrQMCBVsCLGTnZU9t7Xku0r_Kza6g3z5VE,30475
230
+ verifiers/v1/dialects/anthropic.py,sha256=lS3we2HbvS7QmbsQhlTnLdsEyDe3QtrUTUPzZ1geIqg,27441
231
+ verifiers/v1/dialects/base.py,sha256=GuIhyqUIparR3Y49diyMeKPZsy8ybKh9WR8yOKgXfuI,12888
232
+ verifiers/v1/dialects/chat.py,sha256=yLlpNwXfCSiDD_bWE7jnf7mIfopDem_yRPEGi3qD7xE,23256
233
+ verifiers/v1/dialects/responses.py,sha256=ayFjUJlbH2t0X1FCDoO9CWyHD_112oiaABgP82acEtA,30505
234
234
  verifiers/v1/envs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
235
235
  verifiers/v1/envs/agentic_judge/__init__.py,sha256=LfEcRHLG_siKzhzWmODDXWSLpLgfum3UFdQDK9XG0gk,325
236
236
  verifiers/v1/envs/agentic_judge/env.py,sha256=yVMdq0zBOX7vkEkhnhHTUDM-KKcoOIHUt7yEggOs4ng,14615
@@ -305,8 +305,8 @@ verifiers/v1/runtimes/limiters.py,sha256=C6cWDD4pwyFwUY4QFke3oiMXwydSNIfSbJSIglU
305
305
  verifiers/v1/runtimes/modal.py,sha256=Lgc0OkQEWHVBHCqBE2ja-mxtRYGserixlO4B9b5Vwn4,12661
306
306
  verifiers/v1/runtimes/prime.py,sha256=QnrSCmq9lA_u4o0k6igsum_okSTOZR1lSAHqeRhwldk,18931
307
307
  verifiers/v1/runtimes/subprocess.py,sha256=IO82fI1wFbeTtV7T1AHSF8iTUyT9yGJFIUmCKKw6CnQ,7763
308
- verifiers/v1/runtimes/docker/__init__.py,sha256=trEorxJxC5DMRgtMNu7kF_c88vITTETaRTgCcpNqDc0,20604
309
- verifiers/v1/runtimes/docker/egress.py,sha256=bZzLuK1_pjpkR-YMnzSBcKXnqqJKDUwjgCBHU0WXrTY,14511
308
+ verifiers/v1/runtimes/docker/__init__.py,sha256=K6xbJAT1F3-PtgP5Gum2UJKQ8Re1Yz90BP8Uc7Npec4,20594
309
+ verifiers/v1/runtimes/docker/egress.py,sha256=iFH_1XotlEM-OCaW7GNu3TWVEq1sqesKYweyVBX8g90,14360
310
310
  verifiers/v1/serve/__init__.py,sha256=doImCSxSYZEjVDXfRafLHkhHXcXQxzA6qUGMBQ8bSko,477
311
311
  verifiers/v1/serve/client.py,sha256=UWmLUkwhys241PCe5DymYs_YHxypN-u6GL4WF8A0OjQ,7583
312
312
  verifiers/v1/serve/encoding.py,sha256=5tKagKZKwBPN6VydLObCKDzLnijrvRwMjuyVQUq5BKA,2399
@@ -348,8 +348,8 @@ verifiers/v1/utils/prime.py,sha256=UTYRjp9cbjNb6CVmBHda-1wWZAIIfxNOmTyNuT7_wL4,9
348
348
  verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4,5417
349
349
  verifiers/v1/utils/score.py,sha256=-R5Cog14r_tJ6Q_oOfGr5VPAm2CCUhofYZB6B9lm4wM,5787
350
350
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
351
- verifiers-0.3.1.dev63.dist-info/METADATA,sha256=r0XAAWNHMBxSr7MeEqNQ7wqBuX52A9OtIHe5SWuZ6Ds,4653
352
- verifiers-0.3.1.dev63.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
353
- verifiers-0.3.1.dev63.dist-info/entry_points.txt,sha256=hZ5wDc1T8y-EvOziw7kQqatBJ6PbdSu2ygP5rjANl7c,564
354
- verifiers-0.3.1.dev63.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
355
- verifiers-0.3.1.dev63.dist-info/RECORD,,
351
+ verifiers-0.3.1.dev65.dist-info/METADATA,sha256=q3-MCXtoZPRuZs0faTBDonuUoE00-F1wtPF2GDjRAJA,4653
352
+ verifiers-0.3.1.dev65.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
353
+ verifiers-0.3.1.dev65.dist-info/entry_points.txt,sha256=hZ5wDc1T8y-EvOziw7kQqatBJ6PbdSu2ygP5rjANl7c,564
354
+ verifiers-0.3.1.dev65.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
355
+ verifiers-0.3.1.dev65.dist-info/RECORD,,