Candil.ConfigManager (Candil v2.1.0)

Copy Markdown View Source

Reads, validates, and normalizes LLM/embedding provider configuration.

Provides a consistent interface for configuration that may come from JSON files, environment variables, or application env. Used by diagnostics tools to validate provider settings before probing.

This is complementary to Candil.Config — while Candil.Config stores structured engine/model/provider definitions in ETS, Candil.ConfigManager handles raw map-based config validation and normalization for ad-hoc provider connections.

Summary

Types

Normalized provider config

Functions

Returns default config for a given provider type.

Returns the list of known embed providers.

Returns the list of known LLM providers.

Normalizes a config map: fills in missing keys with defaults for the given provider type.

Validates a provider configuration map.

Types

provider_config()

@type provider_config() :: %{
  required(String.t()) => String.t(),
  optional(String.t()) => term()
}

Normalized provider config

Functions

defaults(arg1)

@spec defaults(String.t()) :: map()

Returns default config for a given provider type.

embed_providers()

@spec embed_providers() :: [String.t()]

Returns the list of known embed providers.

llm_providers()

@spec llm_providers() :: [String.t()]

Returns the list of known LLM providers.

normalize(config)

@spec normalize(map()) :: map()

Normalizes a config map: fills in missing keys with defaults for the given provider type.

validate(config)

@spec validate(map()) :: :ok | {:error, [String.t()]}

Validates a provider configuration map.

Returns :ok or {:error, list(String.t())} with all validation failures.