pub struct ChatResponse {
pub content: Vec<ContentBlock>,
pub tool_calls: Vec<ToolCall>,
pub usage: TokenUsage,
pub raw: Value,
}Expand description
统一的聊天响应。
Fields§
§content: Vec<ContentBlock>响应内容块列表,与 Message::Assistant 的 content 类型对齐。
tool_calls: Vec<ToolCall>冗余缓存,从 content 中提取的 tool_calls,方便访问。
usage: TokenUsage§raw: ValueImplementations§
Source§impl ChatResponse
impl ChatResponse
Sourcepub fn new(content: Vec<ContentBlock>, usage: TokenUsage, raw: Value) -> Self
pub fn new(content: Vec<ContentBlock>, usage: TokenUsage, raw: Value) -> Self
构造函数 — 自动从 content 中提取 tool_calls
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 (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 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 UnsafeUnpin 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