Skip to main content

Module dsml

Module dsml 

Source
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§

DsmlParser
Incremental parser for one DSML tool-call stanza.
ToolArg
One named argument of a parsed tool call.
ToolCall
A parsed tool invocation: tool name plus its arguments in stream order.

Enums§

DsmlState
Parser progress; terminal states are Done and Error.

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.