pub trait ContextBackendResponse {
// Required methods
fn response_type(&self) -> ResponseType;
fn reasoning_content(&self) -> Option<String>;
fn content(&self) -> Option<String>;
fn tool_calls(&self) -> Vec<ToolCallInfo>;
}Expand description
后端 Response 类型约束,流式/非流式 Response 均需实现。
提供:
response_type:内容分类,供ContextBackend::classify_chunk默认实现reasoning_content:思维链文本content:正文文本tool_calls:工具调用信息
Required Methods§
Sourcefn response_type(&self) -> ResponseType
fn response_type(&self) -> ResponseType
返回响应包含的内容类型。
Sourcefn reasoning_content(&self) -> Option<String>
fn reasoning_content(&self) -> Option<String>
提取思维链文本(流式为 delta,非流式为完整内容)。
None 表示字段不存在/null,Some("") 表示空字符串。
Sourcefn content(&self) -> Option<String>
fn content(&self) -> Option<String>
提取正文文本(流式为 delta,非流式为完整内容)。
None 表示字段不存在/null,Some("") 表示空字符串。
Sourcefn tool_calls(&self) -> Vec<ToolCallInfo>
fn tool_calls(&self) -> Vec<ToolCallInfo>
提取工具调用信息(流式为 delta,非流式为完整列表)。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".