Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Stream 发起一轮流式调用;事件通道在结束或出错后关闭。
Stream(ctx context.Context, messages []Message, tools []Tool) <-chan Event
}
Client 是一个模型厂商的流式调用客户端。
type FinishReason ¶
type FinishReason string
FinishReason 是一轮调用的终止原因。
const ( FinishEndTurn FinishReason = "end_turn" FinishMaxToken FinishReason = "max_tokens" FinishToolUse FinishReason = "tool_use" FinishUnknown FinishReason = "unknown" )
type Message ¶
type Message struct {
Role Role
Content string
ToolCalls []ToolCall
ToolResults []ToolResult
}
Message 是发给模型的对话消息。
与 gobrave 的 message.Message 不同,它额外承载工具调用 / 结果,用于在 Agent 循环内部维护「assistant(tool_calls) → tool(results)」的完整往返。
type Options ¶
type Options struct {
Provider models.ModelProvider
BaseURL string
APIKey string
SystemPrompt string
Model models.Model
MaxTokens int64
ReasoningEffort string
}
Options 描述一次调用的连接与模型参数。
type Response ¶
type Response struct {
Content string
ToolCalls []ToolCall
Usage Usage
FinishReason FinishReason
}
Response 是一轮调用的聚合结果。
type Tool ¶
type Tool struct {
Name string
Description string
// InputSchema 是完整的 object JSON Schema(type / properties / required)。
InputSchema map[string]any
}
Tool 是暴露给模型的工具定义。
type ToolResult ¶
ToolResult 是一条工具调用结果(Role == RoleTool 的消息按 ToolResults 回填)。
Click to show internal directories.
Click to hide internal directories.