verifiers 0.4.2.dev28__py3-none-any.whl → 0.4.2.dev30__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.
@@ -10,6 +10,7 @@ from typing import Any, ClassVar, TypeVar
10
10
 
11
11
  import numpy as np
12
12
  from openai import OpenAIError
13
+ from openai.types import CompletionUsage
13
14
  from renderers import OverlongPromptError, RenderedTokens, Renderer, RendererConfig
14
15
  from renderers.base import ToolCallParseStatus, is_multimodal
15
16
 
@@ -165,11 +166,8 @@ def response_from_generate(
165
166
  tool_calls=tool_calls,
166
167
  ),
167
168
  finish_reason=finish,
168
- # /inference/v1/generate returns exact token ids but no usage details, so the
169
- # completion's reasoning-token subset is unknown.
170
- usage=Usage(
171
- prompt_tokens=len(prompt_ids), completion_tokens=len(completion_ids)
172
- ),
169
+ # Require provider usage to preserve cache and reasoning accounting.
170
+ usage=Usage.from_openai(CompletionUsage.model_validate(result["usage"])),
173
171
  # The streams are already typed arrays, so skip revalidation.
174
172
  tokens=TurnTokens.model_construct(
175
173
  prompt_ids=prompt_ids,
@@ -3,13 +3,24 @@
3
3
 
4
4
  import re
5
5
  import sys
6
+ from pathlib import Path
6
7
 
7
- from pydantic import AliasChoices, Field, field_validator
8
+ from pydantic import AliasChoices, Field, field_validator, model_validator
8
9
  from pydantic_config import BaseConfig
9
10
 
10
11
  IDX_RANGE = re.compile(r"(\d*):(\d*)(?::(\d*))?")
11
12
 
12
13
 
14
+ class TaskMatchFilesConfig(BaseConfig):
15
+ """Newline-delimited text files with more entries for each `TaskMatchConfig`
16
+ list, one entry per line. Blank lines are skipped."""
17
+
18
+ idx: Path | None = None
19
+ ids: Path | None = None
20
+ keys: Path | None = None
21
+ names: Path | None = None
22
+
23
+
13
24
  class TaskMatchConfig(BaseConfig):
14
25
  """Tasks named by position or identity; a task matches when any list names it."""
15
26
 
@@ -24,6 +35,10 @@ class TaskMatchConfig(BaseConfig):
24
35
  """`Task.key` values, as recorded on each trace (`task.key`)."""
25
36
  names: list[str] = Field(default_factory=list)
26
37
  """`TaskData.name` values."""
38
+ files: TaskMatchFilesConfig = TaskMatchFilesConfig()
39
+ """Files whose lines extend the lists above, for selections too long to write
40
+ inline (`files.ids = "ids.txt"`). Validation reads them into the lists and
41
+ resets `files`."""
27
42
 
28
43
  @field_validator("idx", mode="before")
29
44
  @classmethod
@@ -36,6 +51,19 @@ class TaskMatchConfig(BaseConfig):
36
51
  items.extend(_parse_idx_item(part) for part in parts)
37
52
  return items
38
53
 
54
+ @model_validator(mode="after")
55
+ def _read_files(self):
56
+ for field, path in self.files:
57
+ if path is None:
58
+ continue
59
+ lines = [line.strip() for line in path.read_text().splitlines()]
60
+ entries = [line for line in lines if line]
61
+ if field == "idx":
62
+ entries = [_parse_idx_item(entry) for entry in entries]
63
+ getattr(self, field).extend(entries)
64
+ self.files = TaskMatchFilesConfig()
65
+ return self
66
+
39
67
  @property
40
68
  def empty(self) -> bool:
41
69
  return not (self.idx or self.ids or self.keys or self.names)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.4.2.dev28
3
+ Version: 0.4.2.dev30
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=Ysig0tE_0E4Jsfgfes1XHN-fK1s_RCXdqZD6E7lK
31
31
  verifiers/v1/clients/base.py,sha256=C0G5lRm3nxt1xmPoA2cweBgCnN2KcLepmCYq1vdDrnU,1691
32
32
  verifiers/v1/clients/client.py,sha256=HT3aQiOyYYjvz_cKEXchtUSD07-4VehebWUJL9AyON8,3166
33
33
  verifiers/v1/clients/eval.py,sha256=pWHgnRU8QQE6jnjJdwJNdvR8BeJ-z_OfjIB1tcwLpkc,8340
34
- verifiers/v1/clients/train.py,sha256=GezVMVyMXn467pTIG-m0JQ_J510CIHRe2yeGj04Mxh0,20334
34
+ verifiers/v1/clients/train.py,sha256=v1YCVNCEXw2FNQw4lpbLoq18u8TQeo9TnsYOoMWr4zE,20277
35
35
  verifiers/v1/configs/__init__.py,sha256=X7u6X7B3ieD1HZl79Tv1kg-yPHbT0QLvAebaGqxVtvA,317
36
36
  verifiers/v1/configs/agent.py,sha256=xn9j1WcBIGz7LjgW8WOWDvSvk7vPLztisSLVcT2foxk,7530
37
37
  verifiers/v1/configs/client.py,sha256=IvYQuPLVWr8qZNdMbQ9lRXK0wZ4vOjK67lO1lgD2fmM,6149
@@ -44,7 +44,7 @@ verifiers/v1/configs/retries.py,sha256=GIrwS0lnMKnlQ_Wj1Z2J6NlEYK4jX5weZxYmQmLcp
44
44
  verifiers/v1/configs/runtime.py,sha256=7To2aecnYuv_ThVt5OIlKUiocldmt4O0hZzkSwuJsBI,11773
45
45
  verifiers/v1/configs/sampling.py,sha256=bd6lietww4htrNYmUEqwK5yfKMhUT3nEjHoCg5xl_ys,1174
46
46
  verifiers/v1/configs/scoring.py,sha256=8t5NrQU9b8R9dGdcG-aQm_U1m3TgeMIbw_XUN4esoF0,3115
47
- verifiers/v1/configs/select.py,sha256=_HdcepQaJ1sDCYcs7Vqx72npDwHGOgUjsLDZmcgnonU,4743
47
+ verifiers/v1/configs/select.py,sha256=bLMJAb7i23IxU6BZMIS0Q_K5JYLlcwL8zi87REhrccc,5827
48
48
  verifiers/v1/configs/task.py,sha256=3CB9pumHdxAHlxLKuLEiCfQPW37tNqy_HC6DgG2GKj4,2958
49
49
  verifiers/v1/configs/taskset.py,sha256=rQow8AJL34n-ZVQ_4GPjPIW5fzBL5QU_RTjJO9tlmwU,945
50
50
  verifiers/v1/configs/cli/__init__.py,sha256=YMDUPdbRlDJ77dhj3QqzmyRhqNgUvuQdpj_bdBqzZPM,78
@@ -193,8 +193,8 @@ verifiers/v1/utils/scope.py,sha256=zbs4pj6AVk4jywlAJ3AX0Q0_kzB9dBB02nY-9H4ELdQ,8
193
193
  verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
194
194
  verifiers/v1/utils/trace_store.py,sha256=Qo9qvsJAl8PoRUavjQAfUB2VNxmUtYQtU2ejLKPzY9c,3382
195
195
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
196
- verifiers-0.4.2.dev28.dist-info/METADATA,sha256=_IrZBtOKwCdUNW8pZxOcC--V48LwcZTugf8J3vLgc3E,5142
197
- verifiers-0.4.2.dev28.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
198
- verifiers-0.4.2.dev28.dist-info/entry_points.txt,sha256=3M8Wr0w1cUKiB-fJ6YHB6eK5WuKYg-Y3OC4wCuUje_c,174
199
- verifiers-0.4.2.dev28.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
200
- verifiers-0.4.2.dev28.dist-info/RECORD,,
196
+ verifiers-0.4.2.dev30.dist-info/METADATA,sha256=4Hqn7rY_wdYh8e_puZgnQLBJvOoCshGo8ExQ2B9hdAs,5142
197
+ verifiers-0.4.2.dev30.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
198
+ verifiers-0.4.2.dev30.dist-info/entry_points.txt,sha256=3M8Wr0w1cUKiB-fJ6YHB6eK5WuKYg-Y3OC4wCuUje_c,174
199
+ verifiers-0.4.2.dev30.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
200
+ verifiers-0.4.2.dev30.dist-info/RECORD,,