pub struct ChatCompletion {
pub content: Option<String>,
pub thinking: Option<String>,
pub redacted_thinking: Option<String>,
pub tool_calls: Vec<ToolCall>,
pub usage: Option<Usage>,
pub stop_reason: Option<StopReason>,
}Expand description
Chat completion response
Fields§
§content: Option<String>Text content (if any)
thinking: Option<String>Thinking content (for extended thinking models)
redacted_thinking: Option<String>Redacted thinking content
tool_calls: Vec<ToolCall>Tool calls (if any)
usage: Option<Usage>Token usage
stop_reason: Option<StopReason>Why the completion stopped
Implementations§
Source§impl ChatCompletion
impl ChatCompletion
pub fn text(content: impl Into<String>) -> Self
pub fn with_tool_calls(tool_calls: Vec<ToolCall>) -> Self
pub fn has_tool_calls(&self) -> bool
pub fn has_content(&self) -> bool
Trait Implementations§
Source§impl Clone for ChatCompletion
impl Clone for ChatCompletion
Source§fn clone(&self) -> ChatCompletion
fn clone(&self) -> ChatCompletion
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 moreAuto Trait Implementations§
impl Freeze for ChatCompletion
impl RefUnwindSafe for ChatCompletion
impl Send for ChatCompletion
impl Sync for ChatCompletion
impl Unpin for ChatCompletion
impl UnsafeUnpin for ChatCompletion
impl UnwindSafe for ChatCompletion
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