verifiers 0.4.2.dev50__py3-none-any.whl → 0.4.2.dev52__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.
@@ -204,6 +204,18 @@ def _is_valid_incremental_tail(messages: list[dict[str, Any]]) -> bool:
204
204
  )
205
205
 
206
206
 
207
+ def _previous_tool_call_ids(
208
+ messages: list[dict[str, Any]], tail_length: int
209
+ ) -> list[str] | None:
210
+ """IDs of the tool calls of the assistant message the tail extends, if it is one."""
211
+ index = len(messages) - tail_length - 1
212
+ if index < 0 or messages[index].get("role") != "assistant":
213
+ return None
214
+ return [
215
+ str(call.get("id") or "") for call in messages[index].get("tool_calls") or []
216
+ ]
217
+
218
+
207
219
  def _has_multimodal_content(messages) -> bool:
208
220
  for message in messages:
209
221
  content = getattr(message, "content", None)
@@ -413,6 +425,13 @@ class TrainClient(Client):
413
425
  f"{type(renderer).__name__} does not support process_multimodal=False"
414
426
  )
415
427
  render_kwargs = {} if process_multimodal else {"process_multimodal": False}
428
+ bridge_kwargs = dict(render_kwargs)
429
+ if getattr(renderer, "supports_previous_tool_call_ids", False):
430
+ # Templates that order tool results by the assistant's calls need the call
431
+ # IDs, which the sampled tokens do not carry.
432
+ bridge_kwargs["previous_tool_call_ids"] = _previous_tool_call_ids(
433
+ wire_messages, len(wire_tail)
434
+ )
416
435
  # Only build the O(context) previous token stream for a bridgeable tail.
417
436
  can_bridge = turn is not None and _is_valid_incremental_tail(wire_tail)
418
437
  previous_ids = turn.previous_renderer_token_ids() if can_bridge else None
@@ -425,7 +444,7 @@ class TrainClient(Client):
425
444
  previous_completion_ids,
426
445
  wire_tail,
427
446
  tools=wire_tools,
428
- **render_kwargs,
447
+ **bridge_kwargs,
429
448
  )
430
449
 
431
450
  bridged = await slot.run(bridge)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.4.2.dev50
3
+ Version: 0.4.2.dev52
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/base.py,sha256=C0G5lRm3nxt1xmPoA2cweBgCnN2KcLepmCYq1vdDrnU,
31
31
  verifiers/v1/clients/client.py,sha256=HT3aQiOyYYjvz_cKEXchtUSD07-4VehebWUJL9AyON8,3166
32
32
  verifiers/v1/clients/eval.py,sha256=GgpHZGh4IW3gC-tOZiFPp62MCL4aHik0b4afz2g3-Qo,8729
33
33
  verifiers/v1/clients/prompt_cache.py,sha256=shJhbTUwKwao6m3DsYDyHPWmhXSJJnXk3wYQhzXFsnY,11849
34
- verifiers/v1/clients/train.py,sha256=v1YCVNCEXw2FNQw4lpbLoq18u8TQeo9TnsYOoMWr4zE,20277
34
+ verifiers/v1/clients/train.py,sha256=L6XDRUbOxkhtN6nt3sGqeAiHTfqNYdXdQewY9tQ6f8k,21134
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=nFUI5oCih6L7by6M2l3wevghzpct8E_grmabT8lYWrA,6381
@@ -187,8 +187,8 @@ verifiers/v1/utils/scope.py,sha256=zbs4pj6AVk4jywlAJ3AX0Q0_kzB9dBB02nY-9H4ELdQ,8
187
187
  verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
188
188
  verifiers/v1/utils/trace_store.py,sha256=Qo9qvsJAl8PoRUavjQAfUB2VNxmUtYQtU2ejLKPzY9c,3382
189
189
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
190
- verifiers-0.4.2.dev50.dist-info/METADATA,sha256=X4oJujsg71TXcg1F9XRfFWuGHQXIqVpkePkfbexhqFA,5115
191
- verifiers-0.4.2.dev50.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
192
- verifiers-0.4.2.dev50.dist-info/entry_points.txt,sha256=qdMg7ajiFpDsHf7tuPMRclJXizu1J6LTWawS5YS0B0I,137
193
- verifiers-0.4.2.dev50.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
194
- verifiers-0.4.2.dev50.dist-info/RECORD,,
190
+ verifiers-0.4.2.dev52.dist-info/METADATA,sha256=I8RzXUZqDUo2PAQ1S81WJHu1bvkCFUjrIipd6nMOLgo,5115
191
+ verifiers-0.4.2.dev52.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
192
+ verifiers-0.4.2.dev52.dist-info/entry_points.txt,sha256=qdMg7ajiFpDsHf7tuPMRclJXizu1J6LTWawS5YS0B0I,137
193
+ verifiers-0.4.2.dev52.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
194
+ verifiers-0.4.2.dev52.dist-info/RECORD,,