Skip to main content

Module stream

Module stream 

Source
Expand description

Streaming one assistant message from a provider.

Structs§

EventSender
The sending end of a provider stream. Sends after the receiver is gone are dropped.
EventStream
The receiving end of a provider stream.
ProviderResponse
A provider’s answer, before its body is read.
Request
Everything one provider request needs.
RequestHooks
What a session observes of its requests: pi-ai’s onPayload, onResponse and onProviderStreamEvent options, and pi’s transformHeaders.
StreamOptions
Request options shared by every wire API.
ThinkingBudgets
Overrides for budget-based thinking, in tokens.

Enums§

CacheRetention
How long the provider should keep the prompt cached.
StreamEvent
One step of a streamed response.
Transport

Traits§

Provider
A wire API: turns a model, a transcript and options into a streamed message.

Functions§

new_output
An empty assistant message for model, as providers start one.
now_ms
Unix time in milliseconds.
send_error
Ends a stream with an error: aborted when the request was cancelled.

Type Aliases§

Hook
A session’s callback into its requests.
RequestHeaders
Request headers. None removes a header the provider would send.