verifiers 0.3.2.dev10__py3-none-any.whl → 0.3.2.dev11__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.
- verifiers/v1/harnesses/null/program.py +40 -2
- verifiers/v1/rollout.py +3 -3
- verifiers/v1/session.py +4 -4
- {verifiers-0.3.2.dev10.dist-info → verifiers-0.3.2.dev11.dist-info}/METADATA +1 -1
- {verifiers-0.3.2.dev10.dist-info → verifiers-0.3.2.dev11.dist-info}/RECORD +8 -8
- {verifiers-0.3.2.dev10.dist-info → verifiers-0.3.2.dev11.dist-info}/WHEEL +0 -0
- {verifiers-0.3.2.dev10.dist-info → verifiers-0.3.2.dev11.dist-info}/entry_points.txt +0 -0
- {verifiers-0.3.2.dev10.dist-info → verifiers-0.3.2.dev11.dist-info}/licenses/LICENSE +0 -0
|
@@ -11,12 +11,43 @@ from contextlib import AsyncExitStack, asynccontextmanager, suppress
|
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
|
|
13
13
|
import httpx
|
|
14
|
-
from openai import AsyncOpenAI
|
|
14
|
+
from openai import APIStatusError, AsyncOpenAI
|
|
15
15
|
from tenacity import AsyncRetrying, stop_after_attempt, wait_exponential_jitter
|
|
16
16
|
|
|
17
17
|
MCP_CALL_ATTEMPTS = 6
|
|
18
18
|
MCP_TIMEOUT = 600.0
|
|
19
19
|
|
|
20
|
+
CONTEXT_OVERFLOW_MARKERS = (
|
|
21
|
+
# OpenAI error code "context_length_exceeded"; OpenRouter relays the raw body.
|
|
22
|
+
"context_length_exceeded",
|
|
23
|
+
# OpenAI Responses/Completions: "Your input exceeds the context window of this model".
|
|
24
|
+
"exceeds the context window",
|
|
25
|
+
# OpenAI chat: "Input tokens exceed the configured limit of N tokens. Please reduce
|
|
26
|
+
# the length of the messages."; Groq words it the same way.
|
|
27
|
+
"reduce the length of the messages",
|
|
28
|
+
# vLLM: "This model's maximum context length is N tokens"; the renderers pre-flight:
|
|
29
|
+
# "Prompt length (N) exceeds maximum context length (M)"; Mistral uses the same words.
|
|
30
|
+
"maximum context length",
|
|
31
|
+
# Anthropic: "prompt is too long: N tokens > M maximum".
|
|
32
|
+
"prompt is too long",
|
|
33
|
+
# Anthropic byte-size overflow: HTTP 413 {"type": "request_too_large"}.
|
|
34
|
+
"request_too_large",
|
|
35
|
+
# HTTP proxies reject an oversized body with 413 "Request Entity Too Large".
|
|
36
|
+
"request entity too large",
|
|
37
|
+
# Google: "The input token count (N) exceeds the maximum number of tokens allowed (M)".
|
|
38
|
+
"exceeds the maximum number of tokens",
|
|
39
|
+
# xAI: "This model's maximum prompt length is N but the request contains M tokens".
|
|
40
|
+
"maximum prompt length is",
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def is_context_overflow(error: APIStatusError) -> bool:
|
|
45
|
+
details = f"{error} {error.body or ''}".casefold()
|
|
46
|
+
# An overflow is deterministic: a 400, or a 413 for a byte-size cap.
|
|
47
|
+
return error.status_code in (400, 413) and any(
|
|
48
|
+
marker in details for marker in CONTEXT_OVERFLOW_MARKERS
|
|
49
|
+
)
|
|
50
|
+
|
|
20
51
|
|
|
21
52
|
async def chat(
|
|
22
53
|
client: AsyncOpenAI, model: str, messages: list[dict], tools: list[dict]
|
|
@@ -181,7 +212,14 @@ async def main() -> None:
|
|
|
181
212
|
elif args.prompt:
|
|
182
213
|
messages.append({"role": "user", "content": args.prompt})
|
|
183
214
|
while True:
|
|
184
|
-
|
|
215
|
+
try:
|
|
216
|
+
message = await chat(client, args.model, messages, tools)
|
|
217
|
+
except APIStatusError as error:
|
|
218
|
+
# Context exhaustion is a budget limit, not a crash: this harness has no
|
|
219
|
+
# compaction, so end the run cleanly with what the conversation holds.
|
|
220
|
+
if not is_context_overflow(error):
|
|
221
|
+
raise
|
|
222
|
+
return
|
|
185
223
|
messages.append(message.model_dump(exclude_none=True))
|
|
186
224
|
if not message.tool_calls:
|
|
187
225
|
break
|
verifiers/v1/rollout.py
CHANGED
|
@@ -409,9 +409,9 @@ class Rollout:
|
|
|
409
409
|
0.0, self._agent_time_remaining - (loop.time() - segment_start)
|
|
410
410
|
)
|
|
411
411
|
self.deadline_at = None
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
412
|
+
# A harness that completes cleanly after a failed model call handled it (e.g. it
|
|
413
|
+
# ends its run on context overflow); the failure stays recorded on the call. A
|
|
414
|
+
# harness that dies on it surfaces the stashed error through the except above.
|
|
415
415
|
# A segment that committed nothing can't be waiting on the user; treating
|
|
416
416
|
# it as continuable would consult the user against a conversation that
|
|
417
417
|
# never moved, forever.
|
verifiers/v1/session.py
CHANGED
|
@@ -131,10 +131,10 @@ class RolloutSession:
|
|
|
131
131
|
`register` (one server-owned client per distinct endpoint config), so every rollout it
|
|
132
132
|
multiplexes shares one keepalive connection pool instead of opening its own."""
|
|
133
133
|
error: "RolloutError | None" = None
|
|
134
|
-
"""The latest unresolved model-call failure. The harness only sees it as an HTTP error
|
|
135
|
-
|
|
136
|
-
harness
|
|
137
|
-
|
|
134
|
+
"""The latest unresolved model-call failure. The harness only sees it as an HTTP error, so
|
|
135
|
+
when its program dies on it the rollout records this original error instead of a secondary
|
|
136
|
+
`HarnessError`. A harness that completes cleanly after the failure handled it. Reset before
|
|
137
|
+
each model turn, so a successful retry clears it."""
|
|
138
138
|
idempotent_requests: dict[str, IdempotentRequest] = field(default_factory=dict)
|
|
139
139
|
"""Explicit keys or marked SDK retries mapped to their replay state."""
|
|
140
140
|
released: bool = False
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: verifiers
|
|
3
|
-
Version: 0.3.2.
|
|
3
|
+
Version: 0.3.2.dev11
|
|
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
|
|
@@ -176,8 +176,8 @@ 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
|
|
179
|
-
verifiers/v1/rollout.py,sha256=
|
|
180
|
-
verifiers/v1/session.py,sha256=
|
|
179
|
+
verifiers/v1/rollout.py,sha256=TXSxeN5rY3fdQyID1dsQnqzHIx6ldCP1uMKBm3UF-go,23593
|
|
180
|
+
verifiers/v1/session.py,sha256=xM7JJJVJACk0JfH9RAN1Ts8gJJKr2tGGRiIgQTrdieY,18692
|
|
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
|
|
@@ -269,7 +269,7 @@ verifiers/v1/harnesses/mini_swe_agent/harness.py,sha256=7HHismhmfCtahlLtQdQyp_fT
|
|
|
269
269
|
verifiers/v1/harnesses/mini_swe_agent/program.py,sha256=Beej-JLIgSqnqIqB746oKU6kJYcynvppIbmwGa3nJJ0,167
|
|
270
270
|
verifiers/v1/harnesses/null/__init__.py,sha256=XDeKOPeoXUQi9US9_Z3_yH9YaZ4EiOMKJmUtNNdtD7s,127
|
|
271
271
|
verifiers/v1/harnesses/null/harness.py,sha256=3_BSQKFHTl9k54Aq1pcBEuE1n3hRF2xpP2100H5KGv4,2596
|
|
272
|
-
verifiers/v1/harnesses/null/program.py,sha256=
|
|
272
|
+
verifiers/v1/harnesses/null/program.py,sha256=fHus8KgqFMRNOUE6y09QiRHS8lsFNzcupiUienlG52Q,10314
|
|
273
273
|
verifiers/v1/harnesses/openclaw/__init__.py,sha256=kNyfPB1sGwEf4K3mTfKN0VEyxun3SGvNpvArVKvH-x8,160
|
|
274
274
|
verifiers/v1/harnesses/openclaw/harness.py,sha256=LcdfnP_wYvWUQWIt6d4sE0TnXaxt5Ne5r_f7R0lKkAc,9535
|
|
275
275
|
verifiers/v1/harnesses/pi/__init__.py,sha256=1mSnzOf-RdEchdeg6IHtcdobG5KIpAhuTdUIgsCIn74,117
|
|
@@ -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.
|
|
354
|
-
verifiers-0.3.2.
|
|
355
|
-
verifiers-0.3.2.
|
|
356
|
-
verifiers-0.3.2.
|
|
357
|
-
verifiers-0.3.2.
|
|
353
|
+
verifiers-0.3.2.dev11.dist-info/METADATA,sha256=BSCpbwXHUZjtrcK0mj4S7seLMEKf25leiGd2g1b3MvI,4654
|
|
354
|
+
verifiers-0.3.2.dev11.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
355
|
+
verifiers-0.3.2.dev11.dist-info/entry_points.txt,sha256=hZ5wDc1T8y-EvOziw7kQqatBJ6PbdSu2ygP5rjANl7c,564
|
|
356
|
+
verifiers-0.3.2.dev11.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
|
|
357
|
+
verifiers-0.3.2.dev11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|