ElixirScope.AI.LLM.Config (elixir_scope v0.0.1)
Configuration management for LLM providers.
Handles API keys, provider selection, and other configuration options for the LLM integration layer.
Summary
Functions
Gets all configuration as a map for debugging. Note: API keys and credentials are masked for security.
Gets the fallback provider to use when primary fails.
Gets the Gemini API key from configuration or environment.
Gets the Gemini API base URL.
Gets the Gemini model to use.
Gets the primary provider to use.
Gets the request timeout in milliseconds.
Gets the Vertex AI base URL.
Gets the Vertex AI credentials from the JSON file.
Gets the Vertex AI JSON credentials file path.
Gets the Vertex AI model to use.
Checks if the configuration is valid for the given provider.
Functions
@spec debug_config() :: map()
Gets all configuration as a map for debugging. Note: API keys and credentials are masked for security.
@spec get_fallback_provider() :: :mock
Gets the fallback provider to use when primary fails.
@spec get_gemini_api_key() :: String.t() | nil
Gets the Gemini API key from configuration or environment.
Checks in order:
- Application config: config :elixir_scope, :gemini_api_key
- Environment variable: GEMINI_API_KEY
- Returns nil if not found
@spec get_gemini_base_url() :: String.t()
Gets the Gemini API base URL.
@spec get_gemini_model() :: String.t()
Gets the Gemini model to use.
@spec get_primary_provider() :: :vertex | :gemini | :mock
Gets the primary provider to use.
Returns :vertex if Vertex credentials are available, :gemini if API key is available, otherwise :mock. Can be overridden with config or environment variable. In test environment, always returns :mock unless explicitly overridden.
@spec get_request_timeout() :: integer()
Gets the request timeout in milliseconds.
@spec get_vertex_base_url() :: String.t()
Gets the Vertex AI base URL.
@spec get_vertex_credentials() :: map() | nil
Gets the Vertex AI credentials from the JSON file.
Returns a map with the parsed JSON credentials or nil if file not found/invalid.
@spec get_vertex_json_file() :: String.t() | nil
Gets the Vertex AI JSON credentials file path.
Checks in order:
- Environment variable: VERTEX_JSON_FILE
- Application config: config :elixir_scope, :vertex_json_file
- Returns nil if not found
@spec get_vertex_model() :: String.t()
Gets the Vertex AI model to use.
Checks if the configuration is valid for the given provider.