providers

package
v0.0.0-...-8c5cae0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListModels

func ListModels() []string

ListModels returns aliases from a new empty factory.

func NewByAlias

func NewByAlias(alias string) (model.LLM, error)

NewByAlias creates a model provider from a new empty factory.

Types

type APIType

type APIType string

APIType defines protocol dialect used by a model provider.

const (
	APIOpenAI           APIType = "openai"
	APIOpenAICompatible APIType = "openai_compatible"
	APIGemini           APIType = "gemini"
	APIAnthropic        APIType = "anthropic"
	APIDeepSeek         APIType = "deepseek"
)

type AuthConfig

type AuthConfig struct {
	Type          AuthType
	TokenEnv      string
	Token         string
	CredentialRef string
	HeaderKey     string
	Prefix        string
}

AuthConfig is provider-agnostic auth configuration.

type AuthType

type AuthType string

AuthType defines model provider authentication strategy.

const (
	AuthAPIKey      AuthType = "api_key"
	AuthBearerToken AuthType = "bearer_token"
	AuthOAuthToken  AuthType = "oauth_token"
)

type Config

type Config struct {
	Alias               string
	Provider            string
	API                 APIType
	Model               string
	BaseURL             string
	Headers             map[string]string
	Timeout             time.Duration
	MaxOutputTok        int
	ContextWindowTokens int
	Auth                AuthConfig
}

Config is a provider-agnostic model alias definition.

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory builds model providers from alias configs.

func NewFactory

func NewFactory() *Factory

NewFactory returns an empty provider factory.

func (*Factory) ListModels

func (f *Factory) ListModels() []string

ListModels returns available aliases from current factory.

func (*Factory) NewByAlias

func (f *Factory) NewByAlias(alias string) (model.LLM, error)

NewByAlias creates a model provider by alias.

func (*Factory) Register

func (f *Factory) Register(cfg Config) error

Register adds or overwrites one alias config.

type RemoteModel

type RemoteModel struct {
	Name                string
	ContextWindowTokens int
	MaxOutputTokens     int
	Capabilities        []string
}

RemoteModel describes one model discovered from provider list APIs.

func DiscoverModels

func DiscoverModels(ctx context.Context, cfg Config) ([]RemoteModel, error)

DiscoverModels queries provider list-model APIs using one provider config. It returns an error when provider does not expose list APIs or auth is invalid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL