pub struct ResponseMetadata {
pub id: Option<String>,
pub timestamp: Option<DateTime<Utc>>,
pub model_id: Option<ModelId>,
pub headers: Option<Headers>,
pub body: Option<JsonValue>,
}Expand description
Metadata about the provider response.
Every field is optional because it may be unknown at the point where the metadata is created (for example headers-only metadata at stream start).
Fields§
§id: Option<String>Provider response id.
timestamp: Option<DateTime<Utc>>Response timestamp.
model_id: Option<ModelId>Model that produced the response (may differ from the requested id).
headers: Option<Headers>Response headers.
body: Option<JsonValue>Raw response body (non-streaming calls).
Implementations§
Source§impl ResponseMetadata
impl ResponseMetadata
Sourcepub fn with_headers(headers: Headers) -> Self
pub fn with_headers(headers: Headers) -> Self
Creates metadata that only carries headers.
Sourcepub fn new(timestamp: DateTime<Utc>, model_id: impl Into<ModelId>) -> Self
pub fn new(timestamp: DateTime<Utc>, model_id: impl Into<ModelId>) -> Self
Creates metadata with timestamp and model id, as required by non-text modalities.
Sourcepub fn merge(&mut self, other: ResponseMetadata)
pub fn merge(&mut self, other: ResponseMetadata)
Overlays fields that are Some in other onto self.
Trait Implementations§
Source§impl Clone for ResponseMetadata
impl Clone for ResponseMetadata
Source§fn clone(&self) -> ResponseMetadata
fn clone(&self) -> ResponseMetadata
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 ResponseMetadata
impl Debug for ResponseMetadata
Source§impl Default for ResponseMetadata
impl Default for ResponseMetadata
Source§fn default() -> ResponseMetadata
fn default() -> ResponseMetadata
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ResponseMetadata
impl<'de> Deserialize<'de> for ResponseMetadata
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 ResponseMetadata
impl PartialEq for ResponseMetadata
Source§impl Serialize for ResponseMetadata
impl Serialize for ResponseMetadata
impl StructuralPartialEq for ResponseMetadata
Auto Trait Implementations§
impl Freeze for ResponseMetadata
impl RefUnwindSafe for ResponseMetadata
impl Send for ResponseMetadata
impl Sync for ResponseMetadata
impl Unpin for ResponseMetadata
impl UnsafeUnpin for ResponseMetadata
impl UnwindSafe for ResponseMetadata
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