verifiers 0.3.2.dev134__py3-none-any.whl → 0.3.2.dev136__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.
@@ -69,7 +69,7 @@ class CompactionConfig(BaseConfig):
69
69
 
70
70
  class RLMHarnessConfig(HarnessConfig):
71
71
  version: str = Field(
72
- default="a42cc61ae3356bef82b301c01c6de1cdf302613e", min_length=1
72
+ default="b425f2d1e6bcf7587818b3eb1ea44e747bd24709", min_length=1
73
73
  )
74
74
  """Git ref (branch, tag, or commit) of nano-rlm to install. Must know every
75
75
  field this harness puts on the wire, i.e. be at least the default ref."""
@@ -3,13 +3,15 @@
3
3
  import argparse
4
4
  import asyncio
5
5
  import json
6
+ import logging
7
+ import random
6
8
  import subprocess
7
9
  from contextlib import AsyncExitStack
8
10
  from pathlib import Path
9
11
  from typing import TYPE_CHECKING
10
12
 
11
13
  import httpx
12
- from openai import APIStatusError, AsyncOpenAI, omit
14
+ from openai import APIConnectionError, APIStatusError, AsyncOpenAI, omit
13
15
  from openai.lib.streaming.chat import AsyncChatCompletionStream
14
16
 
15
17
  if TYPE_CHECKING:
