pub struct ModelResponse {
pub id: Option<String>,
pub model: ModelRef,
pub content: Vec<ContentPart>,
pub finish_reason: FinishReason,
pub usage: ModelUsage,
pub warnings: Vec<ModelWarning>,
pub provider_metadata: BTreeMap<String, Value>,
pub provider_events: Vec<ProviderData>,
}Expand description
A complete canonical model response.
Fields§
§id: Option<String>Provider response identity.
model: ModelRefActual model that produced the response.
content: Vec<ContentPart>Ordered output content.
finish_reason: FinishReasonNormalized terminal reason.
usage: ModelUsageDetailed model usage.
warnings: Vec<ModelWarning>Explicit degradation and compatibility warnings.
provider_metadata: BTreeMap<String, Value>Namespaced response metadata.
provider_events: Vec<ProviderData>Provider stream events retained without normalization.
Implementations§
Source§impl ModelResponse
impl ModelResponse
Sourcepub fn structured<T>(&self) -> Result<T, StructuredOutputError>where
T: DeserializeOwned,
pub fn structured<T>(&self) -> Result<T, StructuredOutputError>where
T: DeserializeOwned,
Decodes ordered textual output into a Rust type.
Reasoning, citations, and opaque provider metadata are deliberately not mixed into the JSON body. An explicit refusal fails closed.
§Errors
Returns StructuredOutputError when text is absent, the model
refused, or the assembled JSON does not deserialize as T.
Trait Implementations§
Source§impl Clone for ModelResponse
impl Clone for ModelResponse
Source§fn clone(&self) -> ModelResponse
fn clone(&self) -> ModelResponse
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 ModelResponse
impl Debug for ModelResponse
Source§impl<'de> Deserialize<'de> for ModelResponse
impl<'de> Deserialize<'de> for ModelResponse
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
Source§impl PartialEq for ModelResponse
impl PartialEq for ModelResponse
Source§impl Serialize for ModelResponse
impl Serialize for ModelResponse
impl StructuralPartialEq for ModelResponse
Auto Trait Implementations§
impl Freeze for ModelResponse
impl RefUnwindSafe for ModelResponse
impl Send for ModelResponse
impl Sync for ModelResponse
impl Unpin for ModelResponse
impl UnsafeUnpin for ModelResponse
impl UnwindSafe for ModelResponse
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