Skip to main content

ContextBackendResponse

Trait ContextBackendResponse 

Source
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 均需实现。

提供:

Required Methods§

Source

fn response_type(&self) -> ResponseType

返回响应包含的内容类型。

Source

fn reasoning_content(&self) -> Option<String>

提取思维链文本(流式为 delta,非流式为完整内容)。

None 表示字段不存在/null,Some("") 表示空字符串。

Source

fn content(&self) -> Option<String>

提取正文文本(流式为 delta,非流式为完整内容)。

None 表示字段不存在/null,Some("") 表示空字符串。

Source

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".

Implementors§