@@ -245,9 +247,32 @@ async def chat(
245
247
  kwargs["tools"] = tools
246
248
  if tools and tool_choice is not None:
247
249
  kwargs["tool_choice"] = tool_choice
248
- raw_stream = await client.chat.completions.create(
249
- **kwargs, stream=True, stream_options={"include_usage": True}
250
- )
250
+ for attempt in range(client.max_retries + 1):
251
+ # Reuse the interception server's body-digest replay guard on stream retries.
252
+ headers = {"x-stainless-retry-count": str(attempt)} if attempt else omit
253
+ raw_stream = await client.chat.completions.create(
254
+ **kwargs,
255
+ stream=True,
256
+ stream_options={"include_usage": True},
257
+ extra_headers=headers,
258
+ )
259
+ # The SDK retries request setup; only stream consumption is retried here.
260
+ try:
261
+ return await _read_chat_completion(raw_stream)
262
+ except (APIConnectionError, httpx.TransportError) as error:
263
+ cause = error.__cause__ or error
264
+ if attempt == client.max_retries:
265
+ raise
266
+ logging.getLogger(__name__).warning(
267
+ "Retrying interrupted model stream (%s/%s): %r",
268
+ attempt + 1,
269
+ client.max_retries,
270
+ cause,
271
+ )
272
+ await asyncio.sleep(min(0.5 * 2**attempt, 8.0) * random.uniform(0.75, 1.0))
273
+
274
+
275
+ async def _read_chat_completion(raw_stream):
251
276
  # Accumulate native deltas without auto-parsing tool arguments or treating
252
277
  # finish_reason="length" as an exception: compaction owns that decision.
253
278
  async with AsyncChatCompletionStream(
@@ -271,7 +296,10 @@ async def chat(
271
296
  or not completion.choices
272
297
  or any(choice.finish_reason is None for choice in completion.choices)
273
298
  ):
274
- raise RuntimeError("model stream ended before a completion finished")
299
+ raise APIConnectionError(
300
+ message="Model stream ended before a completion finished",
301
+ request=raw_stream.response.request,
302
+ )
275
303
  for choice in completion.choices:
276
304
  overrides = message_overrides.setdefault(choice.index, {})
277
305
  overrides.setdefault("role", "assistant")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.3.2.dev134
3
+ Version: 0.3.2.dev136
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
@@ -112,13 +112,13 @@ verifiers/v1/harnesses/pi/harness.py,sha256=ysKOLSRQnbPkMtwvuUoJU7Hd4uM4bDF1duD0
112
112
  verifiers/v1/harnesses/prime_agent/__init__.py,sha256=xfPC4RrlnyYWaf38tPAOZq4YL6M55lMpj5BoRLmaK8I,171
113
113
  verifiers/v1/harnesses/prime_agent/harness.py,sha256=Zs_f5H2hQgDzUS4zwArM5UxCYJI5Zo0ELmayn1oBkK0,10663
114
114
  verifiers/v1/harnesses/rlm/__init__.py,sha256=hwx51xTdEWzzYgMj-p4ETNcptoub3IPMDbEdJ4uB8Ns,122
115
- verifiers/v1/harnesses/rlm/harness.py,sha256=wYckWon5k4oUURZq4FxlwJxOoULd1WdE4824ty6j6LQ,13538
115
+ verifiers/v1/harnesses/rlm/harness.py,sha256=440SpRTtglvxGqi5fzikdSGtUb1okwEROxB6N64T5pQ,13538
116
116
  verifiers/v1/harnesses/terminus_2/__init__.py,sha256=l1pwfg1HyVDEqT9efdnFWcXqaZwtKwe7TrplkyxZSA0,166
117
117
  verifiers/v1/harnesses/terminus_2/harness.py,sha256=cKQJluW01mkxEccTLFwSWsVMavyiwq_w-NA4Hb_JkGU,3052
118
118
  verifiers/v1/harnesses/terminus_2/program.py,sha256=X8MZdyItU3gbXGXnGOlJ9LWcUTnqIDaxlhkZvoRiqKY,2703
119
119
  verifiers/v1/harnesses/utils/__init__.py,sha256=eTS-Ft2HwoLiYn5u1t_KueLmaZB_W12cdYmcVsE-G5A,364
120
120
  verifiers/v1/harnesses/utils/compaction.py,sha256=DeY6CYLEsv7-vJm26sT2mRaPHu3W2ywiZhvFr_pi6Hg,10495
121
- verifiers/v1/harnesses/utils/core.py,sha256=emAeNqtha__3cR0u7pvoQGnl2sE57wadE0wlKGtO1Yk,18520
121
+ verifiers/v1/harnesses/utils/core.py,sha256=Kqp0npmiJlGtT5vt7r2sX70R29W9d_ODR7gN-ufKrug,19642
122
122
  verifiers/v1/harnesses/utils/install.py,sha256=BDkkUVZ1brSzCrbQOvMO5mVIE2DsV2pE7rTC5yROYUw,2992
123
123
  verifiers/v1/harnesses/utils/launch.py,sha256=RqPuUY-kT2XVuLSGtXW7kRQEaP-o2KzkiJ7vcoo2neM,2883
124
124
  verifiers/v1/harnesses/utils/mcp.py,sha256=oNhKfLjAW-wScJcDIsW_HfuvKY-JkaGBBZrRLqgRK1g,7355
@@ -190,8 +190,8 @@ verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4
190
190
  verifiers/v1/utils/scope.py,sha256=bzUEiWDOVdbj7dXOwGOlzsQ_-Xu0j9NR5TalQB-8TS8,838
191
191
  verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
192
192
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
193
- verifiers-0.3.2.dev134.dist-info/METADATA,sha256=CEOjkwaS7mTLz0q7Z8Bw-4TsRp-2HwXgtegTv3ps5Os,4161
194
- verifiers-0.3.2.dev134.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
195
- verifiers-0.3.2.dev134.dist-info/entry_points.txt,sha256=iugElcdWPKbQM7uFF0lZ8iUpHsNr17-BwEAAjJWxV3U,259
196
- verifiers-0.3.2.dev134.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
197
- verifiers-0.3.2.dev134.dist-info/RECORD,,
193
+ verifiers-0.3.2.dev136.dist-info/METADATA,sha256=Dody0KdHsobWBNx2Mc1KbvuGAH152EZaPxEonMGcoJ4,4161
194
+ verifiers-0.3.2.dev136.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
195
+ verifiers-0.3.2.dev136.dist-info/entry_points.txt,sha256=iugElcdWPKbQM7uFF0lZ8iUpHsNr17-BwEAAjJWxV3U,259
196
+ verifiers-0.3.2.dev136.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
197
+ verifiers-0.3.2.dev136.dist-info/RECORD,,