v0.5.0
[0.5.0] - 2026-05-16
Tool-call exact-replay scaffolding for downstream HTTP front ends.
Models loaded with tool_call_markers produce structured boundary
messages on the streaming wire so a caller can capture the exact
bytes the model sampled, store them under a tool id, and splice
them back verbatim on later turns to keep the KV-cache prefix
match working. Companion primitives expose explicit suffix replay
and sticky per-session seq_id pinning.
Added
tool_call_markers => #{start, end, payload_start (optional), payload_end (optional)}onerllama:load_model/2Config. Each
binary is tokenised through the model's own vocabulary at load
time; multi-token markers are supported. Omitting the key keeps
the backend on the existing path (#39, #42).- Streaming wire on
infer/4gains
{erllama_token, Ref, {tool_call_delta, Bin}}per chunk and a
single{erllama_tool_call_end, Ref, Full :: binary()}per
span, withFullcarrying every emitted delta concatenated so
the downstream's exact-replay map stores them verbatim without
re-buffering (#39). erllama:prefill_only/3acceptingOptswithparent_key.
When passed a prior turn'sfinish_key, the call warm-restores
from that row and prefills only the new suffix before firing the
finish save — useful for chaining cache-warming calls across
turns (#40).session_id => term()oninfer/4Params and
complete/3/prefill_only/3Opts. Pins the underlying seq_id
to that session across requests so the next turn whose prompt
continues the stored tokens truncates-and-prefills in place on
the already-live KV cells (cache_hit_kind => sticky).
Concurrent admits on the samesession_idreturn{error, sticky_busy}. Release witherllama:end_session/2(#41).- Per-request greedy sampler swap on tool-call syntax tokens.
Models withtool_call_markersbuild a second sampler chain
(temperature => 0) at admission; the scheduler routes syntax
tokens through it so a tool call is byte-deterministic from a
fixed prefix. Optional payload markers flip back to the request's
normal sampler for caller-supplied string contents so they stay
diverse (#42).
Changed
step_result()onerllama_model_backendgains four variants
({tool_call_token, _},tool_call_end,{tool_call_payload_open, _},{tool_call_payload_close, _}). Backends without
tool-call markers emit none of them.erllama_model_stubphase machine re-keyed from sampler ref onto
seq_id so mid-request sampler swaps (the new greedy-on-syntax
path) don't reset state across ticks.seq_rmnow cleans the
per-seq phase entry.