verifiers 0.3.2.dev8__py3-none-any.whl → 0.3.2.dev10__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.
@@ -10,8 +10,7 @@ from dataclasses import dataclass, field
10
10
  from typing import Any, ClassVar, TypeVar
11
11
 
12
12
  from openai import OpenAIError
13
- from renderers import OverlongPromptError as RendererOverlongPromptError
14
- from renderers import RenderedTokens, Renderer, RendererConfig
13
+ from renderers import OverlongPromptError, RenderedTokens, Renderer, RendererConfig
15
14
  from renderers.base import ToolCallParseStatus, is_multimodal
16
15
 
17
16
  from verifiers.v1.clients.base import build_async_openai
@@ -19,7 +18,7 @@ from verifiers.v1.clients.client import SESSION_ID_HEADER, Client
19
18
  from verifiers.v1.configs.client import TrainClientConfig
20
19
  from verifiers.v1.dialects import FINISH_REASONS, ChatDialect, Dialect, parse_tools
21
20
  from verifiers.v1.dialects.chat import message_to_wire
22
- from verifiers.v1.errors import OverlongPromptError, model_error
21
+ from verifiers.v1.errors import ProviderError, model_error
23
22
  from verifiers.v1.graph import PendingTurn
24
23
  from verifiers.v1.types import (
25
24
  AssistantMessage,
@@ -436,8 +435,10 @@ class TrainClient(Client):
436
435
  if session_id
437
436
  else None,
438
437
  )
439
- except RendererOverlongPromptError as e:
440
- raise OverlongPromptError(str(e)) from e
438
+ except OverlongPromptError as e:
439
+ # The renderer's pre-flight overflow never reached the provider: a
440
+ # deterministic 400, so the harness SDK never retries it.
441
+ raise ProviderError(str(e), status_code=400) from e
441
442
  except OpenAIError as e:
442
443
  raise model_error(e) from e
