Documentation
¶
Index ¶
- type AnthropicClient
- func (c *AnthropicClient) Chat(ctx context.Context, messages []Message, opts ...Option) (*Response, error)
- func (c *AnthropicClient) Close() error
- func (c *AnthropicClient) Complete(ctx context.Context, prompt string, opts ...Option) (*Response, error)
- func (c *AnthropicClient) Embed(ctx context.Context, texts []string) ([][]float64, error)
- type Client
- type Message
- type OpenAIClient
- func (c *OpenAIClient) Chat(ctx context.Context, messages []Message, opts ...Option) (*Response, error)
- func (c *OpenAIClient) Close() error
- func (c *OpenAIClient) Complete(ctx context.Context, prompt string, opts ...Option) (*Response, error)
- func (c *OpenAIClient) Embed(ctx context.Context, texts []string) ([][]float64, error)
- type Option
- type Options
- type Response
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnthropicClient ¶
type AnthropicClient struct {
// contains filtered or unexported fields
}
AnthropicClient implements Client for Anthropic
func NewAnthropicClient ¶
func NewAnthropicClient(apiKey string) (*AnthropicClient, error)
NewAnthropicClient creates a new Anthropic client
func (*AnthropicClient) Close ¶
func (c *AnthropicClient) Close() error
type Client ¶
type Client interface {
// Complete generates a completion for the given prompt
Complete(ctx context.Context, prompt string, opts ...Option) (*Response, error)
// Chat performs a chat completion with message history
Chat(ctx context.Context, messages []Message, opts ...Option) (*Response, error)
// Embed generates embeddings for the given texts
Embed(ctx context.Context, texts []string) ([][]float64, error)
// Close closes the client and releases resources
Close() error
}
Client provides a unified interface for LLM providers
type OpenAIClient ¶
type OpenAIClient struct {
// contains filtered or unexported fields
}
OpenAIClient implements Client for OpenAI
func NewOpenAIClient ¶
func NewOpenAIClient(apiKey string) (*OpenAIClient, error)
NewOpenAIClient creates a new OpenAI client
func (*OpenAIClient) Close ¶
func (c *OpenAIClient) Close() error
type Option ¶
type Option func(*Options)
Option is a functional option for LLM requests
func WithMaxTokens ¶
WithMaxTokens sets the maximum tokens to generate
func WithTemperature ¶
WithTemperature sets the temperature
Click to show internal directories.
Click to hide internal directories.