Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSupportedProviders ¶
func GetSupportedProviders() []string
GetSupportedProviders returns a list of all supported provider IDs.
Types ¶
type GenerateParams ¶
type GenerateParams struct {
Model string
Messages []Message
Tools []Tool
Temperature float64
MaxTokens int
}
GenerateParams contains parameters for generation.
type Message ¶
type Message struct {
Role string
Content string
ToolCalls []ToolCall
Metadata map[string]interface{}
}
Message represents a chat message.
type ModelInfo ¶
type ModelInfo struct {
ID string
Name string
ContextWindow int
SupportsVision bool
SupportsTools bool
IsReasoning bool
}
ModelInfo describes an available model.
type Provider ¶
type Provider interface {
// ID returns the unique identifier of the provider (e.g., "openai", "anthropic").
ID() string
// Generate streams responses for the given conversation.
// It returns an iterator that yields StreamEvents.
Generate(ctx context.Context, params GenerateParams) (iter.Seq2[StreamEvent, error], error)
// ListModels returns a list of available models.
ListModels(ctx context.Context) ([]ModelInfo, error)
}
Provider defines the interface for LLM providers.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages the registration and lookup of providers.
type StreamEvent ¶
type StreamEvent struct {
Type StreamEventType
Text string
ToolCall *ToolCall
Error error
}
StreamEvent represents a single event in the generation stream.
type StreamEventType ¶
type StreamEventType string
StreamEventType defines the type of event in a generation stream.
const ( StreamEventPlainText StreamEventType = "text_delta" StreamEventToolCall StreamEventType = "tool_call" StreamEventError StreamEventType = "error" StreamEventDone StreamEventType = "done" )
func (StreamEventType) Valid ¶
func (t StreamEventType) Valid() bool
Valid reports whether t is a known stream event type.
func (StreamEventType) Values ¶
func (t StreamEventType) Values() []StreamEventType
Values returns all known stream event types.
Click to show internal directories.
Click to hide internal directories.