Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatResult ¶
func (ChatResult) HasToolCalls ¶
func (r ChatResult) HasToolCalls() bool
type Client ¶
type Client struct {
Provider string
BaseURL string
APIKey string
Model string
MaxTokens int
Temperature *float64
Headers map[string]string
HTTP HTTPDoer
}
func (*Client) Chat ¶
func (c *Client) Chat(ctx context.Context, messages []Message, tools []ToolDefinition) (*ChatResult, error)
type FunctionDefinition ¶
type FunctionDefinition struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Parameters JSONSchema `json:"parameters"`
}
type JSONSchema ¶
type JSONSchema struct {
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
Properties map[string]JSONSchema `json:"properties,omitempty"`
Required []string `json:"required,omitempty"`
Enum []string `json:"enum,omitempty"`
Items *JSONSchema `json:"items,omitempty"`
// Raw can be used when the schema cannot be expressed with this subset.
// If set, other fields should be left empty.
Raw json.RawMessage `json:"-"`
}
JSONSchema is a small subset of JSON Schema used for tool parameters.
func (JSONSchema) MarshalJSON ¶
func (s JSONSchema) MarshalJSON() ([]byte, error)
type Message ¶
type Message struct {
Role string `json:"role"`
Content string `json:"content,omitempty"`
ToolCalls []ToolCallPayload `json:"tool_calls,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Name string `json:"name,omitempty"`
}
Message is an OpenAI-compatible chat message. We only model the fields clawlet needs.
type ToolCallPayload ¶
type ToolCallPayload struct {
ID string `json:"id"`
Type string `json:"type"`
Function ToolCallPayloadFunc `json:"function"`
}
ToolCallPayload is used inside assistant messages to request tool execution.
type ToolCallPayloadFunc ¶
type ToolDefinition ¶
type ToolDefinition struct {
Type string `json:"type"`
Function FunctionDefinition `json:"function"`
}
Click to show internal directories.
Click to hide internal directories.