pub struct AiChunk {
pub content: String,
pub tool_calls: Vec<ToolCallChunk>,
pub extras: Map<String, Value>,
}Expand description
Streaming fragment for an Ai message. May carry partial text and/or
partial tool calls. Concatenating chunks merges text and tool calls
(matched by index).
extras is a forward-compatibility bag for provider-specific
metadata (finish reasons, logprobs, raw fragments) that should survive
round-trips without forcing the core enum to change.
Fields§
§content: StringIncremental text fragment.
tool_calls: Vec<ToolCallChunk>Incremental tool-call updates (provider-indexed; same index in two chunks refers to the same call and the second chunk’s fields extend the first).
extras: Map<String, Value>Provider-specific extras (e.g. finish_reason, logprobs). Merged
on extend() — later writes win on key collision.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AiChunk
impl<'de> Deserialize<'de> for AiChunk
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
impl StructuralPartialEq for AiChunk
Auto Trait Implementations§
impl Freeze for AiChunk
impl RefUnwindSafe for AiChunk
impl Send for AiChunk
impl Sync for AiChunk
impl Unpin for AiChunk
impl UnsafeUnpin for AiChunk
impl UnwindSafe for AiChunk
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