443
444
  response = response_from_generate(
@@ -28,7 +28,7 @@ from verifiers.v1.dialects.base import (
28
28
  parse_sse_event,
29
29
  provider_allowed_domains,
30
30
  )
31
- from verifiers.v1.errors import OverlongPromptError, model_error
31
+ from verifiers.v1.errors import model_error
32
32
  from verifiers.v1.types import (
33
33
  AssistantMessage,
34
34
  ContentPart,
@@ -322,15 +322,11 @@ def response_from_wire(response: OpenAIResponse) -> Response:
322
322
  code = error.get("code") if isinstance(error, dict) else None
323
323
  message = error.get("message") if isinstance(error, dict) else None
324
324
  detail = ": ".join(str(value) for value in (status, code, message) if value)
325
- if code == "context_length_exceeded":
326
- raise OverlongPromptError(
327
- f"upstream Responses request did not complete: {detail}"
328
- )
329
325
  status_code = (
330
326
  429
331
327
  if code in ("rate_limit_exceeded", "rate_limit_error")
332
328
  else 400
333
- if code == "invalid_prompt"
329
+ if code in ("invalid_prompt", "context_length_exceeded")
334
330
  else 502
335
331
  )
336
332
  raise model_error(
verifiers/v1/errors.py CHANGED
@@ -42,16 +42,6 @@ class ProviderError(RolloutError):
42
42
  self.status_code = status_code
43
43
 
44
44
 
45
- class OverlongPromptError(ProviderError):
46
- """The prompt exceeded the model's context window — a budget limit, ended as a clean
47
- truncation rather than recorded as an error. Defaults to a 400 (what the interception
48
- server surfaces for it — deterministic, so an SDK never retries it); `model_error`
49
- keeps the provider's real status when the failure carried one."""
50
-
51
- def __init__(self, message: str = "", *, status_code: int = 400) -> None:
52
- super().__init__(message, status_code=status_code)
53
-
54
-
55
45
  class HarnessError(RolloutError):
56
46
  """The harness failed to install or launch, or its agent process exited unsuccessfully."""
57
47
 
@@ -99,20 +89,6 @@ async def boundary(error_cls: type[RolloutError], what: str) -> AsyncIterator[No
99
89
  raise error_cls(f"{what}: {type(e).__name__}: {e}") from e
100
90
 
101
91
 
102
- _CONTEXT_LENGTH_PHRASES = (
103
- "this model's maximum context length is",
104
- "is longer than the model's context length",
105
- "is longer than the maximum model length",
106
- "exceeds the model's context length",
107
- "exceed the configured limit",
108
- "exceeds the configured limit",
109
- "exceeded model",
110
- "prompt_too_long",
111
- "context length",
112
- "maximum model length",
113
- )
114
-
115
-
116
92
  def _provider_status(e: OpenAIError | str) -> int:
117
93
  """The HTTP status to surface for an SDK error: the provider's own for an HTTP status error, a
118
94
  retryable 5xx for a transport/timeout fault, else 502."""
@@ -130,23 +106,12 @@ def _provider_status(e: OpenAIError | str) -> int:
130
106
  def model_error(
131
107
  e: OpenAIError | str, *, status_code: int | None = None
132
108
  ) -> ProviderError:
133
- """Map a provider failure to our error type: an overlong prompt (a budget limit the interception
134
- server turns into a clean truncation) is told apart from any other provider call failure, which
135
- becomes a plain `ProviderError`. `status_code` is the HTTP status surfaced to the harness (whose
136
- SDK then retries 5xx/429/timeout and not 4xx); derived from an SDK error when not given. Accepts
137
- an SDK error (the renderer) or the provider's raw error body (the httpx proxy)."""
138
- from openai import APIStatusError
139
-
109
+ """Map a provider failure to a `ProviderError`. `status_code` is the HTTP status surfaced to
110
+ the harness (whose SDK then retries 5xx/429/timeout and not 4xx); derived from an SDK error
111
+ when not given. Accepts an SDK error (the renderer) or the provider's raw error body (the
112
+ httpx proxy)."""
140
113
  # Some SDK errors stringify empty; fall back to the type so the message is never blank.
141
114
  text = str(e) or (type(e).__name__ if isinstance(e, BaseException) else "")
142
- if any(phrase in text.casefold() for phrase in _CONTEXT_LENGTH_PHRASES):
143
- # Keep the provider's real status when the failure carried one; else the class
144
- # default (the 400 the interception server surfaces for overlong prompts).
145
- if status_code is None and isinstance(e, APIStatusError):
146
- status_code = e.status_code
147
- return OverlongPromptError(
148
- text, **({} if status_code is None else {"status_code": status_code})
149
- )
150
115
  return ProviderError(
151
116
  text,
152
117
  status_code=status_code if status_code is not None else _provider_status(e),
@@ -69,6 +69,7 @@ async def main() -> None:
69
69
  api_base=args.base_url,
70
70
  llm_kwargs={"custom_llm_provider": "openai", "api_key": args.api_key},
71
71
  record_terminal_session=False,
72
+ interleaved_thinking=True,
72
73
  )
73
74
  if system_prompt:
74
75
  call = agent._llm.call
@@ -46,7 +46,6 @@ from verifiers.v1.dialects.base import (
46
46
  is_sse_done_event,
47
47
  )
48
48
  from verifiers.v1.errors import (
49
- OverlongPromptError,
50
49
  ProviderError,
51
50
  RolloutError,
52
51
  TaskError,
@@ -714,17 +713,6 @@ class InterceptionServer(Interception):
714
713
  dialect.error_body(f"rollout stopped: {stopped}"),
715
714
  status=400,
716
715
  )
717
- except OverlongPromptError as e:
718
- # An overlong prompt is a budget limit, not a crash: end the rollout
719
- # cleanly as a truncation — refuse the call to halt the harness (same
720
- # shape as `refused` above).
721
- error = e
722
- session.trace.stop("context_length")
723
- logger.debug("prompt too long: id=%s", session.trace.id)
724
- return web.json_response(
725
- dialect.error_body("rollout stopped: context_length"),
726
- status=400,
727
- )
728
716
  except RolloutError as e:
729
717
  # Stash the real cause; the rollout re-raises it after the harness returns.
730
718
  # Relay the provider's status so the harness SDK retries 5xx/429 and not 4xx.
@@ -803,13 +791,6 @@ class InterceptionServer(Interception):
803
791
  headers=request.headers,
804
792
  session_id=session.trace.id,
805
793
  )
806
- except OverlongPromptError as e:
807
- error = e
808
- session.trace.stop("context_length")
809
- logger.debug("prompt too long: id=%s", session.trace.id)
810
- return web.json_response(
811
- dialect.error_body("rollout stopped: context_length"), status=400
812
- )
813
794
  except RolloutError as e:
814
795
  error = e
815
796
  session.error = e
@@ -1008,13 +989,6 @@ class InterceptionServer(Interception):
1008
989
  await resp.write(event)
1009
990
  await resp.write_eof()
1010
991
  return resp
1011
- except OverlongPromptError as e:
1012
- # A streamed terminal provider failure is discovered only after its response body
1013
- # was relayed. Context exhaustion remains a clean truncation like earlier failures.
1014
- error = e
1015
- session.trace.stop("context_length")
1016
- logger.debug("prompt too long: id=%s", session.trace.id)
1017
- return resp
1018
992
  except RolloutError as e:
1019
993
  # A streamed terminal provider failure is discovered only after the
1020
994
  # response body has been relayed. Keep it off the graph and preserve
verifiers/v1/trace.py CHANGED
@@ -522,7 +522,6 @@ class Trace(BaseModel, Generic[DataT, StateT, AgentConfigT]):
522
522
  "max_input_tokens",
523
523
  "max_output_tokens",
524
524
  "max_total_tokens",
525
- "context_length",
526
525
  ):
527
526
  return True
528
527
  last = next((c for c in reversed(self.calls) if c.error is None), None)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.3.2.dev8
3
+ Version: 0.3.2.dev10
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
@@ -172,7 +172,7 @@ verifiers/v1/__init__.py,sha256=AnXz2IG12salvxlOZvxFpG_3v9cvRc7B2DYuH_ORiD4,8090
172
172
  verifiers/v1/agent.py,sha256=AfjyYmcGpVaOlZkElIz1JZeNRQuZsE_KMZ-LV3uLvzA,31644
173
173
  verifiers/v1/env.py,sha256=CEhzjojhg5jqbOYruUnc5U7TtgDHDSx8NiiFA0qfbt8,18234
174
174
  verifiers/v1/episode.py,sha256=uStvI4WqgJT50hmHIB55m5B-ASqqLz-fZ-ynBz9uzEY,5474
175
- verifiers/v1/errors.py,sha256=kQeEPX06TwAIuiz7MlWFYirrpKbx5STi6A5b_dtQQoA,6885
175
+ verifiers/v1/errors.py,sha256=uQySmCUrjDYFkBIii1vBFPiEcPFPQZ9EGpas_6HvcQI,5279
176
176
  verifiers/v1/graph.py,sha256=vjxIrE0e-IXeb8fIY0pRGfwrQlGsIAe9IjwHNZXqizk,30652
177
177
  verifiers/v1/harness.py,sha256=ziECqEBWV34UWbLlxrkhY6MwkbVYkoXBOoaY7mZxwTs,14753
178
178
  verifiers/v1/judge.py,sha256=Pvr0C41ah1qkNSZ0WXdkDvBMfv5YSfY1REHncwlJ8cg,9346
@@ -181,7 +181,7 @@ verifiers/v1/session.py,sha256=GmwZoE-L4jzsUy7Fj9OUHu0yMLBe9lgSFKCbhLoZdjk,18706
181
181
  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
- verifiers/v1/trace.py,sha256=XbV5KTSZSvkv0u544ei0bmPFRg6hcBNXUehEXJZ76d8,25125
184
+ verifiers/v1/trace.py,sha256=gA0vYHsssYpoc2Kc5WXc-xRIR7xpY0njrNkTddmYMvQ,25095
185
185
  verifiers/v1/types.py,sha256=a1wqL8T7KQg9WxkaDIZpmOyU6xT2VeSr1K4SWiW8ef4,9660
186
186
  verifiers/v1/acp/__init__.py,sha256=t91yf1NmVvYiUbHCV-ApxcqFFT89JRNYpruu04k6Wco,11205
187
187
  verifiers/v1/acp/runner.py,sha256=6Y7yTWP560IWrRijlnsB_t3lR79oRilrRoISXX4lXjc,10781
@@ -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=OqxDP2PhSINc_8CUrZRJtUfsTqXKqTBBUl029YGeBDk,18597
210
+ verifiers/v1/clients/train.py,sha256=hRuwIyxunNRwDKItPvpgPzap2NVew7hoAzUsaz8fiZw,18699
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
@@ -230,7 +230,7 @@ verifiers/v1/dialects/__init__.py,sha256=MNOYM2NdTlSxGK4VtoEjMtD5zya2MpjPDX5jMvZ
230
230
  verifiers/v1/dialects/anthropic.py,sha256=abwcKRsKkgfgLSuntxBMdL03enG7roRdGoHTYfswafM,26887
231
231
  verifiers/v1/dialects/base.py,sha256=pcFqWXSl50VtMuzcY5cyhsc4WpKCM5wT-tskTFZV7CM,12203
232
232
  verifiers/v1/dialects/chat.py,sha256=_pMsNpbffiXiK0_0tboAKtuj7-smUnkS9H0LPK4j1mU,23662
233
- verifiers/v1/dialects/responses.py,sha256=PYHWuJSz84i5teHWn0uGany1--P04kw3ryKfFGJ4y84,29254
233
+ verifiers/v1/dialects/responses.py,sha256=KRuS9TKw2uoNz4NsG7E-H6eyhm_EJQwVtZ5_XW9iB3c,29090
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
@@ -282,11 +282,11 @@ verifiers/v1/harnesses/rlm/__init__.py,sha256=hwx51xTdEWzzYgMj-p4ETNcptoub3IPMDb
282
282
  verifiers/v1/harnesses/rlm/harness.py,sha256=rQDME1GaYcApf7Giqt2ZyBQCBhuXvwLR-X-ofAbfWPo,6860
283
283
  verifiers/v1/harnesses/terminus_2/__init__.py,sha256=l1pwfg1HyVDEqT9efdnFWcXqaZwtKwe7TrplkyxZSA0,166
284
284
  verifiers/v1/harnesses/terminus_2/harness.py,sha256=kXKhi-aqqsoXGnvet0Tq_v7LYYpRYEzARyQL2MTEGWs,3101
285
- verifiers/v1/harnesses/terminus_2/program.py,sha256=XWflwULPfVUyrwAldXLRVOoUWoWW9bYNsaygWef0Sfg,2668
285
+ verifiers/v1/harnesses/terminus_2/program.py,sha256=X8MZdyItU3gbXGXnGOlJ9LWcUTnqIDaxlhkZvoRiqKY,2703
286
286
  verifiers/v1/interception/__init__.py,sha256=5Kvo7tcBUVaa65s9A1NiOH3CPpzw-P5btXwxB4Nbbvs,4251
287
287
  verifiers/v1/interception/base.py,sha256=Mg16Y104lyZilF9shdivdqYoqz4OYp978i_myyrulu8,2529
288
288
  verifiers/v1/interception/pool.py,sha256=sk_zcdTV8EVRuzqlYMXxon_42tSDAlFvwcyOO2EF7hw,6473
289
- verifiers/v1/interception/server.py,sha256=Q1eS2uwjHMAlqwy78V15CMocq7Zglt3o5_bqiSodAA0,50709
289
+ verifiers/v1/interception/server.py,sha256=cyg4ndvny4Y0iZL2OsoIE9oWdgoQsG0jdfmoH2dGCaE,49320
290
290
  verifiers/v1/interception/tool.py,sha256=ZyZPxLYM_HsGkz-ZbCREQVGtiKZK9lQLChBNF_bBuuc,259
291
291
  verifiers/v1/interception/tunnel/__init__.py,sha256=eVNZJszj6myrKhx9jmJz7VRd9qlfj0AUvUZwI2bXEj8,893
292
292
  verifiers/v1/interception/tunnel/base.py,sha256=DZB6uPLwM4Qy7n7m0vKeyg-Px87MhsmpYTpe2vpPEng,1998
@@ -350,8 +350,8 @@ verifiers/v1/utils/prime.py,sha256=UTYRjp9cbjNb6CVmBHda-1wWZAIIfxNOmTyNuT7_wL4,9
350
350
  verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4,5417
351
351
  verifiers/v1/utils/score.py,sha256=-R5Cog14r_tJ6Q_oOfGr5VPAm2CCUhofYZB6B9lm4wM,5787
352
352
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
353
- verifiers-0.3.2.dev8.dist-info/METADATA,sha256=vBN-kNq8u-vBtNaJwrK7GP1dpGv0ypLm42UyM2mqoN4,4653
354
- verifiers-0.3.2.dev8.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
355
- verifiers-0.3.2.dev8.dist-info/entry_points.txt,sha256=hZ5wDc1T8y-EvOziw7kQqatBJ6PbdSu2ygP5rjANl7c,564
356
- verifiers-0.3.2.dev8.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
357
- verifiers-0.3.2.dev8.dist-info/RECORD,,
353
+ verifiers-0.3.2.dev10.dist-info/METADATA,sha256=Mhc39-E04cc6qJlVEUz76HgmfS7xnt6MooZqbXQeYMc,4654
354
+ verifiers-0.3.2.dev10.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
355
+ verifiers-0.3.2.dev10.dist-info/entry_points.txt,sha256=hZ5wDc1T8y-EvOziw7kQqatBJ6PbdSu2ygP5rjANl7c,564
356
+ verifiers-0.3.2.dev10.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
357
+ verifiers-0.3.2.dev10.dist-info/RECORD,,