ChatResponse

Trait ChatResponse 

Source
pub trait ChatResponse: Send + Sync {
    // Required methods
    fn content(&self) -> String;
    fn usage(&self) -> Option<Usage>;
    fn finish_reason(&self) -> Option<FinishReason>;
    fn metadata(&self) -> Metadata;

    // Provided methods
    fn tool_calls(&self) -> Option<Vec<ToolCall>> { ... }
    fn as_message(&self) -> Message { ... }
}
Expand description

Trait for chat response types.

Required Methods§

Source

fn content(&self) -> String

Get the text content of the response

Source

fn usage(&self) -> Option<Usage>

Get usage statistics if available

Source

fn finish_reason(&self) -> Option<FinishReason>

Get the reason why generation finished

Source

fn metadata(&self) -> Metadata

Get response metadata

Provided Methods§

Source

fn tool_calls(&self) -> Option<Vec<ToolCall>>

Get tool calls if any were made

Source

fn as_message(&self) -> Message

Convert response to a Message for conversation history

Implementors§