Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatClient ¶
type ChatClient interface {
Chat(ctx context.Context, req ChatRequest) (<-chan StreamEvent, error)
Model() string
ContextWindow() int
Pricing() (float64, float64, float64)
}
type ChatRequest ¶
type ChatRequest struct {
Model string `json:"model"`
Messages []message.Message `json:"messages"`
Tools []message.ToolDef `json:"tools,omitempty"`
Stream bool `json:"stream"`
MaxTokens int `json:"max_tokens,omitempty"`
StreamOptions *StreamOptions `json:"stream_options,omitempty"`
Thinking *ThinkingConfig `json:"thinking,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
}
type Client ¶
type Client struct {
Profile ModelProfile
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(baseURL, model, apiKey string, profile ModelProfile) *Client
func (*Client) Chat ¶
func (c *Client) Chat(ctx context.Context, req ChatRequest) (<-chan StreamEvent, error)
func (*Client) ContextWindow ¶
type ModelProfile ¶
type PromptTokensDetails ¶ added in v0.1.1
type PromptTokensDetails struct {
CachedTokens int `json:"cached_tokens"`
}
type ProviderError ¶ added in v0.1.1
func (*ProviderError) Error ¶ added in v0.1.1
func (e *ProviderError) Error() string
func (*ProviderError) Retryable ¶ added in v0.1.1
func (e *ProviderError) Retryable() bool
type StreamEvent ¶
type StreamEvent struct {
Type string `json:"type"`
Delta string `json:"delta,omitempty"`
ReasoningDelta string `json:"reasoningDelta,omitempty"`
ToolCall *StreamToolCall `json:"toolCall,omitempty"`
Usage *Usage `json:"usage,omitempty"`
FinishReason string `json:"finishReason,omitempty"`
Error error `json:"-"`
}
type StreamOptions ¶
type StreamOptions struct {
IncludeUsage bool `json:"include_usage"`
}
type StreamToolCall ¶
type ThinkingConfig ¶
type ThinkingConfig struct {
Type string `json:"type"`
}
Click to show internal directories.
Click to hide internal directories.