verifiers 0.2.2.dev47__py3-none-any.whl → 0.2.2.dev48__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/cli/debug.py CHANGED
@@ -18,6 +18,7 @@ import verifiers.v1 as vf
18
18
  from verifiers.v1.cli.output import append_trace, save_config
19
19
  from verifiers.v1.cli.resolve import (
20
20
  extract_id,
21
+ narrow_taskset_config,
21
22
  plugin_errors,
22
23
  references_config_file,
23
24
  with_positional_taskset,
@@ -43,15 +44,7 @@ USAGE = (
43
44
 
44
45
  def _narrow(argv: list[str]) -> type[DebugConfig]:
45
46
  """`DebugConfig` with `taskset` narrowed to the config type of the id on the CLI."""
46
- taskset_id = extract_id(argv, "taskset")
47
- if not taskset_id:
48
- return DebugConfig
49
- ftype = vf.taskset_config_type(taskset_id)
50
- return type(
51
- DebugConfig.__name__,
52
- (DebugConfig,),
53
- {"__annotations__": {"taskset": ftype}, "taskset": ftype(id=taskset_id)},
54
- )
47
+ return narrow_taskset_config(DebugConfig, extract_id(argv, "taskset"))
55
48
 
56
49
 
57
50
  def output_path(config: DebugConfig) -> Path:
@@ -27,6 +27,7 @@ from verifiers.v1.cli.output import (
27
27
  save_config,
28
28
  write_config,
29
29
  )
30
+ from verifiers.v1.cli.resolve import narrow_taskset_config
30
31
  from verifiers.v1.configs.agent import WireAgentConfig
31
32
  from verifiers.v1.configs.cli.replay import ReplayConfig
32
33
  from verifiers.v1.state import state_cls
@@ -49,14 +50,7 @@ def _narrow(config_path: Path) -> type[ReplayConfig]:
49
50
  data = tomllib.loads(config_path.read_text())
50
51
  taskset = data.get("taskset") or (data.get("env") or {}).get("taskset") or {}
51
52
  taskset_id = taskset.get("id")
52
- if not taskset_id:
53
- return ReplayConfig
54
- ftype = vf.taskset_config_type(taskset_id)
55
- return type(
56
- "ReplayConfig",
57
- (ReplayConfig,),
58
- {"__annotations__": {"taskset": ftype}, "taskset": ftype(id=taskset_id)},
59
- )
53
+ return narrow_taskset_config(ReplayConfig, taskset_id)
60
54
 
61
55
 
62
56
  def output_dir(config: ReplayConfig) -> Path:
@@ -8,9 +8,14 @@ states explicitly is pre-narrowed — never to a type a config file could contra
8
8
  """
9
9
 
10
10
  import contextlib
11
+ from typing import TypeVar
12
+
13
+ from pydantic import BaseModel, create_model
11
14
 
12
15
  import verifiers.v1 as vf
13
16
 
17
+ ConfigT = TypeVar("ConfigT", bound=BaseModel)
18
+
14
19
 
15
20
  @contextlib.contextmanager
16
21
  def plugin_errors():
@@ -68,7 +73,19 @@ def extract_id(argv: list[str], field: str, default: str = "") -> str:
68
73
  return found[0] if found else default
69
74
 
70
75
 
71
- def narrow_config(base: type, argv: list[str]) -> type:
76
+ def narrow_taskset_config(base: type[ConfigT], taskset_id: str | None) -> type[ConfigT]:
77
+ """Narrow a CLI config's taskset field to the selected plugin config."""
78
+ if not taskset_id:
79
+ return base
80
+ taskset_type = vf.taskset_config_type(taskset_id)
81
+ return create_model(
82
+ base.__name__,
83
+ __base__=base,
84
+ taskset=(taskset_type, taskset_type(id=taskset_id)),
85
+ )
86
+
87
+
88
+ def narrow_config(base: type[ConfigT], argv: list[str]) -> type[ConfigT]:
72
89
  """`base` with its `env` field narrowed to the config class of the env the CLI
73
90
  names (`--env.id`, else the taskset's own env, else the single-agent env),
74
91
  including its `taskset` sub-field. Ids a config file may set are left to the
@@ -81,18 +98,10 @@ def narrow_config(base: type, argv: list[str]) -> type:
81
98
  env_type = vf.env_config_type(taskset_id, env_id)
82
99
  if taskset_id:
83
100
  # Nested narrowing: `--env.taskset.<knob>` parses typed and renders in -h.
84
- taskset_type = vf.taskset_config_type(taskset_id)
85
- env_type = type(
86
- env_type.__name__,
87
- (env_type,),
88
- {
89
- "__annotations__": {"taskset": taskset_type},
90
- "taskset": taskset_type(id=taskset_id),
91
- },
92
- )
101
+ env_type = narrow_taskset_config(env_type, taskset_id)
93
102
  default = env_type(id=env_id) if env_id else env_type()
94
- return type(
103
+ return create_model(
95
104
  base.__name__,
96
- (base,),
97
- {"__annotations__": {"env": env_type}, "env": default},
105
+ __base__=base,
106
+ env=(env_type, default),
98
107
  )
@@ -14,6 +14,7 @@ import verifiers.v1 as vf
14
14
  from verifiers.v1.cli.dashboard import TaskProgress, validate_dashboard
15
15
  from verifiers.v1.cli.resolve import (
16
16
  extract_id,
17
+ narrow_taskset_config,
17
18
  plugin_errors,
18
19
  references_config_file,
19
20
  with_positional_taskset,
@@ -41,15 +42,7 @@ def _narrow(argv: list[str]) -> type[ValidateConfig]:
41
42
  """`ValidateConfig` with `taskset` narrowed to the config type of the id on the CLI — so
42
43
  the single `cli()` parse stays typed and `-h` renders the taskset's fields. Absent an id
43
44
  (a `@ file.toml` may carry it) the base type is left for the validator to resolve."""
44
- taskset_id = extract_id(argv, "taskset")
45
- if not taskset_id:
46
- return ValidateConfig
47
- ftype = vf.taskset_config_type(taskset_id)
48
- return type(
49
- ValidateConfig.__name__,
50
- (ValidateConfig,),
51
- {"__annotations__": {"taskset": ftype}, "taskset": ftype(id=taskset_id)},
52
- )
45
+ return narrow_taskset_config(ValidateConfig, extract_id(argv, "taskset"))
53
46
 
54
47
 
55
48
  ResultRow = dict[str, Any]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: verifiers
3
- Version: 0.2.2.dev47
3
+ Version: 0.2.2.dev48
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
@@ -191,14 +191,14 @@ verifiers/v1/types.py,sha256=5tZyG4r4bLJ9a14oybHy7bSCpt5X5A17eRwmIszuRo8,9118
191
191
  verifiers/v1/acp/__init__.py,sha256=9dwH6fLopNndRmcpRSYC8ghzzMquaLfgh645QM-Dwic,2189
192
192
  verifiers/v1/acp/_runner.py,sha256=FqEnHR0Q_YrCt_EuaJqiqTpd2_kFa41FqcEunwOhvTI,6856
193
193
  verifiers/v1/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
194
- verifiers/v1/cli/debug.py,sha256=mbXOZAvd5ESkLjDECk1Er_s7wi82Dbr-kbcnpZ4D1qg,11424
194
+ verifiers/v1/cli/debug.py,sha256=Qyzhp0HOZoenGgKLQGEvEajwYmhEU4biaPxafL3roSg,11225
195
195
  verifiers/v1/cli/gepa.py,sha256=hLIbS_4jBx0vvy4PXoePR5riFXcNvzQCMixZ-g2OR_U,4026
196
196
  verifiers/v1/cli/init.py,sha256=dVpX1YMz7DFmHgskAsPjP-HmVTGoZfC0ZUyE-T4I6l0,8322
197
197
  verifiers/v1/cli/output.py,sha256=pMS5Z0EBgyAVShNCAk9jVURNeLOaTfeRWpt0J8hHjq8,5890
198
- verifiers/v1/cli/replay.py,sha256=T4sg-MpvT9niymEJl0Y2TijgTy-tVQqjT1lQ3nwuOg8,10314
199
- verifiers/v1/cli/resolve.py,sha256=1sV4z04v_HEs86Oi8ODJqfujXjrbShbu3u2kDpgpj94,4079
198
+ verifiers/v1/cli/replay.py,sha256=KnHgbhlrrWDqTq-7FKq4W6U9FiddXRjujK3_XIT_FnQ,10180
199
+ verifiers/v1/cli/resolve.py,sha256=OsNw4C3r9xOVFa-mminJFcex_bAsJ6EQ8K7A_H8u2kQ,4370
200
200
  verifiers/v1/cli/serve.py,sha256=_mdJaHVVe4pXzcpAot0ugcmiN3ra2gS4GrGmLghnX5M,2866
201
- verifiers/v1/cli/validate.py,sha256=PMWRSZROiTh2KFzkA3Ez5-z09krVk2ZUTkFNMUqk2-4,9671
201
+ verifiers/v1/cli/validate.py,sha256=zJL0r7zR_IPdc-jb0ZdPR42n7krXBhyrTh3BIczzwTU,9466
202
202
  verifiers/v1/cli/dashboard/__init__.py,sha256=v-baMxQuWxOCsbU7-p_jj2Q9BUnTN-TWi1q2hK6rU2s,198
203
203
  verifiers/v1/cli/dashboard/base.py,sha256=kUP93zJSIVLptSbnWX6MOy8kGg63fpeAzPqakCpPyDc,3547
204
204
  verifiers/v1/cli/dashboard/eval.py,sha256=lPrP7Ikmz3r7v3ury2yAMLgYeweVGFdg0ZKSQ6lwwKU,34355
@@ -329,8 +329,8 @@ verifiers/v1/utils/logging.py,sha256=OcMHA6NsYux3oIzjPuI95rDWmFBHNcHDjZeNIhXTX-Y
329
329
  verifiers/v1/utils/memory.py,sha256=ZkIvGk6uITAH5sKon65LifKPbvZr8mJ__PVc23FZpOQ,1835
330
330
  verifiers/v1/utils/sampling.py,sha256=JczGzBn6s3wsIrSY2Hy3hE8m6NreNgsNzhSjDikQqX0,1037
331
331
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
332
- verifiers-0.2.2.dev47.dist-info/METADATA,sha256=nTyUOf7IYoOyomIyJerWGt0HPDzT_xGMjdqVmJAC4_U,4545
333
- verifiers-0.2.2.dev47.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
334
- verifiers-0.2.2.dev47.dist-info/entry_points.txt,sha256=dF82JUYEFslR1AOW8LZfuBWeZeQoyX4wCRrduklg8-I,551
335
- verifiers-0.2.2.dev47.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
336
- verifiers-0.2.2.dev47.dist-info/RECORD,,
332
+ verifiers-0.2.2.dev48.dist-info/METADATA,sha256=86hWhcBF32XB4SS2s2ZC0pIOl_MT217syBs-74TMe7o,4545
333
+ verifiers-0.2.2.dev48.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
334
+ verifiers-0.2.2.dev48.dist-info/entry_points.txt,sha256=dF82JUYEFslR1AOW8LZfuBWeZeQoyX4wCRrduklg8-I,551
335
+ verifiers-0.2.2.dev48.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
336
+ verifiers-0.2.2.dev48.dist-info/RECORD,,