pub struct ChatResponse {
pub id: String,
pub object: String,
pub created: u64,
pub model: String,
pub choices: Vec<Choice>,
pub usage: Option<Usage>,
pub system_fingerprint: Option<String>,
}Expand description
Chat completion response.
Contains the generated response, metadata, and usage statistics.
§Example
let response = ChatResponse {
id: "chatcmpl-123".to_string(),
object: "chat.completion".to_string(),
created: 1677652288,
model: "gpt-4".to_string(),
choices: vec![Choice { /* ... */ }],
usage: Some(Usage { /* ... */ }),
system_fingerprint: Some("fp_44709d6fcb".to_string()),
};Fields§
§id: StringUnique identifier for the completion
object: StringObject type (always “chat.completion”)
created: u64Unix timestamp of creation
model: StringModel used for completion
choices: Vec<Choice>Generated completions
usage: Option<Usage>Token usage statistics
system_fingerprint: Option<String>System fingerprint for model version
Trait Implementations§
Source§impl Clone for ChatResponse
impl Clone for ChatResponse
Source§fn clone(&self) -> ChatResponse
fn clone(&self) -> ChatResponse
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 ChatResponse
impl Debug for ChatResponse
Source§impl<'de> Deserialize<'de> for ChatResponse
impl<'de> Deserialize<'de> for ChatResponse
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 ChatResponse
impl RefUnwindSafe for ChatResponse
impl Send for ChatResponse
impl Sync for ChatResponse
impl Unpin for ChatResponse
impl UnwindSafe for ChatResponse
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