ai.clients.StreamRelay
Pulls one selected stream through a reliability policy. A typed, safely retryable failure may replace the selected stream only before the first text delta has been returned. Once any delta is visible, every later failure is terminal: replaying would duplicate a prefix and there is no resumable-stream contract at the client boundary.
Reference version
Signature
class ai.clients.StreamRelayPulls one selected stream through a reliability policy. A typed, safely retryable failure may replace the selected stream only before the first text delta has been returned. Once any delta is visible, every later failure is terminal: replaying would duplicate a prefix and there is no resumable-stream contract at the client boundary.
Source:<builtin>/ai/ns_clients/clients.bamlbytes 20991–26292
Fields
open
() -> ai.stream.TurnStream throws ai.errors.InvokeErrorretry
(ai.errors.Failure) -> bool throws ai.errors.InvokeErrorcurrent
ai.stream.TurnStream | nullemitted
boolpending_text
string[]pending_cursor
intterminal
terminal_cursor
intfinished
boolcalls
Instance methods
function
close_current
(self) -> voidfunction
next_event
(self
) -> ai.stream.Event | ai.stream.Done throws baml.errors.Timeout | baml.errors.UnknownError | reflect.errors.CompilationError | ai.errors.Failure
function
recover
(self,
error: ai.errors.RaisedInClient
) -> void throws baml.errors.Timeout | baml.errors.UnknownError | reflect.errors.CompilationError | ai.errors.Failure