verifiers 0.4.2.dev123__py3-none-any.whl → 0.4.2.dev125__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/configs/scoring.py +19 -6
- verifiers/v1/interception/server.py +18 -17
- verifiers/v1/rollout.py +3 -1
- verifiers/v1/session.py +20 -15
- {verifiers-0.4.2.dev123.dist-info → verifiers-0.4.2.dev125.dist-info}/METADATA +1 -1
- {verifiers-0.4.2.dev123.dist-info → verifiers-0.4.2.dev125.dist-info}/RECORD +9 -9
- {verifiers-0.4.2.dev123.dist-info → verifiers-0.4.2.dev125.dist-info}/WHEEL +0 -0
- {verifiers-0.4.2.dev123.dist-info → verifiers-0.4.2.dev125.dist-info}/entry_points.txt +0 -0
- {verifiers-0.4.2.dev123.dist-info → verifiers-0.4.2.dev125.dist-info}/licenses/LICENSE +0 -0
verifiers/v1/configs/scoring.py
CHANGED
|
@@ -34,6 +34,19 @@ class ScoringJudgeConfig(BaseClientConfig):
|
|
|
34
34
|
return sampling.model_dump(exclude_unset=True)
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
SkipReason = Literal[
|
|
38
|
+
"truncated",
|
|
39
|
+
"timeout",
|
|
40
|
+
"format_violation",
|
|
41
|
+
"max_turns",
|
|
42
|
+
"max_input_tokens",
|
|
43
|
+
"max_output_tokens",
|
|
44
|
+
"max_total_tokens",
|
|
45
|
+
"max_turn_tokens",
|
|
46
|
+
"compaction_failed",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
|
|
37
50
|
class ScoringConfig(BaseConfig):
|
|
38
51
|
mode: Literal["shared", "isolated"] = "shared"
|
|
39
52
|
"""Score in the workspace or restore into a fresh runtime."""
|
|
@@ -50,14 +63,14 @@ class ScoringConfig(BaseConfig):
|
|
|
50
63
|
combined with the runtime's own rules the same way. None keeps the default: isolated
|
|
51
64
|
scoring runs under `TaskData.network`, shared scoring keeps the agent phase's network,
|
|
52
65
|
and Harbor's shared grading lifts the policy."""
|
|
53
|
-
skip: dict[
|
|
54
|
-
Field(default_factory=dict)
|
|
55
|
-
)
|
|
66
|
+
skip: dict[SkipReason, FiniteFloat] = Field(default_factory=dict)
|
|
56
67
|
"""Skip task scoring for these reasons and record the value as a fixed reward named
|
|
57
68
|
after the reason. `truncated` matches `Trace.is_truncated`, `timeout` a stage
|
|
58
|
-
deadline that expired before scoring (`Trace.is_timeout`). A
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
deadline that expired before scoring (`Trace.is_timeout`). A framework limit's stop
|
|
70
|
+
condition (`max_turn_tokens`, `max_turns`, ...) matches only a trace that limit
|
|
71
|
+
stopped, and wins over `truncated`. A format violation is never scored, so
|
|
72
|
+
`format_violation` only sets its reward. A reason left out is scored as usual, or,
|
|
73
|
+
for a format violation, keeps no rewards."""
|
|
61
74
|
|
|
62
75
|
@field_serializer("runtime")
|
|
63
76
|
def serialize_runtime(
|
|
@@ -817,25 +817,26 @@ class InterceptionServer(Interception):
|
|
|
817
817
|
# A malformed harness knob must not kill recording (this runs in the
|
|
818
818
|
# exchange's `finally`); the provider rejects the request on its own.
|
|
819
819
|
logger.warning("Could not record call settings", exc_info=True)
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
paths=policy_paths,
|
|
833
|
-
)
|
|
834
|
-
if policy_paths
|
|
835
|
-
else None,
|
|
836
|
-
acp=acp,
|
|
820
|
+
call = ModelCall(
|
|
821
|
+
node=node,
|
|
822
|
+
model=request.get("model") if request is not None else None,
|
|
823
|
+
sampling=sampling,
|
|
824
|
+
endpoint=dialect.upstream_path,
|
|
825
|
+
finish_reason=finish_reason,
|
|
826
|
+
usage=usage,
|
|
827
|
+
time=TimeSpan(start=started, end=time.time()),
|
|
828
|
+
error=None if error is None else Error.from_exception(error),
|
|
829
|
+
policy=PolicyEvent(
|
|
830
|
+
code=PROVIDER_CAPABILITY_POLICY_CODE,
|
|
831
|
+
paths=policy_paths,
|
|
837
832
|
)
|
|
833
|
+
if policy_paths
|
|
834
|
+
else None,
|
|
835
|
+
acp=acp,
|
|
838
836
|
)
|
|
837
|
+
session.trace.calls.append(call)
|
|
838
|
+
if not session.judge_only and session.limits.turn_capped(call):
|
|
839
|
+
session.trace.stop("max_turn_tokens")
|
|
839
840
|
session.trace.notify()
|
|
840
841
|
|
|
841
842
|
async def handle_request(
|
verifiers/v1/rollout.py
CHANGED
|
@@ -1532,11 +1532,13 @@ class Rollout:
|
|
|
1532
1532
|
skip = self._scoring_policy.skip
|
|
1533
1533
|
if self.trace.is_format_violation:
|
|
1534
1534
|
return "format_violation", skip.get("format_violation")
|
|
1535
|
+
if (stop := self.trace.stop_condition) in skip:
|
|
1536
|
+
return stop, skip[stop]
|
|
1535
1537
|
if "truncated" in skip and self.trace.is_truncated:
|
|
1536
1538
|
return "truncated", skip["truncated"]
|
|
1537
1539
|
if "timeout" in skip and self.trace.is_timeout:
|
|
1538
1540
|
return "timeout", skip["timeout"]
|
|
1539
|
-
if
|
|
1541
|
+
if stop in self._skip_scoring_stops:
|
|
1540
1542
|
return stop, self._skip_scoring_stops[stop]
|
|
1541
1543
|
return None
|
|
1542
1544
|
|
verifiers/v1/session.py
CHANGED
|
@@ -39,7 +39,7 @@ from verifiers.v1.configs.runtime import NetworkPolicyConfig
|
|
|
39
39
|
from verifiers.v1.dialects.base import CAPABILITY_NOTICE
|
|
40
40
|
from verifiers.v1.errors import HarnessError, RolloutError, TaskError
|
|
41
41
|
from verifiers.v1.harnesses.utils.compaction import bound_tool_message
|
|
42
|
-
from verifiers.v1.trace import InterceptRecord, Trace
|
|
42
|
+
from verifiers.v1.trace import InterceptRecord, ModelCall, Trace
|
|
43
43
|
from verifiers.v1.types import (
|
|
44
44
|
AssistantMessage,
|
|
45
45
|
Message,
|
|
@@ -259,8 +259,9 @@ class RolloutLimits:
|
|
|
259
259
|
`max_turns` -> num_turns, `max_input_tokens` -> num_input_tokens, `max_output_tokens` ->
|
|
260
260
|
num_output_tokens, `max_total_tokens` -> num_total_tokens. Token caps are soft by one turn:
|
|
261
261
|
they're checked between turns, so the turn that crosses a cap still completes.
|
|
262
|
-
`max_turn_tokens` caps each response (applied through sampling) and
|
|
263
|
-
|
|
262
|
+
`max_turn_tokens` caps each response (applied through sampling) and stops the trace
|
|
263
|
+
as soon as a response hits it, so a clean end after that response cannot name the
|
|
264
|
+
trace instead."""
|
|
264
265
|
|
|
265
266
|
max_turns: int | None = None
|
|
266
267
|
max_input_tokens: int | None = None
|
|
@@ -287,20 +288,24 @@ class RolloutLimits:
|
|
|
287
288
|
and trace.num_total_tokens >= self.max_total_tokens
|
|
288
289
|
):
|
|
289
290
|
return "max_total_tokens"
|
|
290
|
-
if
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
if (
|
|
294
|
-
last is not None
|
|
295
|
-
and last.finish_reason == "length"
|
|
296
|
-
and (
|
|
297
|
-
last.usage is None
|
|
298
|
-
or last.usage.completion_tokens >= self.max_turn_tokens
|
|
299
|
-
)
|
|
300
|
-
):
|
|
301
|
-
return "max_turn_tokens"
|
|
291
|
+
last = next((c for c in reversed(trace.calls) if c.error is None), None)
|
|
292
|
+
if last is not None and self.turn_capped(last):
|
|
293
|
+
return "max_turn_tokens"
|
|
302
294
|
return None
|
|
303
295
|
|
|
296
|
+
def turn_capped(self, call: ModelCall) -> bool:
|
|
297
|
+
"""Whether `call`'s response hit `max_turn_tokens`. A length finish below the cap
|
|
298
|
+
ran out of context, not turn tokens."""
|
|
299
|
+
return (
|
|
300
|
+
self.max_turn_tokens is not None
|
|
301
|
+
and call.error is None
|
|
302
|
+
and call.finish_reason == "length"
|
|
303
|
+
and (
|
|
304
|
+
call.usage is None
|
|
305
|
+
or call.usage.completion_tokens >= self.max_turn_tokens
|
|
306
|
+
)
|
|
307
|
+
)
|
|
308
|
+
|
|
304
309
|
|
|
305
310
|
@dataclass
|
|
306
311
|
class IdempotentRequest:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: verifiers
|
|
3
|
-
Version: 0.4.2.
|
|
3
|
+
Version: 0.4.2.dev125
|
|
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,9 +10,9 @@ verifiers/v1/graph.py,sha256=_IEMMdOJ7TAy2TM9H9LZBAeYCgV9-Uo8XtfTUdg_aBI,48582
|
|
|
10
10
|
verifiers/v1/harness.py,sha256=3jJjA_Td8f61jzN33J7h0Hk_hUCe_pqh_ePjH_EVg7c,19067
|
|
11
11
|
verifiers/v1/judge.py,sha256=T-TyYVcLGIoyUADYKy_pCBj2CTLhERlct5pmmWqPpTA,10507
|
|
12
12
|
verifiers/v1/restore.py,sha256=kg7TM5J2LlVoQhKpkVAT6PXroOqCOjNqH3wlGV-DOtA,8339
|
|
13
|
-
verifiers/v1/rollout.py,sha256=
|
|
13
|
+
verifiers/v1/rollout.py,sha256=freGbO3mYlkfv-m27WaSy4iORZL_N9VjDuUFkUBTqts,87684
|
|
14
14
|
verifiers/v1/semantic.py,sha256=nqKPPUoPL5Oh8Es_XjtcbDiQiIMKTYayXEm-EPB-jAE,5129
|
|
15
|
-
verifiers/v1/session.py,sha256=
|
|
15
|
+
verifiers/v1/session.py,sha256=4O7JOFFoy2GvUOhJgWHn6FNwmpMv7tDflDA_0ffBS9k,52457
|
|
16
16
|
verifiers/v1/state.py,sha256=EckF2bWp-vV4b1jYJ9sLI5xrfGuI5spIgYYwW926toI,595
|
|
17
17
|
verifiers/v1/submission.py,sha256=zgSRbGVz82Efwz4nX4tlJ-i02AmjtKyu_vHfwfLaByw,7989
|
|
18
18
|
verifiers/v1/task.py,sha256=zcWjBjhJrkGIL29JTnxxw6v2pbJoiek_tF5RVAVV2ZY,15919
|
|
@@ -45,7 +45,7 @@ verifiers/v1/configs/judge.py,sha256=nP5rE430PCtyLYIZ772EpWXEPZxg6GaiUgeGXOEj0v8
|
|
|
45
45
|
verifiers/v1/configs/retries.py,sha256=GIrwS0lnMKnlQ_Wj1Z2J6NlEYK4jX5weZxYmQmLcpUI,1793
|
|
46
46
|
verifiers/v1/configs/runtime.py,sha256=nzAWj4M2Sk62t-KtJyvUbl4VgK5AMcU4Ty7NXlvip2Y,12246
|
|
47
47
|
verifiers/v1/configs/sampling.py,sha256=yHYb-ymUg8MlXfNDn9VZ3yXL5SXNqrEDT6JLuMAovYU,1146
|
|
48
|
-
verifiers/v1/configs/scoring.py,sha256=
|
|
48
|
+
verifiers/v1/configs/scoring.py,sha256=_Kk_XHD70jcFXd3Ca_YJniUWWn1USOVFurQIfQQEpKE,5086
|
|
49
49
|
verifiers/v1/configs/select.py,sha256=a72aweHXsA1B9i-ShR710NZr4ZFC-0xfSQ5J8aQGrew,5820
|
|
50
50
|
verifiers/v1/configs/task.py,sha256=75PdyGgtJAELd6IsPcHOTmk8ybEabm6Vbog4sC7hiPo,3020
|
|
51
51
|
verifiers/v1/configs/taskset.py,sha256=OJG_DfM2_6I4Mm1-egMcrIEN6UtD2JaBaXnzW9SZXk8,906
|
|
@@ -121,7 +121,7 @@ verifiers/v1/harnesses/utils/replay.py,sha256=m2EXxd24aH3Y5DAi9tEV1teREXGcPHsXhp
|
|
|
121
121
|
verifiers/v1/interception/__init__.py,sha256=Ca5bxP_wWeeVyX8HXbMfqdwUbq7iXPhGXBCje-huHkM,4148
|
|
122
122
|
verifiers/v1/interception/base.py,sha256=zxkkve4UeD5J_14rirLg2ypik2tiwut9E4uqn8J0z5I,2330
|
|
123
123
|
verifiers/v1/interception/pool.py,sha256=QVkt_XKhKhZJnwmXu1MmnbMR5kiffZt0uo0tSj2zZf4,6716
|
|
124
|
-
verifiers/v1/interception/server.py,sha256=
|
|
124
|
+
verifiers/v1/interception/server.py,sha256=UHPt-SMf_XfjWhk4Wq559bx96kk9qkCUwqvOGENPxDs,63732
|
|
125
125
|
verifiers/v1/interception/relay/__init__.py,sha256=wSloZcQqjjLCAVommZ5zdyjwGVUfdrh6se5QTEuU_4E,8652
|
|
126
126
|
verifiers/v1/interception/relay/server.py,sha256=yIhHlrhkPSnpGTTd5vj565naxgW4Cqqd-P1wud_H6N8,28932
|
|
127
127
|
verifiers/v1/interception/tunnel/__init__.py,sha256=4ZqR9F7cmLUg17qvk4sXtLpWAN4epdiMgA2l9jetMbU,721
|
|
@@ -188,8 +188,8 @@ verifiers/v1/utils/scope.py,sha256=zbs4pj6AVk4jywlAJ3AX0Q0_kzB9dBB02nY-9H4ELdQ,8
|
|
|
188
188
|
verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
|
|
189
189
|
verifiers/v1/utils/trace_store.py,sha256=7F6xMhYgl3qmylnCU8-ekqswH16fUat1uegeM1OR9QQ,2563
|
|
190
190
|
verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
|
|
191
|
-
verifiers-0.4.2.
|
|
192
|
-
verifiers-0.4.2.
|
|
193
|
-
verifiers-0.4.2.
|
|
194
|
-
verifiers-0.4.2.
|
|
195
|
-
verifiers-0.4.2.
|
|
191
|
+
verifiers-0.4.2.dev125.dist-info/METADATA,sha256=hGVNfAMEhsvcvdlQiE9kojaAEBcLDWDrgCvdSxxSDtE,5118
|
|
192
|
+
verifiers-0.4.2.dev125.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
193
|
+
verifiers-0.4.2.dev125.dist-info/entry_points.txt,sha256=qdMg7ajiFpDsHf7tuPMRclJXizu1J6LTWawS5YS0B0I,137
|
|
194
|
+
verifiers-0.4.2.dev125.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
|
|
195
|
+
verifiers-0.4.2.dev125.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|