Expand description
The Azure Responses API wire types: what a request carries and what a streamed response deserializes into.
Structs§
- AISearch
Output - Incomplete
Reason - Why a response is incomplete, e.g.
max_output_tokensorcontent_filter. - Input
Tokens Details - How much of the input was served from Azure’s prompt cache. The only way to tell whether the prompt prefix is actually stable, since a perturbed prefix fails silently by costing more.
- LLMRequest
- LLMRequest
Response Format Param - Mistral
Params - Mistral’s request parameters are not decided yet; this field exists only so
LLMRequestParams::Mistralhas a shape of its own to serialize and deserialize as, distinct from the other two variants. - NonThinking
Params - Output
Tokens Details - How much of the output was thinking, which is what moves when the reasoning context widens or narrows.
- Reasoning
- Reasoning
Output - Request
Text Options - Response
- Response received from LLM API
- Response
Error - Error object returned by the LLM API on a failed response. Fields are optional so any error shape deserializes rather than crashing the stream parser.
- Response
Output - One line of the Azure event stream. Which fields are set depends on
response_type: a text delta, a completed item, a whole response, or an error. - Response
Reasoning - The reasoning settings a response reports back, as opposed to the ones the request asked for.
- Thinking
Params - Usage
- What the request was billed for. Optional throughout: Azure reports the cache fields only on
some deployment types, and PTU-M never reports
cache_write_tokensat all.
Enums§
- Input
Item - LLMRequest
Params - Each variant’s own struct rejects a field belonging to another, which is what tells them apart on the way back in: untagged tries them in order and they otherwise all match any object.
- LLMTool
Choice - Output
Item - Reasoning
Context - How far back the model reuses its own reasoning.
- Received
Output Item - An output item as it arrived, which is not necessarily one this code knows.
- Summary
Type - Untagged would serialize these unit variants as
null, which asks Azure for no summary at all.
Functions§
- azure_
stream_ 🔒error - Builds the error the stream parsers raise when Azure reports a failure on the line they are
reading, attaching
erras the error’s Azure source. - check_
response_ 🔒complete - Errors once a response has finished streaming if it stopped short of a complete one, whether
outputnames the reason or the caller only knows aresponse.incompleteevent fired with none. - check_
response_ 🔒output - Logs
output’s usage undercontext, then errors if it reports a failure — the two checks both stream parsers make on every line, before either looks at its own content. - log_
response_ 🔒usage - Logs the usage a response line carries, if any, under
context. - reported_
azure_ 🔒error - The error Azure reported on this line, if any: the one nested under
responsewhen a response object came with it, otherwise the top-level one.fallback_response_idis used only for the latter, since the former carries its own response id. - reported_
incomplete_ 🔒reason - Why the response this line carries is incomplete, if it says so. A response that stopped short still streams as if it had finished, so this is the only thing that tells the two apart.
- urls_
that_ 🔒parse - The search results whose url this code can actually fetch. One unparseable entry must not drop every other citation from the same search.