pub struct ChatResponse {
pub id: String,
pub object: String,
pub created: u64,
pub model: String,
pub choices: Vec<Choice>,
pub content: String,
pub reasoning_content: Option<String>,
pub usage: Option<Usage>,
pub system_fingerprint: Option<String>,
}Expand description
Chat completion response
Fields§
§id: StringA unique identifier for the chat completion.
object: StringObject type (always “chat.completion”)
created: u64Unix timestamp of creation
model: StringModel used for the completion
choices: Vec<Choice>List of completion choices
content: StringConvenience field: first choice content
Extracted from choices[0].message.content if present
reasoning_content: Option<String>Reasoning content (for reasoning models like DeepSeek Reasoner)
Extracted from choices[0].message.reasoning_content if present
usage: Option<Usage>Usage statistics
system_fingerprint: Option<String>System fingerprint
Implementations§
Source§impl ChatResponse
impl ChatResponse
Sourcepub fn prompt_tokens(&self) -> u32
pub fn prompt_tokens(&self) -> u32
Convenience: prompt tokens or 0
Sourcepub fn completion_tokens(&self) -> u32
pub fn completion_tokens(&self) -> u32
Convenience: completion tokens or 0
Sourcepub fn total_tokens(&self) -> u32
pub fn total_tokens(&self) -> u32
Convenience: total tokens or 0
Sourcepub fn get_usage_safe(&self) -> (u32, u32, u32)
pub fn get_usage_safe(&self) -> (u32, u32, u32)
Convenience: get usage safely as a tuple (prompt, completion, total)
Sourcepub fn get_content(&self) -> Option<&str>
pub fn get_content(&self) -> Option<&str>
Convenience: get first choice content as Option<&str>
Returns None if the convenience content field is empty
Sourcepub fn populate_reasoning_synonyms(&mut self, raw: &Value)
pub fn populate_reasoning_synonyms(&mut self, raw: &Value)
Provider-agnostic post-processor: populate reasoning synonyms into messages
Trait Implementations§
Source§impl Clone for ChatResponse
impl Clone for ChatResponse
Source§fn clone(&self) -> ChatResponse
fn clone(&self) -> ChatResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more