Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatMessage ¶
type ChatMessage struct {
Role string `json:"role"`
Content string `json:"content"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
}
ChatMessage represents a single message in the conversation.
type ChatRequest ¶
type ChatRequest struct {
Messages []ChatMessage
Tools []ToolDefinition
}
ChatRequest represents a request to the LLM with optional tool definitions.
type ChatResponse ¶
type ChatResponse struct {
Content string
ToolCalls []ToolCall
FinishReason string // "stop" or "tool_calls"
}
ChatResponse represents the LLM response.
type FunctionCall ¶
FunctionCall contains the function name and serialized arguments.
type FunctionDef ¶
type FunctionDef struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters json.RawMessage `json:"parameters"`
}
FunctionDef describes a function tool.
type Provider ¶
type Provider interface {
ChatCompletion(ctx context.Context, req ChatRequest) (*ChatResponse, error)
}
Provider is the interface that LLM providers must implement for tool-use support.
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Type string `json:"type"`
Function FunctionCall `json:"function"`
}
ToolCall represents a tool invocation requested by the LLM.
type ToolDefinition ¶
type ToolDefinition struct {
Type string `json:"type"`
Function FunctionDef `json:"function"`
}
ToolDefinition describes a tool available to the LLM.
Click to show internal directories.
Click to hide internal directories.