Expand description
Streaming DSML tool-call parser.
The model streams raw text tokens. This parser recognizes completed DSML
tool stanzas (<|DSML|tool_calls> … </|DSML|tool_calls|>) and keeps
a copy of the raw stanza for diagnostics. Inner tags tolerate the one
observed typo (a dropped leading |, e.g. <DSML|invoke ...>), matching
the tolerance the stanza opener already had; beyond that the parser stays
strict, so the actual tool parser stays small and predictable.
Port of the agent_dsml_* family from ds4_agent.c.
Structs§
- Dsml
Parser - Incremental parser for one DSML tool-call stanza.
- ToolArg
- One named argument of a parsed tool call.
- Tool
Call - A parsed tool invocation: tool name plus its arguments in stream order.
Enums§
- Dsml
State - Parser progress; terminal states are
DoneandError.
Constants§
- TOOL_
START_ SCAN_ HOLD - Bytes held back when re-scanning a stream for
find_tool_start: longer than the longest opening, so one split across future tokens is still seen from its first byte.
Functions§
- find_
tool_ start - Byte offset of the earliest complete tool-call stanza opening in
s, if any.