Documentation
¶
Index ¶
- func ProfileSupports(profile Profile, capability Capability, defaults ...Capability) bool
- type APIError
- type Capability
- type ChatChunk
- type ChatRequest
- type ChatResponse
- type Chatter
- type Embedder
- type Gateway
- type Message
- type Profile
- type Role
- type Streamer
- type StructuredOutputter
- type ThinkingConfig
- type TokenUsage
- type ToolCall
- type ToolCallRequest
- type ToolCallResponse
- type ToolCaller
- type ToolSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProfileSupports ¶
func ProfileSupports(profile Profile, capability Capability, defaults ...Capability) bool
Types ¶
type Capability ¶
type Capability int
const ( CapChat Capability = iota CapToolCall CapStructuredOutput CapStream CapEmbed )
func CapabilitiesFromStrings ¶
func CapabilitiesFromStrings(values []string) []Capability
func ParseCapability ¶
func ParseCapability(value string) (Capability, bool)
func (Capability) String ¶
func (c Capability) String() string
type ChatChunk ¶
type ChatChunk struct {
Content string `json:"content,omitempty"`
Done bool `json:"done,omitempty"`
Error string `json:"error,omitempty"`
Usage TokenUsage `json:"usage,omitempty"`
}
type ChatRequest ¶
type ChatRequest struct {
Messages []Message `json:"messages"`
Temperature *float32 `json:"temperature,omitempty"`
TopP *float32 `json:"top_p,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Thinking ThinkingConfig `json:"thinking,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
ExtraBody map[string]any `json:"extra_body,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type ChatResponse ¶
type ChatResponse struct {
Message Message `json:"message"`
Usage TokenUsage `json:"usage"`
FinishReason string `json:"finish_reason,omitempty"`
Raw json.RawMessage `json:"raw,omitempty"`
}
type Chatter ¶
type Chatter interface {
Chat(ctx context.Context, profile string, req ChatRequest) (ChatResponse, error)
}
type Message ¶
type Message struct {
Role Role `json:"role"`
Content string `json:"content,omitempty"`
ReasoningContent string `json:"reasoning_content,omitempty"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
Name string `json:"name,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type Profile ¶
type Profile struct {
Name string `json:"name"`
Provider string `json:"provider"`
Model string `json:"model"`
Endpoint string `json:"endpoint,omitempty"`
APIKeyEnv string `json:"api_key_env,omitempty"`
ContextWindowTokens int `json:"context_window_tokens,omitempty"`
MaxOutputTokens int `json:"max_output_tokens,omitempty"`
Temperature *float32 `json:"temperature,omitempty"`
TopP *float32 `json:"top_p,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Thinking ThinkingConfig `json:"thinking,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
Context contextwindow.Policy `json:"context,omitempty"`
ExtraBody map[string]any `json:"extra_body,omitempty"`
Capabilities []Capability `json:"capabilities,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type StructuredOutputter ¶
type StructuredOutputter interface {
StructuredChat(ctx context.Context, profile string, schema json.RawMessage, req ChatRequest) (json.RawMessage, error)
}
type ThinkingConfig ¶
type TokenUsage ¶
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Input json.RawMessage `json:"input,omitempty"`
}
type ToolCallRequest ¶
type ToolCallRequest struct {
ChatRequest
Tools []ToolSpec `json:"tools,omitempty"`
}
type ToolCallResponse ¶
type ToolCallResponse struct {
ChatResponse
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
}
type ToolCaller ¶
type ToolCaller interface {
ChatWithTools(ctx context.Context, profile string, req ToolCallRequest) (ToolCallResponse, error)
}
Click to show internal directories.
Click to hide internal directories.