Documentation
¶
Index ¶
- func Emit(onDelta func(Delta), d Delta)
- func EstimateTokens(s string) int
- type Anthropic
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type Client
- type ContentPart
- type Delta
- type Gemini
- type Limits
- type Model
- type OpenAI
- type PartType
- type Role
- type ToolCall
- type ToolChoice
- type ToolSpec
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateTokens ¶
Types ¶
type Anthropic ¶ added in v0.5.0
type Anthropic struct {
// contains filtered or unexported fields
}
func NewAnthropic ¶ added in v0.5.0
func (*Anthropic) Chat ¶ added in v0.5.0
func (c *Anthropic) Chat(ctx context.Context, req ChatRequest, onDelta func(Delta)) (ChatResponse, error)
type ChatMessage ¶
type ChatMessage struct {
Role Role `json:"role"`
Content string `json:"content,omitempty"`
Parts []ContentPart `json:"parts,omitempty"`
ReasoningContent string `json:"reasoning,omitempty"`
ToolCalls []ToolCall `json:"toolCalls,omitempty"`
ToolCallID string `json:"toolCallId,omitempty"`
Native []byte `json:"-"`
}
type ChatRequest ¶
type ChatRequest struct {
Model Model
Messages []ChatMessage
Tools []ToolSpec
ToolChoice ToolChoice
InputTokens int
}
type ChatResponse ¶
type ChatResponse struct {
Message ChatMessage
FinishReason string
Usage Usage
}
type Client ¶ added in v0.5.0
type Client interface {
Chat(ctx context.Context, req ChatRequest, onDelta func(Delta)) (ChatResponse, error)
Limits(model string) (Limits, error)
}
type ContentPart ¶ added in v0.5.0
type Gemini ¶ added in v0.5.0
type Gemini struct {
// contains filtered or unexported fields
}
func (*Gemini) Chat ¶ added in v0.5.0
func (c *Gemini) Chat(ctx context.Context, req ChatRequest, onDelta func(Delta)) (ChatResponse, error)
type Limits ¶
type Model ¶
type OpenAI ¶
type OpenAI struct {
// contains filtered or unexported fields
}
func (*OpenAI) Chat ¶
func (c *OpenAI) Chat(ctx context.Context, req ChatRequest, onDelta func(Delta)) (ChatResponse, error)
type ToolChoice ¶
type ToolChoice string
const ( ToolChoiceAuto ToolChoice = "auto" ToolChoiceNone ToolChoice = "none" )
Click to show internal directories.
Click to hide internal directories.