Trinity's tokenizer has no <tool_call> special token, so token-id based
parsers never detect calls. Adds a reasoning- and Markdown-aware
text-level parser selected with tool_parser = "hermes".
* feat(sft): opt-in final stop token in build_training_sample
Templates like GLM close assistant turns with the next message's role marker, leaving a final assistant turn with no stop supervision; ensure_final_stop appends the canonical stop as a trainable target while remaining a no-op for in-message closes.
* feat(renderers): support PrimeIntellect Qwen3 templates
Mirror the custom template with exact token attribution so PrimeIntellect Qwen3 models can use typed rendering instead of the metadata-free fallback.
Splice the base64 kept-set ids out of the raw response bytes before
json.loads (same fast path as routed_experts) and surface the
{ids, counts} payload on the generate() result dict for sampling-mask
replay training.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(parsing): don't parse in-<think> tool calls as real calls
Reasoning models (Qwen3-*-Thinking, Kimi-K2.5, R1-distill via the
DeepSeek-V3 renderer) routinely draft tool-call syntax *inside* their
<think>...</think> trace while planning. The qwen3, deepseek_v3, and
kimi_k2.5 parsers scanned the whole completion for tool-call delimiters
and only extracted reasoning afterward, so those in-think drafts were
mis-parsed. Symptoms differed by format but all corrupt the tool result:
- qwen3 / qwen3_vl: emits the draft *and* the real call -> phantom
duplicate (the reported #78 case; same code executed twice).
- kimi_k2.5: the in-think section trips the "truncated reasoning" guard
and *all* tool calls are dropped (returns zero).
- deepseek_v3: returns the *wrong* call (the draft) and loses reasoning.
Fix: extract reasoning first, then scan for tool calls only in the
post-</think> region — mirroring vLLM's DelegatingParser (reasoning
parser runs before the tool parser). Where </think> is a single special
token (Qwen3) we anchor on its id; where it's multi-token / context-
sensitive text (DeepSeek-V3, Kimi-K2.5) we locate the boundary by
decoding. content_ids still starts at 0 so reasoning extraction is
unchanged, and genuine parallel calls after </think> are preserved.
Audited all parsers: qwen3.5/glm/minimax/laguna/nemotron3 already strip
reasoning first; gpt_oss (channel-segregated) and llama_3 (no reasoning)
are safe; kimi_k2 (K2-Instruct) has no thinking path so is unaffected.
Validated against real Qwen3, Kimi-K2.5 and DeepSeek-V3 tokenizers.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* style: ruff format
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
renderers already had exclude-newer = "7 days" with a per-package
exemption for fastokens. This PR splits the inline table into a
[tool.uv.exclude-newer-package] section and adds the only other
PrimeIntellect-published package in renderers' dep closure:
prime-pydantic-config.
Only packages in this project's `uv tree` are exempted — the resolver
ignores entries for packages it never sees.
Pins `required-version = ">=0.11.1"` so older uvs fail loudly instead
of silently parsing "7 days" as an RFC 3339 date and proceeding
*without* the cooldown — see uv#17908.
Part 1 of 3 in a coordinated supply-chain hardening across PI repos.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds .github/workflows/publish-dev.yml which, on every push to main, tags
the commit as ``renderers-v<next-patch>.dev<commits-since-release>`` and
publishes the resulting wheel to PyPI as a pre-release. Build runs from
the freshly-created tag so hatch-vcs produces a clean PEP 440 version
without the ``+gHASH`` local segment PyPI rejects.
Mirrors the build/publish split from publish.yml so OIDC stays scoped to
the publish job only.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>