pub struct GenerateTextResponse {
pub options: LanguageModelOptions,
}Expand description
Response from a generate call on GenerateText.
Fields§
§options: LanguageModelOptionsThe options that generated this response
Implementations§
Source§impl GenerateTextResponse
impl GenerateTextResponse
Sourcepub fn into_schema<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
pub fn into_schema<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
Deserializes the response text into a structured type.
This method attempts to parse the generated text as JSON and deserialize it
into the specified type T. It requires that the response contains text content.
§Type Parameters
T- The type to deserialize into, which must implementDeserializeOwned.
§Returns
A result containing the deserialized value or a JSON error.
§Errors
Returns an error if there is no text response or if deserialization fails.
Methods from Deref<Target = LanguageModelOptions>§
Sourcepub fn step(&self, index: usize) -> Option<Step>
pub fn step(&self, index: usize) -> Option<Step>
Returns the step with the given index, if it exists.
Sourcepub fn content(&self) -> Option<&LanguageModelResponseContentType>
pub fn content(&self) -> Option<&LanguageModelResponseContentType>
Returns the content of the last assistant message, excluding reasoning.
Sourcepub fn tool_results(&self) -> Option<Vec<ToolResultInfo>>
pub fn tool_results(&self) -> Option<Vec<ToolResultInfo>>
Extracts all tool results from the conversation.
Sourcepub fn tool_calls(&self) -> Option<Vec<ToolCallInfo>>
pub fn tool_calls(&self) -> Option<Vec<ToolCallInfo>>
Extracts all tool calls from the conversation.
Sourcepub fn stop_reason(&self) -> Option<StopReason>
pub fn stop_reason(&self) -> Option<StopReason>
Returns the reason why generation stopped.
Trait Implementations§
Source§impl Clone for GenerateTextResponse
impl Clone for GenerateTextResponse
Source§fn clone(&self) -> GenerateTextResponse
fn clone(&self) -> GenerateTextResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 GenerateTextResponse
impl Debug for GenerateTextResponse
Source§impl Deref for GenerateTextResponse
impl Deref for GenerateTextResponse
Source§type Target = LanguageModelOptions
type Target = LanguageModelOptions
The resulting type after dereferencing.
Auto Trait Implementations§
impl !RefUnwindSafe for GenerateTextResponse
impl !UnwindSafe for GenerateTextResponse
impl Freeze for GenerateTextResponse
impl Send for GenerateTextResponse
impl Sync for GenerateTextResponse
impl Unpin for GenerateTextResponse
impl UnsafeUnpin for GenerateTextResponse
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