Skip to main content

Module streaming

Module streaming 

Source
Expand description

This module provides functionality for working with streaming completion models. It provides traits and types for generating streaming completion requests and handling streaming completion responses.

Provider implementations use these types to expose raw streamed completion events without depending on a runtime.

Structs§

PauseControl
Control for pausing and resuming a streaming response
RawStreamingToolCall
Describes a streaming tool call response (in its entirety)
StreamFinal
The provider’s terminal stream record, normalized.
StreamPartId
Opaque accumulation key of one streamed part.
StreamingCompletionResponse
The response from a streaming completion request; message and response are populated at the end of the inner stream.
SyntheticIds
Fabricated per-stream keys for wires that carry none.
ToolCallDecoration
Decoration a provider attaches to a streamed tool call that is still assembling, matched by its established provider id (e.g. OpenRouter encrypted reasoning details). Carried onto the completed call by the adapter’s end event.
ToolInputEnd
End of a streamed tool call’s input: the signal for the shared assembler (RawStreamingChoice::ToolInputEnd) to finalize the call.
UnknownPayload
An unmodeled wire payload on the raw passthrough channel.
WireId
The durable provider handle: an identifier the provider actually issued, ready for the replayable message types and request payloads.

Enums§

MintKind
What kind of part a minted identity was fabricated for.
RawStreamingChoice
Enum representing a streaming chunk from the model.
StreamFinalKind
Discriminant for StreamFinal.
StreamedAssistantContent
Describes responses from a streamed provider response which is either text, a tool call or a final usage response.
StreamedUserContent
Streamed user content. This content is primarily used to represent tool results from tool calls made during a multi-turn/step agent prompt.
ToolCallDeltaContent
The content of a tool call delta - either the tool name or argument data
UnparseableToolInput
How the shared assembler treats an argument payload that does not parse as JSON when a streamed tool call’s input ends.

Functions§

normalize_stream
Normalize the terminal record of a provider-native stream.

Type Aliases§

RawStreamingResultNot (target_os=unknown and WebAssembly)
Provider stream whose terminal record is the provider-native R, on native targets.
StreamingResult
Normalized provider stream, as consumed by StreamingCompletionResponse.