pub struct Delta {
pub role: Option<String>,
pub content: Option<String>,
pub reasoning_content: Option<String>,
pub tool_calls: Option<Vec<ToolCallMessage>>,
}Expand description
Represents incremental content updates in streaming responses.
The delta contains partial content that should be appended to the accumulated response. Different fields may be present depending on the chunk type and model capabilities.
§Fields
role- Message role, typically “assistant” on first chunkcontent- Partial text content to appendreasoning_content- Reasoning traces for thinking models
Fields§
§role: Option<String>Role of the message sender.
Typically “assistant” on the first chunk of a response, may be omitted on subsequent chunks.
content: Option<String>Partial text content that should be appended to the response.
This field contains the incremental text content for the current chunk.
reasoning_content: Option<String>Reasoning content for models with thinking capabilities.
This field contains step-by-step reasoning traces when the model is operating in thinking mode with reasoning enabled.
tool_calls: Option<Vec<ToolCallMessage>>Streaming tool call payload for tool invocation.
When tool_stream is enabled and the model emits tool calling
information, providers often stream this as an array of objects with
partial fields. Use a flexible Value here to accept
strings/arrays/objects without failing deserialization on type
mismatch across increments.