llmcfg

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderOpenAI is the OpenAI provider.
	ProviderOpenAI = "openai"
	// ProviderAnthropic is the Anthropic provider.
	ProviderAnthropic = "anthropic"
)

Variables

View Source
var (
	// ProvidersLLM provides the LLM provider for Wire dependency injection.
	ProvidersLLM = wire.NewSet(
		ProvideLLMProvider,
	)
)

Functions

func ProvideLLMProvider

func ProvideLLMProvider(c *Config) (llm.Provider, error)

ProvideLLMProvider provides an LLM provider from config.

func RegisterLLMProvider

func RegisterLLMProvider(i do.Injector)

RegisterLLMProvider registers an llm.Provider with the injector.

Types

type Config

type Config struct {
	OpenAI    *openai.Config    `env:"init"     envPrefix:"OPENAI_"    json:"openai"`
	Anthropic *anthropic.Config `env:"init"     envPrefix:"ANTHROPIC_" json:"anthropic"`
	Provider  string            `env:"PROVIDER" json:"provider"`
}

Config is the configuration for the LLM provider.

func (*Config) ProvideLLMProvider

func (c *Config) ProvideLLMProvider(ctx context.Context) (llm.Provider, error)

ProvideLLMProvider provides an LLM provider based on config.

func (*Config) ValidateWithContext

func (c *Config) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates the config.

Jump to

Keyboard shortcuts

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