Ragex. AI. Config
(Ragex v0.14.1)
View Source
Manages AI provider configuration.
Supports multiple AI providers with automatic fallback.
Loads settings from:
- config/config.exs (compile-time defaults)
- config/runtime.exs (runtime env vars)
- Function call overrides
Configuration
config :ragex, :ai,
providers: [:openai, :anthropic, :deepseek_r1, :ollama],
default_provider: :openai,
fallback_enabled: true
config :ragex, :ai_providers,
openai: [endpoint: "https://api.openai.com/v1", model: "gpt-4-turbo"],
anthropic: [endpoint: "https://api.anthropic.com/v1", model: "claude-3-sonnet-20240229"],
deepseek_r1: [endpoint: "https://api.deepseek.com", model: "deepseek-chat"],
ollama: [endpoint: "http://localhost:11434", model: "codellama"]
Summary
Functions
Get API configuration for a specific provider.
Check if fallback to alternative providers is enabled.
Get generation options, merging config with overrides.
Get the default provider (returns provider name as atom).
Get the configured default AI provider module.
Get the configured default provider name.
Get list of all configured providers.
Validate that required configuration is present for all providers.
Functions
Get API configuration for a specific provider.
Check if fallback to alternative providers is enabled.
Get generation options, merging config with overrides.
@spec get_default_provider() :: atom()
Get the default provider (returns provider name as atom).
This is an alias for provider_name/0 with more explicit naming.
Returns the configured default provider identifier.
Returns
- Provider name atom (e.g.,
:deepseek_r1,:openai,:anthropic)
Examples
iex> Config.get_default_provider()
:deepseek_r1Configuration
config :ragex, :ai,
default_provider: :openai
Get the configured default AI provider module.
Get the configured default provider name.
Get list of all configured providers.
Validate that required configuration is present for all providers.