ExAthena.ProviderRegistry (ExAthena v0.15.0)

Copy Markdown View Source

GenServer that loads provider specs from ~/.config/ex_athena/providers/ at startup and makes them available for lookup.

Each .json file in the directory defines one provider. Files that fail validation (missing required fields, unknown adapter, malformed JSON) are skipped with a warning log — a single bad file does not prevent others from loading.

Configuration

The directory path defaults to ~/.config/ex_athena/providers/ and can be overridden at startup (primarily for tests):

start_supervised!({ExAthena.ProviderRegistry, providers_dir: "/tmp/my-dir"})

To disable the registry in application config (e.g. during tests):

config :ex_athena, enable_provider_registry: false

Public API

ProviderRegistry.lookup("my-ollama")
ProviderRegistry.lookup(:"my-ollama")
ProviderRegistry.list()

Summary

Functions

Returns a specification to start this module under a supervisor.

Return all loaded provider specs.

Look up a provider spec by name. Accepts both atom and string names.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

list()

@spec list() :: [ExAthena.ProviderSpec.t()]

Return all loaded provider specs.

lookup(name)

@spec lookup(atom() | String.t()) :: {:ok, ExAthena.ProviderSpec.t()} | :error

Look up a provider spec by name. Accepts both atom and string names.

Returns {:ok, %ProviderSpec{}} if found, :error otherwise.