pub struct AssistantContent {
pub text: Option<String>,
pub tool_calls: Vec<ToolCall>,
}Expand description
Content carried by an AgentMessage::Assistant turn.
A flat struct with optional text and a (possibly empty) tool_calls vec.
At the wire level, at least one of the two fields must be present — the
hand-rolled Deserialize impl (in super::messages_serde) enforces
this.
§Serde
Serializes/deserializes as a flat map so it can be #[serde(flatten)]-ed
directly into the parent AgentMessage object:
| State | JSON fields |
|---|---|
| text only | "content": "..." |
| tool calls only | "tool_calls": [...] |
| both | "content": "...", "tool_calls": [...] |
Custom Serialize and Deserialize impls are in
super::messages_serde.
Fields§
§text: Option<String>Optional text content from the model. None when the model produced
only tool calls with no text preamble.
tool_calls: Vec<ToolCall>Tool calls requested by the model. Empty when the model produced a text-only response (final answer).
Implementations§
Source§impl AssistantContent
impl AssistantContent
Sourcepub fn with_replaced_tool_calls(self, calls: Vec<ToolCall>) -> Self
pub fn with_replaced_tool_calls(self, calls: Vec<ToolCall>) -> Self
Consume self and return a new value with calls as the tool-call
list, preserving any existing text content.
Trait Implementations§
Source§impl Clone for AssistantContent
impl Clone for AssistantContent
Source§fn clone(&self) -> AssistantContent
fn clone(&self) -> AssistantContent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more