Skip to main content

Module api

Module api 

Source

Structs§

FallbackResult
fallback 非流式调用结果

Functions§

build_request_with_tools
构建带工具定义的请求
call_llm_non_stream
非流式请求(已内置宽松反序列化:finish_reason 为 String)
call_llm_stream
同步包装:创建 tokio runtime 执行异步流式调用
call_llm_stream_async
流式调用 API,通过回调逐步输出,返回完整的助手回复内容
create_llm_client
根据 ModelProvider 配置创建 LlmClient
sanitize_messages
预处理消息数组,保证 assistant tool_calls ↔ tool result 双向配对完整, 避免 API 报 “tool_call_id not found” 或 “missing tool result” 错误。
to_llm_messages
将内部 ChatMessage 转换为 llm::Message 格式