Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,28 +537,46 @@ and the call index). This format stays within the 40-character OpenAI Chat
Completions maximum and the `[a-zA-Z0-9_-]+` character set accepted across Chat
Completions, Responses, and Messages, keeping synthesized identifiers distinct
across calls, choices, requests, server restarts, and hosts. Tool arguments are
JSON objects, bounded to 8 MiB. The model parsers buffer tool envelopes until
they are complete, so argument events do not imply incremental generation of an
unfinished call. Truncated tool envelopes are omitted and the response reports
its output limit. At natural completion, tagged tool parsers accept a non-strict
call whose inner arguments are structurally complete and self-delimited when
only its closing wrapper tag is omitted; undecided openers, bare headers
without a closing argument delimiter, unclosed arguments, trailing text, and
unclosed strict calls remain errors.
JSON objects, bounded to 8 MiB. A DeepSeek DSML call is announced once its name
is complete, and a function call's argument text is published while the model
writes it, so concatenating the argument fragments of a function call
reproduces its stored arguments byte for byte. A custom tool call publishes its
input once its arguments are accepted, because the client's text is the input
inside the argument object rather than the object itself. The tagged tool
parsers publish a call only when its envelope is complete. An announced call cut
off before completion is omitted from a buffered response for every termination
other than natural end-of-sequence, and a response that completes reports the
termination's finish reason; only an output-limit termination reports the
output limit. On the Responses wire the closing frame of such an item reports
status `incomplete`, and a truncated custom call's item carries an empty input
because its arguments never formed. When the omitted call leaves no completed
call, a `required` or named `tool_choice` fails the response instead, producing
HTTP 500 for buffered requests or a terminal error event for streams. A client
that received fragments of such a call has already seen a call that cannot
complete. At natural completion, tagged tool parsers accept a
non-strict call whose inner arguments are structurally complete and
self-delimited when only its closing wrapper tag is omitted; undecided openers,
bare headers without a closing argument delimiter, unclosed arguments, trailing
text, and unclosed strict calls remain errors.

DeepSeek reasoning and both DSML tool syntaxes use the pinned official
`deepseek-recipe` state machine. Helios adapts its actions into the same neutral
events, validates nonempty tool names and JSON objects with nonempty, unique
argument names, and publishes each call when its arguments complete. A parameter
events and validates nonempty tool names and JSON objects with nonempty, unique
argument names. A call ends after its argument object validates. A
`string="false"` value stays private until the parser decides whether to retain
it as text, so published fragments never change. A parameter
tag that closes before its string attribute is discarded, so the following
well-formed parameter is parsed normally. A parameter marked `string="false"`
keeps its JSON type if its text decodes as one value
inside the argument object. If decoding fails, Helios retains the original
text as a JSON string. This includes valid JSON exceeding 126 levels of array
or object nesting within the parameter. The combined size of the UTF-8 tool
name and complete JSON argument object is limited to 1 MiB, including escapes
and delimiters. Helios rejects a larger call before publishing it. Closing the
outer calls block ends parsed output and discards subsequent generated text.
and delimiters. The bound is enforced on the append that crosses it, after the
call name and earlier argument fragments were published and are not retracted,
so an oversized call never completes and cannot appear in a buffered body.
Closing the outer calls block ends parsed output and discards subsequent
generated text.
The official parser owns markup recognition, including its tolerance of omitted
or partial tags. Structured answers become verbatim when ordinary answer content
begins, preserving scalar JSON, Lark output, and markup inside string values.
Expand Down
Loading