pub struct ChatResponseWriter { /* private fields */ }Expand description
The sending side of a ChatResponseHandle,
held by the Python bridge thread that drives the SDK’s async iterator.
Implementations§
Source§impl ChatResponseWriter
impl ChatResponseWriter
Sourcepub async fn send_thought(&self, thought: String) -> Result<(), WriterError>
pub async fn send_thought(&self, thought: String) -> Result<(), WriterError>
Sourcepub async fn send_tool_call(
&self,
event: ToolCallEvent,
) -> Result<(), WriterError>
pub async fn send_tool_call( &self, event: ToolCallEvent, ) -> Result<(), WriterError>
Sourcepub async fn send_error(&self, error: StreamError) -> Result<(), WriterError>
pub async fn send_error(&self, error: StreamError) -> Result<(), WriterError>
Sourcepub async fn send_event(&self, event: ResponseEvent) -> Result<(), WriterError>
pub async fn send_event(&self, event: ResponseEvent) -> Result<(), WriterError>
Sourcepub async fn send_chunk(&self, chunk: StreamChunk) -> Result<(), WriterError>
pub async fn send_chunk(&self, chunk: StreamChunk) -> Result<(), WriterError>
Sourcepub fn set_usage(&self, usage: UsageMetadata)
pub fn set_usage(&self, usage: UsageMetadata)
Store usage metadata in the shared state so the handle can read it after the stream completes.
Sourcepub fn set_structured_output(&self, value: Value)
pub fn set_structured_output(&self, value: Value)
Store structured output in the shared state so the handle can read it after the stream completes.
Auto Trait Implementations§
impl Freeze for ChatResponseWriter
impl RefUnwindSafe for ChatResponseWriter
impl Send for ChatResponseWriter
impl Sync for ChatResponseWriter
impl Unpin for ChatResponseWriter
impl UnsafeUnpin for ChatResponseWriter
impl UnwindSafe for ChatResponseWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more