Documentation
¶
Index ¶
- Constants
- func APIKind(providerID string) string
- func ContextPolicy(providerID, modelID string) contextpolicy.Policy
- func CostForUsage(model Model, usage provider.Usage) float64
- func DefaultBaseURL(providerID string) string
- func EnvKeys(providerID string) []string
- func NormalizeProvider(id string) string
- func RegisterForTest(p Provider) func()
- func SupportsModel(providerID, modelID string) bool
- func SupportsProvider(id string) bool
- type CacheCapability
- type Cost
- type Model
- type Provider
- type WebSearchCapability
Constants ¶
View Source
const ( ProviderFake = "fake" ProviderOpenAI = "openai" ProviderAnthropic = "anthropic" ProviderGoogle = "google" ProviderMoonshot = "moonshot" ProviderChatGLM = "chatglm" ProviderDeepSeek = "deepseek" ProviderQwen = "qwen" ProviderOpenRouter = "openrouter" ProviderXAI = "xai" ProviderGroq = "groq" ProviderOllama = "ollama" ProviderOpenAICompatible = "openai-compatible" )
View Source
const ( APIFake = "fake" APIOpenAIChat = "openai-chat-completions" APIAnthropicMessages = "anthropic-messages" )
Variables ¶
This section is empty.
Functions ¶
func ContextPolicy ¶
func ContextPolicy(providerID, modelID string) contextpolicy.Policy
func DefaultBaseURL ¶
func NormalizeProvider ¶
func RegisterForTest ¶
func RegisterForTest(p Provider) func()
func SupportsModel ¶
func SupportsProvider ¶
Types ¶
type CacheCapability ¶
type CacheCapability struct {
PromptCacheKey bool `json:"prompt_cache_key,omitempty"`
PromptCacheRetention bool `json:"prompt_cache_retention,omitempty"`
AnthropicCacheControl bool `json:"anthropic_cache_control,omitempty"`
}
func Cache ¶
func Cache(providerID, modelID string) CacheCapability
type Model ¶
type Model struct {
ID string `json:"id"`
Name string `json:"name"`
Provider string `json:"provider"`
API string `json:"api"`
ContextWindow int64 `json:"context_window,omitempty"`
MaxTokens int64 `json:"max_tokens,omitempty"`
Input []string `json:"input"`
Reasoning bool `json:"reasoning"`
Cost Cost `json:"cost,omitempty"`
Cache CacheCapability `json:"cache,omitempty"`
Default bool `json:"default,omitempty"`
OpenAIModelID string `json:"openai_model_id,omitempty"`
AnthropicModel string `json:"anthropic_model,omitempty"`
}
func DefaultModel ¶
type Provider ¶
type Provider struct {
ID string `json:"id"`
Name string `json:"name"`
API string `json:"api"`
DefaultBaseURL string `json:"default_base_url,omitempty"`
DefaultModel string `json:"default_model,omitempty"`
EnvKeys []string `json:"env_keys,omitempty"`
Custom bool `json:"custom,omitempty"`
Cache CacheCapability `json:"cache,omitempty"`
WebSearch WebSearchCapability `json:"web_search,omitempty"`
Models []Model `json:"models"`
}
func FindProvider ¶
type WebSearchCapability ¶
type WebSearchCapability struct {
DefaultSource string `json:"default_source,omitempty"`
HostedWireShape string `json:"hosted_wire_shape,omitempty"`
HostedWireShapes []string `json:"hosted_wire_shapes,omitempty"`
}
func WebSearch ¶
func WebSearch(providerID string) WebSearchCapability
Click to show internal directories.
Click to hide internal directories.