Struct ChatResponse
pub struct ChatResponse {
pub text: Option<String>,
pub tool_calls: Vec<ToolCall>,
pub usage: Option<TokenUsage>,
pub reasoning_content: Option<String>,
}Expand description
An LLM response that may contain text, tool calls, or both.
Fields§
§text: Option<String>Text content of the response (may be empty if only tool calls).
tool_calls: Vec<ToolCall>Tool calls requested by the LLM.
usage: Option<TokenUsage>Token usage reported by the model_provider, if available.
reasoning_content: Option<String>Raw reasoning/thinking content from thinking models (e.g. DeepSeek-R1, Kimi K2.5, GLM-4.7). Preserved as an opaque pass-through so it can be sent back in subsequent API requests — some model_providers reject tool-call history that omits this field.
Implementations§
Source§impl ChatResponse
impl ChatResponse
Sourcepub fn has_tool_calls(&self) -> bool
pub fn has_tool_calls(&self) -> bool
True when the LLM wants to invoke at least one tool.
Sourcepub fn text_or_empty(&self) -> &str
pub fn text_or_empty(&self) -> &str
Convenience: return text content or empty string.
Sourcepub fn is_semantically_empty_terminal(&self) -> bool
pub fn is_semantically_empty_terminal(&self) -> bool
True when this response cannot make progress or complete a turn.
Reasoning content is intentionally excluded: it may need to be round-tripped to a provider, but it is not a user-visible final answer. A response containing one or more tool calls remains valid even when its text is empty.
Trait Implementations§
Source§impl Clone for ChatResponse
impl Clone for ChatResponse
Source§fn clone(&self) -> ChatResponse
fn clone(&self) -> ChatResponse
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more