Documentation
¶
Index ¶
- Variables
- type BaseModel
- type CallConfig
- type CallOption
- type ChatModel
- type ContentBlock
- type ContentType
- type GenerationConfig
- type LLMResponse
- type LiteLLMAdapter
- func NewAnthropicModel(model, apiKey string, baseURL ...string) (*LiteLLMAdapter, error)
- func NewGeminiModel(model, apiKey string, baseURL ...string) (*LiteLLMAdapter, error)
- func NewLiteLLMAdapter(model string, client *litellm.Client) *LiteLLMAdapter
- func NewOpenAIModel(model, apiKey string, baseURL ...string) (*LiteLLMAdapter, error)
- func (l *LiteLLMAdapter) Generate(ctx context.Context, messages []Message, tools []ToolSpec, opts ...CallOption) (*LLMResponse, error)
- func (l *LiteLLMAdapter) GenerateStream(ctx context.Context, messages []Message, tools []ToolSpec, opts ...CallOption) (<-chan StreamEvent, error)
- func (l *LiteLLMAdapter) ProviderName() string
- type Message
- type ModelCapability
- type ModelInfo
- type Role
- type StopReason
- type StreamEvent
- type ToolCall
- type ToolSpec
- type Usage
Constants ¶
This section is empty.
Variables ¶
var ( RoleUser = agentcore.RoleUser RoleAssistant = agentcore.RoleAssistant RoleSystem = agentcore.RoleSystem RoleTool = agentcore.RoleTool )
Re-export role constants.
var ( StreamEventTextStart = agentcore.StreamEventTextStart StreamEventTextDelta = agentcore.StreamEventTextDelta StreamEventTextEnd = agentcore.StreamEventTextEnd StreamEventThinkingStart = agentcore.StreamEventThinkingStart StreamEventThinkingDelta = agentcore.StreamEventThinkingDelta StreamEventThinkingEnd = agentcore.StreamEventThinkingEnd StreamEventToolCallStart = agentcore.StreamEventToolCallStart StreamEventToolCallDelta = agentcore.StreamEventToolCallDelta StreamEventToolCallEnd = agentcore.StreamEventToolCallEnd StreamEventDone = agentcore.StreamEventDone StreamEventError = agentcore.StreamEventError )
Re-export stream event type constants.
var ( ContentText = agentcore.ContentText ContentThinking = agentcore.ContentThinking ContentToolCall = agentcore.ContentToolCall ContentImage = agentcore.ContentImage )
Re-export content type constants.
var DefaultGenerationConfig = &GenerationConfig{ Temperature: 0.7, TopP: 0.9, TopK: 0, MaxTokens: 65536, StopSequences: []string{}, PresencePenalty: 0.0, FrequencyPenalty: 0.0, Seed: nil, }
Functions ¶
This section is empty.
Types ¶
type BaseModel ¶
type BaseModel struct {
// contains filtered or unexported fields
}
BaseModel provides common model metadata and capability checks.
func NewBaseModel ¶
func NewBaseModel(info ModelInfo, config *GenerationConfig) *BaseModel
func (*BaseModel) GetConfig ¶
func (m *BaseModel) GetConfig() *GenerationConfig
func (*BaseModel) SupportsCapability ¶
func (m *BaseModel) SupportsCapability(capability ModelCapability) bool
func (*BaseModel) SupportsStreaming ¶
func (*BaseModel) SupportsTools ¶
type CallConfig ¶
type CallConfig = agentcore.CallConfig
Re-export root package types for convenience.
type CallOption ¶
type CallOption = agentcore.CallOption
Re-export root package types for convenience.
type ContentBlock ¶
type ContentBlock = agentcore.ContentBlock
Re-export root package types for convenience.
type ContentType ¶
type ContentType = agentcore.ContentType
Re-export root package types for convenience.
type GenerationConfig ¶
type GenerationConfig struct {
Temperature float64 `json:"temperature"`
TopP float64 `json:"top_p"`
TopK int `json:"top_k"`
MaxTokens int `json:"max_tokens"`
StopSequences []string `json:"stop_sequences"`
PresencePenalty float64 `json:"presence_penalty"`
FrequencyPenalty float64 `json:"frequency_penalty"`
Seed *int64 `json:"seed"`
}
GenerationConfig defines sampling and length control parameters.
type LLMResponse ¶
type LLMResponse = agentcore.LLMResponse
Re-export root package types for convenience.
type LiteLLMAdapter ¶
type LiteLLMAdapter struct {
*BaseModel
// contains filtered or unexported fields
}
LiteLLMAdapter adapts litellm to the llm.ChatModel interface.
func NewAnthropicModel ¶
func NewAnthropicModel(model, apiKey string, baseURL ...string) (*LiteLLMAdapter, error)
NewAnthropicModel creates an Anthropic adapter.
func NewGeminiModel ¶
func NewGeminiModel(model, apiKey string, baseURL ...string) (*LiteLLMAdapter, error)
NewGeminiModel creates a Gemini adapter.
func NewLiteLLMAdapter ¶
func NewLiteLLMAdapter(model string, client *litellm.Client) *LiteLLMAdapter
NewLiteLLMAdapter creates an adapter from a litellm Client.
func NewOpenAIModel ¶
func NewOpenAIModel(model, apiKey string, baseURL ...string) (*LiteLLMAdapter, error)
NewOpenAIModel creates an OpenAI adapter.
func (*LiteLLMAdapter) Generate ¶
func (l *LiteLLMAdapter) Generate(ctx context.Context, messages []Message, tools []ToolSpec, opts ...CallOption) (*LLMResponse, error)
Generate produces a synchronous response.
func (*LiteLLMAdapter) GenerateStream ¶
func (l *LiteLLMAdapter) GenerateStream(ctx context.Context, messages []Message, tools []ToolSpec, opts ...CallOption) (<-chan StreamEvent, error)
GenerateStream produces a streaming response with fine-grained events.
func (*LiteLLMAdapter) ProviderName ¶
func (l *LiteLLMAdapter) ProviderName() string
ProviderName returns the provider name (e.g. "openai", "anthropic"). Implements agentcore.ProviderNamer for per-provider API key resolution.
type ModelCapability ¶
type ModelCapability string
ModelCapability defines capability identifiers.
const ( CapabilityChat ModelCapability = "chat" CapabilityCompletion ModelCapability = "completion" CapabilityToolCalling ModelCapability = "tool_calling" CapabilityStreaming ModelCapability = "streaming" CapabilityMultimodal ModelCapability = "multimodal" CapabilityFunctionCall ModelCapability = "function_call" )
type ModelInfo ¶
type ModelInfo struct {
Name string `json:"name"`
Provider string `json:"provider"`
Version string `json:"version"`
MaxTokens int `json:"max_tokens"`
ContextSize int `json:"context_size"`
Capabilities []string `json:"capabilities"`
}
ModelInfo contains basic model metadata.
type StopReason ¶
type StopReason = agentcore.StopReason
Re-export root package types for convenience.
type StreamEvent ¶
type StreamEvent = agentcore.StreamEvent
Re-export root package types for convenience.