verifiers 0.4.2.dev86__py3-none-any.whl → 0.4.2.dev88__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/clients/prompt_cache.py +8 -39
- verifiers/v1/configs/task.py +2 -2
- verifiers/v1/utils/loaders.py +3 -6
- {verifiers-0.4.2.dev86.dist-info → verifiers-0.4.2.dev88.dist-info}/METADATA +1 -1
- {verifiers-0.4.2.dev86.dist-info → verifiers-0.4.2.dev88.dist-info}/RECORD +8 -8
- {verifiers-0.4.2.dev86.dist-info → verifiers-0.4.2.dev88.dist-info}/WHEEL +0 -0
- {verifiers-0.4.2.dev86.dist-info → verifiers-0.4.2.dev88.dist-info}/entry_points.txt +0 -0
- {verifiers-0.4.2.dev86.dist-info → verifiers-0.4.2.dev88.dist-info}/licenses/LICENSE +0 -0
|
@@ -135,41 +135,10 @@ def _mark_last_tool(
|
|
|
135
135
|
return False
|
|
136
136
|
|
|
137
137
|
|
|
138
|
-
def
|
|
139
|
-
message: dict[str, Any],
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if isinstance(content, str):
|
|
143
|
-
if not content:
|
|
144
|
-
return None
|
|
145
|
-
return {
|
|
146
|
-
**message,
|
|
147
|
-
"content": [
|
|
148
|
-
{
|
|
149
|
-
"type": "text",
|
|
150
|
-
"text": content,
|
|
151
|
-
"cache_control": dict(marker),
|
|
152
|
-
}
|
|
153
|
-
],
|
|
154
|
-
}
|
|
155
|
-
if not isinstance(content, list):
|
|
156
|
-
return None
|
|
157
|
-
for index in range(len(content) - 1, -1, -1):
|
|
158
|
-
block = content[index]
|
|
159
|
-
if (
|
|
160
|
-
isinstance(block, dict)
|
|
161
|
-
and block.get("type") == "text"
|
|
162
|
-
and isinstance(block.get("text"), str)
|
|
163
|
-
and block["text"]
|
|
164
|
-
):
|
|
165
|
-
updated = list(content)
|
|
166
|
-
updated[index] = {**block, "cache_control": dict(marker)}
|
|
167
|
-
return {**message, "content": updated}
|
|
168
|
-
return None
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
def _mark_last_anthropic_block(
|
|
172
|
-
message: dict[str, Any], marker: dict[str, str]
|
|
138
|
+
def _mark_last_block(
|
|
139
|
+
message: dict[str, Any],
|
|
140
|
+
marker: dict[str, str],
|
|
141
|
+
block_types: frozenset[str] = frozenset({"text"}),
|
|
173
142
|
) -> dict | None:
|
|
174
143
|
content = message.get("content")
|
|
175
144
|
if isinstance(content, str):
|
|
@@ -192,7 +161,7 @@ def _mark_last_anthropic_block(
|
|
|
192
161
|
if not isinstance(block, dict):
|
|
193
162
|
continue
|
|
194
163
|
block_type = block.get("type")
|
|
195
|
-
if not isinstance(block_type, str) or block_type not in
|
|
164
|
+
if not isinstance(block_type, str) or block_type not in block_types:
|
|
196
165
|
continue
|
|
197
166
|
if block_type == "text" and not (
|
|
198
167
|
isinstance(block.get("text"), str) and block["text"]
|
|
@@ -246,7 +215,7 @@ def _mark_chat(body: dict[str, Any], marker: dict[str, str]) -> bool:
|
|
|
246
215
|
updated_messages = list(messages)
|
|
247
216
|
messages_changed = False
|
|
248
217
|
for index in reversed(_leading_instruction_indices(messages)):
|
|
249
|
-
marked =
|
|
218
|
+
marked = _mark_last_block(messages[index], marker)
|
|
250
219
|
if marked is not None:
|
|
251
220
|
updated_messages[index] = marked
|
|
252
221
|
messages_changed = True
|
|
@@ -261,7 +230,7 @@ def _mark_chat(body: dict[str, Any], marker: dict[str, str]) -> bool:
|
|
|
261
230
|
and isinstance(last_role, str)
|
|
262
231
|
and last_role in {"user", "tool"}
|
|
263
232
|
):
|
|
264
|
-
marked =
|
|
233
|
+
marked = _mark_last_block(last_message, marker)
|
|
265
234
|
if marked is not None:
|
|
266
235
|
updated_messages[-1] = marked
|
|
267
236
|
messages_changed = True
|
|
@@ -303,7 +272,7 @@ def _mark_anthropic_messages(body: dict[str, Any], marker: dict[str, str]) -> bo
|
|
|
303
272
|
|
|
304
273
|
messages = body.get("messages")
|
|
305
274
|
if isinstance(messages, list) and messages and _has_messages_history(messages):
|
|
306
|
-
marked =
|
|
275
|
+
marked = _mark_last_block(messages[-1], marker, _ANTHROPIC_BLOCK_TYPES)
|
|
307
276
|
if marked is not None:
|
|
308
277
|
body["messages"] = [*messages[:-1], marked]
|
|
309
278
|
applied = True
|
verifiers/v1/configs/task.py
CHANGED
|
@@ -12,8 +12,8 @@ class DecoratedFunctionConfig(BaseConfig):
|
|
|
12
12
|
"""A plugged function standing in for a decorated task method."""
|
|
13
13
|
|
|
14
14
|
fn: str | None = None
|
|
15
|
-
"""Import path to the function: `pkg.module
|
|
16
|
-
|
|
15
|
+
"""Import path to the function: `pkg.module:function` or
|
|
16
|
+
`path/to/file.py:function`. Unset keeps the task's decorated method with the
|
|
17
17
|
entry's name and only overrides its metadata (priority, weight, skip_scoring)."""
|
|
18
18
|
|
|
19
19
|
priority: int | None = None
|
verifiers/v1/utils/loaders.py
CHANGED
|
@@ -228,15 +228,12 @@ def file_module(path: str) -> ModuleType:
|
|
|
228
228
|
|
|
229
229
|
|
|
230
230
|
def plugged_fn(path: str) -> Callable[..., Any]:
|
|
231
|
-
"""Resolve a plugged function's import path: `pkg.module
|
|
232
|
-
`
|
|
231
|
+
"""Resolve a plugged function's import path: `pkg.module:function` or
|
|
232
|
+
`path/to/file.py:function`."""
|
|
233
233
|
module_path, _, attr = path.rpartition(":")
|
|
234
|
-
if not module_path:
|
|
235
|
-
module_path, _, attr = path.rpartition(".")
|
|
236
234
|
if not module_path or not attr:
|
|
237
235
|
raise ValueError(
|
|
238
|
-
f"fn {path!r} must be `pkg.module
|
|
239
|
-
"or `path/to/file.py:function`"
|
|
236
|
+
f"fn {path!r} must be `pkg.module:function` or `path/to/file.py:function`"
|
|
240
237
|
)
|
|
241
238
|
if module_path.endswith(".py"):
|
|
242
239
|
module = file_module(module_path)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: verifiers
|
|
3
|
-
Version: 0.4.2.
|
|
3
|
+
Version: 0.4.2.dev88
|
|
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
|
|
@@ -31,7 +31,7 @@ verifiers/v1/clients/__init__.py,sha256=3rXv205sRheGvG8yNDmFwpq8qK9dlt7S_ia1zGWh
|
|
|
31
31
|
verifiers/v1/clients/base.py,sha256=C0G5lRm3nxt1xmPoA2cweBgCnN2KcLepmCYq1vdDrnU,1691
|
|
32
32
|
verifiers/v1/clients/client.py,sha256=yo9tjmiPCw-p3353u55NnDCzvBhkJtQwYbaqG8364JI,7888
|
|
33
33
|
verifiers/v1/clients/eval.py,sha256=GgpHZGh4IW3gC-tOZiFPp62MCL4aHik0b4afz2g3-Qo,8729
|
|
34
|
-
verifiers/v1/clients/prompt_cache.py,sha256
|
|
34
|
+
verifiers/v1/clients/prompt_cache.py,sha256=DL_3U7Otejctdzg-H-r-sVPNmcR11IG22FRfbq3Y8as,10856
|
|
35
35
|
verifiers/v1/clients/train.py,sha256=L6XDRUbOxkhtN6nt3sGqeAiHTfqNYdXdQewY9tQ6f8k,21134
|
|
36
36
|
verifiers/v1/configs/__init__.py,sha256=X7u6X7B3ieD1HZl79Tv1kg-yPHbT0QLvAebaGqxVtvA,317
|
|
37
37
|
verifiers/v1/configs/agent.py,sha256=xn9j1WcBIGz7LjgW8WOWDvSvk7vPLztisSLVcT2foxk,7530
|
|
@@ -46,7 +46,7 @@ verifiers/v1/configs/runtime.py,sha256=7To2aecnYuv_ThVt5OIlKUiocldmt4O0hZzkSwuJs
|
|
|
46
46
|
verifiers/v1/configs/sampling.py,sha256=yHYb-ymUg8MlXfNDn9VZ3yXL5SXNqrEDT6JLuMAovYU,1146
|
|
47
47
|
verifiers/v1/configs/scoring.py,sha256=8t5NrQU9b8R9dGdcG-aQm_U1m3TgeMIbw_XUN4esoF0,3115
|
|
48
48
|
verifiers/v1/configs/select.py,sha256=a72aweHXsA1B9i-ShR710NZr4ZFC-0xfSQ5J8aQGrew,5820
|
|
49
|
-
verifiers/v1/configs/task.py,sha256=
|
|
49
|
+
verifiers/v1/configs/task.py,sha256=Au-SIawoJff2MBUwCqpqPCxFVoqvd4fvg74dnmM9uz4,2934
|
|
50
50
|
verifiers/v1/configs/taskset.py,sha256=OJG_DfM2_6I4Mm1-egMcrIEN6UtD2JaBaXnzW9SZXk8,906
|
|
51
51
|
verifiers/v1/configs/cli/__init__.py,sha256=YMDUPdbRlDJ77dhj3QqzmyRhqNgUvuQdpj_bdBqzZPM,78
|
|
52
52
|
verifiers/v1/configs/cli/debug.py,sha256=1vddnShdwYzRJp0Ubl9sp7sgnR3m2JKHkAOk741UnWU,2748
|
|
@@ -177,7 +177,7 @@ verifiers/v1/utils/generic.py,sha256=lKIzu5rvwnuSlr_kTFdupf-ElubjjvOo0vnBHYMUpC4
|
|
|
177
177
|
verifiers/v1/utils/git.py,sha256=LJGHrIxZs7eg58e_W7TiNYbZQCXMBERgkP42F4IOk9A,8363
|
|
178
178
|
verifiers/v1/utils/image.py,sha256=OFw_wdwVtbdwa8uJ3X3vYfhpUAi0CTH5HMBupjVsRRQ,282
|
|
179
179
|
verifiers/v1/utils/interrupt.py,sha256=HueVSI54ZVIKcJ0uZ62uQduUSgXEXJRL3tlzlo1FCak,1043
|
|
180
|
-
verifiers/v1/utils/loaders.py,sha256=
|
|
180
|
+
verifiers/v1/utils/loaders.py,sha256=QbkQmzcWDB7frHzzO6kutkLz9YAgZIswQ3aFffOkSog,12904
|
|
181
181
|
verifiers/v1/utils/logging.py,sha256=F1ymwd1A8Unu85kAQ52MAowHnR7EKQIl0RDRY8u-N5I,5392
|
|
182
182
|
verifiers/v1/utils/memory.py,sha256=ZkIvGk6uITAH5sKon65LifKPbvZr8mJ__PVc23FZpOQ,1835
|
|
183
183
|
verifiers/v1/utils/network.py,sha256=SI6_PXHIAPows6VBpK75N6dMbPw6lWQQ3OjBQkSDGN4,1463
|
|
@@ -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=V7lBiwyuSoYP6VYwjIR1woF_zf6fKqM8t9Mz2okPBV4,2587
|
|
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.dev88.dist-info/METADATA,sha256=UUDVLg7AwLqtsMoIMkJMtntnNk3FmZcJ8wgyJ9_1Ls4,5116
|
|
192
|
+
verifiers-0.4.2.dev88.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
193
|
+
verifiers-0.4.2.dev88.dist-info/entry_points.txt,sha256=qdMg7ajiFpDsHf7tuPMRclJXizu1J6LTWawS5YS0B0I,137
|
|
194
|
+
verifiers-0.4.2.dev88.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
|
|
195
|
+
verifiers-0.4.2.dev88.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|