Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateSpec(spec *aicontext.ProviderSpec) error
- type AnthropicProvider
- type AzureProvider
- type BaseProvider
- func (bp *BaseProvider) Handle(ctx *aicontext.Context)
- func (bp *BaseProvider) HealthCheck() error
- func (bp *BaseProvider) Name() string
- func (bp *BaseProvider) ParseTokens(ctx *aicontext.Context, fc *aicontext.FinishContext, respBody []byte) (inputToken int, outputToken int, err metricshub.MetricError)
- func (bp *BaseProvider) ProxyRequest(ctx *aicontext.Context, req *http.Request)
- func (bp *BaseProvider) RequestMapper(pc *aicontext.Context) (string, []byte, error)
- func (bp *BaseProvider) Spec() *aicontext.ProviderSpec
- func (bp *BaseProvider) Type() string
- type BedrockProvider
- type CoHereProvider
- type DeepSeekProvider
- type GeminiProvider
- type MistralProvider
- type OllamaProvider
- type OpenAIProvider
- type Provider
- type QwenProvider
- type RequestMapper
Constants ¶
View Source
const ( OpenAIProviderType = "openai" AzureProviderType = "azure" AnthropicProviderType = "anthropic" BedrockProviderType = "bedrock" CohereProviderType = "cohere" DeepSeekProviderType = "deepseek" GeminiProviderType = "gemini" MistralProviderType = "mistral" OllamaProviderType = "ollama" QwenProviderType = "qwen" )
All Supported Provider types
Variables ¶
View Source
var ProviderTypeRegistry = map[string]reflect.Type{}
ProviderTypeRegistry is a registry for AI gateway providers.
Functions ¶
func ValidateSpec ¶
func ValidateSpec(spec *aicontext.ProviderSpec) error
Types ¶
type AnthropicProvider ¶
type AnthropicProvider struct {
BaseProvider
}
func (*AnthropicProvider) Type ¶
func (p *AnthropicProvider) Type() string
type AzureProvider ¶
type AzureProvider struct {
BaseProvider
}
func (*AzureProvider) Type ¶
func (p *AzureProvider) Type() string
type BaseProvider ¶
type BaseProvider struct {
// contains filtered or unexported fields
}
BaseProvider is a struct that contains the common fields for all AI gateway providers. Almost all providers compatible with OpenAI API, so we abstract the common logic.
func (*BaseProvider) Handle ¶
func (bp *BaseProvider) Handle(ctx *aicontext.Context)
func (*BaseProvider) HealthCheck ¶
func (bp *BaseProvider) HealthCheck() error
func (*BaseProvider) Name ¶
func (bp *BaseProvider) Name() string
func (*BaseProvider) ParseTokens ¶
func (bp *BaseProvider) ParseTokens(ctx *aicontext.Context, fc *aicontext.FinishContext, respBody []byte) (inputToken int, outputToken int, err metricshub.MetricError)
func (*BaseProvider) ProxyRequest ¶
func (bp *BaseProvider) ProxyRequest(ctx *aicontext.Context, req *http.Request)
func (*BaseProvider) RequestMapper ¶
func (*BaseProvider) Spec ¶
func (bp *BaseProvider) Spec() *aicontext.ProviderSpec
func (*BaseProvider) Type ¶
func (bp *BaseProvider) Type() string
type BedrockProvider ¶
type BedrockProvider struct {
BaseProvider
}
func (*BedrockProvider) Type ¶
func (p *BedrockProvider) Type() string
type CoHereProvider ¶
type CoHereProvider struct {
BaseProvider
}
func (*CoHereProvider) Type ¶
func (p *CoHereProvider) Type() string
type DeepSeekProvider ¶
type DeepSeekProvider struct {
BaseProvider
}
func (*DeepSeekProvider) Type ¶
func (p *DeepSeekProvider) Type() string
type GeminiProvider ¶
type GeminiProvider struct {
BaseProvider
}
func (*GeminiProvider) Type ¶
func (p *GeminiProvider) Type() string
type MistralProvider ¶
type MistralProvider struct {
BaseProvider
}
func (*MistralProvider) Type ¶
func (p *MistralProvider) Type() string
type OllamaProvider ¶
type OllamaProvider struct {
BaseProvider
}
func (*OllamaProvider) Type ¶
func (p *OllamaProvider) Type() string
type OpenAIProvider ¶
type OpenAIProvider struct {
BaseProvider
}
func (*OpenAIProvider) Type ¶
func (p *OpenAIProvider) Type() string
type Provider ¶
type Provider interface {
Name() string
Type() string
Handle(ctx *aicontext.Context)
Spec() *aicontext.ProviderSpec
// HealthCheck checks the health of the provider.
// It should return nil if the provider is healthy, otherwise it returns an error.
HealthCheck() error
// contains filtered or unexported methods
}
func NewProvider ¶
func NewProvider(spec *aicontext.ProviderSpec) Provider
type QwenProvider ¶
type QwenProvider struct {
BaseProvider
}
func (*QwenProvider) Type ¶
func (p *QwenProvider) Type() string
Click to show internal directories.
Click to hide internal directories.