pub struct GenerateResponse {
pub content: Vec<ResponseContent>,
pub usage: Usage,
pub finish_reason: FinishReason,
pub metadata: Option<Value>,
pub warnings: Option<Vec<ResponseWarning>>,
}Expand description
Response from a generation request
Fields§
§content: Vec<ResponseContent>Generated content
usage: UsageToken usage statistics
finish_reason: FinishReasonWhy generation finished
metadata: Option<Value>Provider-specific metadata as raw JSON
warnings: Option<Vec<ResponseWarning>>Warnings generated during request processing (e.g., cache validation)
Implementations§
Source§impl GenerateResponse
impl GenerateResponse
Sourcepub fn reasoning(&self) -> Option<String>
pub fn reasoning(&self) -> Option<String>
Get the reasoning content from the response (extended thinking for Anthropic, reasoning for OpenAI)
Sourcepub fn tool_calls(&self) -> Vec<&ToolCall>
pub fn tool_calls(&self) -> Vec<&ToolCall>
Get all tool calls from the response
Sourcepub fn has_warnings(&self) -> bool
pub fn has_warnings(&self) -> bool
Check if there are any warnings
Sourcepub fn warnings(&self) -> &[ResponseWarning]
pub fn warnings(&self) -> &[ResponseWarning]
Get warnings as a slice
Trait Implementations§
Source§impl Clone for GenerateResponse
impl Clone for GenerateResponse
Source§fn clone(&self) -> GenerateResponse
fn clone(&self) -> GenerateResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GenerateResponse
impl Debug for GenerateResponse
Source§impl<'de> Deserialize<'de> for GenerateResponse
impl<'de> Deserialize<'de> for GenerateResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GenerateResponse
impl RefUnwindSafe for GenerateResponse
impl Send for GenerateResponse
impl Sync for GenerateResponse
impl Unpin for GenerateResponse
impl UnsafeUnpin for GenerateResponse
impl UnwindSafe for GenerateResponse
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