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§
Sourcefn finish_reason(&self) -> Option<FinishReason>
fn finish_reason(&self) -> Option<FinishReason>
Get the reason why generation finished
Provided Methods§
Sourcefn tool_calls(&self) -> Option<Vec<ToolCall>>
fn tool_calls(&self) -> Option<Vec<ToolCall>>
Get tool calls if any were made
Sourcefn as_message(&self) -> Message
fn as_message(&self) -> Message
Convert response to a Message for conversation history