verifiers 0.3.2.dev57__py3-none-any.whl → 0.3.2.dev59__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/dialects/chat.py +7 -0
- verifiers/v1/dialects/responses.py +4 -1
- verifiers/v1/interception/server.py +6 -4
- verifiers/v1/session.py +17 -15
- {verifiers-0.3.2.dev57.dist-info → verifiers-0.3.2.dev59.dist-info}/METADATA +1 -1
- {verifiers-0.3.2.dev57.dist-info → verifiers-0.3.2.dev59.dist-info}/RECORD +9 -9
- {verifiers-0.3.2.dev57.dist-info → verifiers-0.3.2.dev59.dist-info}/WHEEL +0 -0
- {verifiers-0.3.2.dev57.dist-info → verifiers-0.3.2.dev59.dist-info}/entry_points.txt +0 -0
- {verifiers-0.3.2.dev57.dist-info → verifiers-0.3.2.dev59.dist-info}/licenses/LICENSE +0 -0
verifiers/v1/dialects/chat.py
CHANGED
|
@@ -15,6 +15,7 @@ from typing import Any
|
|
|
15
15
|
from urllib.parse import urlsplit
|
|
16
16
|
|
|
17
17
|
from openai.types.chat import ChatCompletion
|
|
18
|
+
from openai.types.chat.chat_completion import Choice
|
|
18
19
|
|
|
19
20
|
from verifiers.v1.configs.runtime import NetworkPolicyConfig
|
|
20
21
|
from verifiers.v1.dialects.base import (
|
|
@@ -44,12 +45,18 @@ from verifiers.v1.types import (
|
|
|
44
45
|
)
|
|
45
46
|
|
|
46
47
|
|
|
48
|
+
class ModdedChoice(Choice):
|
|
49
|
+
# Logprobs are relayed in Response.raw; trace conversion never reads them.
|
|
50
|
+
logprobs: Any = None
|
|
51
|
+
|
|
52
|
+
|
|
47
53
|
class ModdedChatCompletion(ChatCompletion):
|
|
48
54
|
"""The OpenAI SDK closes `service_tier` to a fixed `Literal`, but providers return tiers
|
|
49
55
|
outside it (e.g. Prime's `provisioned`), which makes `model_validate` reject an otherwise
|
|
50
56
|
valid completion. Widen the field to a plain string — we don't consume it — so parsing stays
|
|
51
57
|
lenient about the label instead of dropping it."""
|
|
52
58
|
|
|
59
|
+
choices: list[ModdedChoice]
|
|
53
60
|
service_tier: str | None = None
|
|
54
61
|
|
|
55
62
|
|
|
@@ -315,7 +315,10 @@ def fold_assistant(items: list[dict] | None) -> AssistantMessage:
|
|
|
315
315
|
def response_from_wire(response: OpenAIResponse) -> Response:
|
|
316
316
|
"""An OpenAI Responses object -> a vf `Response` (its `output` items folded into one
|
|
317
317
|
assistant message)."""
|
|
318
|
-
|
|
318
|
+
# Copy the output snapshot without traversing echoed tools or request settings.
|
|
319
|
+
data = response.model_dump(
|
|
320
|
+
include={"id", "created_at", "model", "status", "error", "output"}
|
|
321
|
+
)
|
|
319
322
|
status = data.get("status")
|
|
320
323
|
if status not in (None, "completed", "incomplete"):
|
|
321
324
|
error = data.get("error") or {}
|
|
@@ -490,13 +490,13 @@ class InterceptionServer(Interception):
|
|
|
490
490
|
body = from_json(raw)
|
|
491
491
|
except ValueError:
|
|
492
492
|
body = json.loads(raw)
|
|
493
|
-
|
|
493
|
+
body = dialect.apply_overrides(body, session.ctx.model, session.ctx.sampling)
|
|
494
|
+
streaming = dialect.streaming(body)
|
|
495
|
+
req_hash = await _request_digest(raw) if not streaming else b""
|
|
494
496
|
# Keep `read()` for aiohttp's size guard, then release its cache and our local
|
|
495
497
|
# alias after parsing so the wire body does not survive model inference.
|
|
496
498
|
request._read_bytes = None
|
|
497
499
|
del raw
|
|
498
|
-
body = dialect.apply_overrides(body, session.ctx.model, session.ctx.sampling)
|
|
499
|
-
streaming = dialect.streaming(body)
|
|
500
500
|
try:
|
|
501
501
|
acp, upstream_headers = extract_acp_info(request.headers)
|
|
502
502
|
except ValueError as error:
|
|
@@ -638,7 +638,9 @@ class InterceptionServer(Interception):
|
|
|
638
638
|
|
|
639
639
|
try:
|
|
640
640
|
body, policy_paths = self.mediate_capabilities(session, dialect, body)
|
|
641
|
-
|
|
641
|
+
# Restricted mediation can mutate the body without reporting policy paths.
|
|
642
|
+
if request_rewrites or session.network_policy.network_restricted:
|
|
643
|
+
model_request = dialect.parse_request(body)
|
|
642
644
|
turn = graph.prepare_turn(session.trace, model_request.messages)
|
|
643
645
|
except ValueError as error:
|
|
644
646
|
return web.json_response(dialect.error_body(str(error)), status=400)
|
verifiers/v1/session.py
CHANGED
|
@@ -158,22 +158,24 @@ class RolloutSession:
|
|
|
158
158
|
"""Run typed request interceptors and stops over one canonical request."""
|
|
159
159
|
if not self.request_interceptors and (not run_stops or not self.request_stops):
|
|
160
160
|
return request, [], None
|
|
161
|
-
turn = graph.prepare_turn(self.trace, request.messages)
|
|
162
|
-
prepared_users = self.prepared_users.copy()
|
|
163
161
|
prepared: set[int] = set()
|
|
164
162
|
candidates: set[int] = set()
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
163
|
+
if self.request_interceptors:
|
|
164
|
+
turn = graph.prepare_turn(self.trace, request.messages)
|
|
165
|
+
prepared_users = self.prepared_users.copy()
|
|
166
|
+
for position in range(turn.tail_start, len(request.messages)):
|
|
167
|
+
message = request.messages[position]
|
|
168
|
+
if isinstance(message, UserMessage):
|
|
169
|
+
candidates.add(position)
|
|
170
|
+
if prepared_users:
|
|
171
|
+
key = graph.message_hash(message)
|
|
172
|
+
if prepared_users[key]:
|
|
173
|
+
prepared_users[key] -= 1
|
|
174
|
+
prepared.add(position)
|
|
175
|
+
elif isinstance(message, ToolMessage):
|
|
176
|
+
candidates.add(position)
|
|
177
|
+
if self.prepared_tool_results.get(message.tool_call_id) == message:
|
|
178
|
+
prepared.add(position)
|
|
177
179
|
already_intercepted = candidates and candidates == prepared
|
|
178
180
|
|
|
179
181
|
current = request
|
|
@@ -240,7 +242,7 @@ class RolloutSession:
|
|
|
240
242
|
def consume_prepared(self, messages: Messages) -> None:
|
|
241
243
|
"""Forget pre-harness rewrites only after their model request commits."""
|
|
242
244
|
for message in messages:
|
|
243
|
-
if isinstance(message, UserMessage):
|
|
245
|
+
if isinstance(message, UserMessage) and self.prepared_users:
|
|
244
246
|
key = graph.message_hash(message)
|
|
245
247
|
if self.prepared_users[key]:
|
|
246
248
|
self.prepared_users[key] -= 1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: verifiers
|
|
3
|
-
Version: 0.3.2.
|
|
3
|
+
Version: 0.3.2.dev59
|
|
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
|
|
@@ -10,7 +10,7 @@ verifiers/v1/harness.py,sha256=Yx-XCIs1HAmqv1F-nhCTDBUwAx51xQWNWgFcWL1WRTM,13777
|
|
|
10
10
|
verifiers/v1/judge.py,sha256=uqn-djkK2_7Q3kOjkDo6ipOvV_HOvuLa9y6AoDjRux8,9618
|
|
11
11
|
verifiers/v1/rollout.py,sha256=FT6ZYfSqkKOFa5tm52XDTLijKxqpeLr3x2MBdLIk4xk,24021
|
|
12
12
|
verifiers/v1/semantic.py,sha256=VQ_buw6Ya6QtRoh_fiYI5Avs5RmIQCfWH0H0bQc4aoc,4704
|
|
13
|
-
verifiers/v1/session.py,sha256=
|
|
13
|
+
verifiers/v1/session.py,sha256=LAdP72ooTeLUv9GYRqg7b0csit1dmIeVca0cHOU0Q_Q,18865
|
|
14
14
|
verifiers/v1/state.py,sha256=EckF2bWp-vV4b1jYJ9sLI5xrfGuI5spIgYYwW926toI,595
|
|
15
15
|
verifiers/v1/task.py,sha256=9YhllEDgoHSz72-1fcYwBADl-rOzASnrSVimLheWmwI,12237
|
|
16
16
|
verifiers/v1/taskset.py,sha256=fp2E0IEhL_Ybj9cegZwljfTmW27p_30zTWHFKw_kXE4,4374
|
|
@@ -62,8 +62,8 @@ verifiers/v1/configs/cli/validate.py,sha256=NXQ9KvhGLODLrg1fs3Jn-SOq1hhPxauVWiPS
|
|
|
62
62
|
verifiers/v1/dialects/__init__.py,sha256=MNOYM2NdTlSxGK4VtoEjMtD5zya2MpjPDX5jMvZUWEo,736
|
|
63
63
|
verifiers/v1/dialects/anthropic.py,sha256=abwcKRsKkgfgLSuntxBMdL03enG7roRdGoHTYfswafM,26887
|
|
64
64
|
verifiers/v1/dialects/base.py,sha256=pcFqWXSl50VtMuzcY5cyhsc4WpKCM5wT-tskTFZV7CM,12203
|
|
65
|
-
verifiers/v1/dialects/chat.py,sha256=
|
|
66
|
-
verifiers/v1/dialects/responses.py,sha256=
|
|
65
|
+
verifiers/v1/dialects/chat.py,sha256=qhjpduOfNnstfkLTtC0MTS_IfuiOkBwuSwpIg_y1Hjw,23881
|
|
66
|
+
verifiers/v1/dialects/responses.py,sha256=FRQXRubijMG7VuqW_I7ex2DnEzOjuZxwxATy-loEkm0,29254
|
|
67
67
|
verifiers/v1/envs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
68
|
verifiers/v1/envs/agentic_judge/__init__.py,sha256=LfEcRHLG_siKzhzWmODDXWSLpLgfum3UFdQDK9XG0gk,325
|
|
69
69
|
verifiers/v1/envs/agentic_judge/env.py,sha256=GovnHqgRm8nQLAM7wMx57-A_wJBRYopsfiy2Bgf32nA,15339
|
|
@@ -125,7 +125,7 @@ verifiers/v1/harnesses/utils/mcp.py,sha256=Sss-DVMtxdE1eGEfq1ycdi1v7SBsmUU5UcpcI
|
|
|
125
125
|
verifiers/v1/interception/__init__.py,sha256=5Kvo7tcBUVaa65s9A1NiOH3CPpzw-P5btXwxB4Nbbvs,4251
|
|
126
126
|
verifiers/v1/interception/base.py,sha256=Mg16Y104lyZilF9shdivdqYoqz4OYp978i_myyrulu8,2529
|
|
127
127
|
verifiers/v1/interception/pool.py,sha256=sk_zcdTV8EVRuzqlYMXxon_42tSDAlFvwcyOO2EF7hw,6473
|
|
128
|
-
verifiers/v1/interception/server.py,sha256=
|
|
128
|
+
verifiers/v1/interception/server.py,sha256=0pImNyVDKJOwL3l9KgFmjRKfp3Mwn9DjSkzliYSXg5s,52274
|
|
129
129
|
verifiers/v1/interception/tool.py,sha256=ZyZPxLYM_HsGkz-ZbCREQVGtiKZK9lQLChBNF_bBuuc,259
|
|
130
130
|
verifiers/v1/interception/tunnel/__init__.py,sha256=eVNZJszj6myrKhx9jmJz7VRd9qlfj0AUvUZwI2bXEj8,893
|
|
131
131
|
verifiers/v1/interception/tunnel/base.py,sha256=DZB6uPLwM4Qy7n7m0vKeyg-Px87MhsmpYTpe2vpPEng,1998
|
|
@@ -189,8 +189,8 @@ verifiers/v1/utils/prime.py,sha256=UTYRjp9cbjNb6CVmBHda-1wWZAIIfxNOmTyNuT7_wL4,9
|
|
|
189
189
|
verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4,5417
|
|
190
190
|
verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
|
|
191
191
|
verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
|
|
192
|
-
verifiers-0.3.2.
|
|
193
|
-
verifiers-0.3.2.
|
|
194
|
-
verifiers-0.3.2.
|
|
195
|
-
verifiers-0.3.2.
|
|
196
|
-
verifiers-0.3.2.
|
|
192
|
+
verifiers-0.3.2.dev59.dist-info/METADATA,sha256=PsSfsNRgqhTgCJsBY8_ODR_rUmPRliclAgnVutS2FyY,4204
|
|
193
|
+
verifiers-0.3.2.dev59.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
194
|
+
verifiers-0.3.2.dev59.dist-info/entry_points.txt,sha256=uqQje0TMsr7k6nXlWxlPs13Si0evb3pVCEDF6c-YL80,241
|
|
195
|
+
verifiers-0.3.2.dev59.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
|
|
196
|
+
verifiers-0.3.2.dev59.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|