Documentation
¶
Overview ¶
Package chat is go-tool-base's framework-integration layer over the standalone multi-provider chat client gitlab.com/phpboyscout/go/chat.
It maps GTB's Props/Viper configuration into the module's typed Settings (see config_adapter.go via SettingsFromProps, NewFromProps and NewWithFallbackFromProps), owns the GTB config-key schema (see constants.go), and blank-imports every provider module (see providers.go) so each provider registers itself. The adapter names go/chat types (chat.Config, chat.New, …) directly; they are no longer re-exported from this package.
Code that wants the pure chat client API without the GTB config container imports gitlab.com/phpboyscout/go/chat directly.
Index ¶
- Constants
- func NewFromProps(ctx context.Context, p *props.Props, cfg gochat.Config) (gochat.ChatClient, error)
- func NewWithFallback(ctx context.Context, p *props.Props, cfg gochat.Config, ...) (gochat.ChatClient, error)
- func NewWithFallbackFromProps(ctx context.Context, p *props.Props, cfg gochat.Config, ...) (gochat.ChatClient, error)
- func SettingsFromProps(p *props.Props, cfg gochat.Config) (gochat.Settings, error)
Constants ¶
const ( ConfigKeyOpenAIKey = configRootOpenAI + ".key" ConfigKeyOpenAIEnv = configRootOpenAI + ".env" ConfigKeyOpenAIKeychain = configRootOpenAI + ".keychain" EnvOpenAIKey = "OPENAI_API_KEY" ConfigKeyClaudeKey = configRootClaude + ".key" ConfigKeyClaudeEnv = configRootClaude + ".env" ConfigKeyClaudeKeychain = configRootClaude + ".keychain" EnvClaudeKey = "ANTHROPIC_API_KEY" ConfigKeyGeminiKey = configRootGemini + ".key" ConfigKeyGeminiEnv = configRootGemini + ".env" ConfigKeyGeminiKeychain = configRootGemini + ".keychain" EnvGeminiKey = "GEMINI_API_KEY" )
Per-provider credential config keys.
- ConfigKey<Provider>Key — full config path for the literal API key.
- ConfigKey<Provider>Env — full config path for an env-var reference (the value stored is the NAME of an env var holding the secret).
- ConfigKey<Provider>Keychain — full config path for an OS-keychain reference.
- Env<Provider>Key — well-known unprefixed environment variable used as the ecosystem fallback when no config is present.
const ConfigKeyAIProvider = "ai.provider"
ConfigKeyAIProvider is the config key for the AI provider.
const ConfigKeyAIRequestTimeout = "ai.request_timeout"
ConfigKeyAIRequestTimeout is the config key for the per-request AI timeout (a duration like "8m"). Overrides DefaultChatRequestTimeout.
const EnvAIProvider = "AI_PROVIDER"
EnvAIProvider is the environment variable for overriding the AI provider.
Variables ¶
This section is empty.
Functions ¶
func NewFromProps ¶ added in v0.30.0
func NewFromProps(ctx context.Context, p *props.Props, cfg gochat.Config) (gochat.ChatClient, error)
NewFromProps adapts GTB props into typed chat settings, then constructs a provider client with the reusable package constructor.
func NewWithFallback ¶ added in v0.22.0
func NewWithFallback(ctx context.Context, p *props.Props, cfg gochat.Config, opts ...gochat.FallbackOption) (gochat.ChatClient, error)
NewWithFallback adapts GTB props and framework config before constructing a chat client with optional provider failover.
func NewWithFallbackFromProps ¶ added in v0.30.0
func NewWithFallbackFromProps(ctx context.Context, p *props.Props, cfg gochat.Config, opts ...gochat.FallbackOption) (gochat.ChatClient, error)
NewWithFallbackFromProps adapts GTB props into package-owned chat settings, then constructs either a single provider client or a fallback composite.
Types ¶
This section is empty.