ExAthena.ProviderSpec (ExAthena v0.15.1)

Copy Markdown View Source

Represents a provider loaded from a JSON file in the providers config directory.

JSON format

{
  "name": "my-ollama",
  "adapter": "req_llm",
  "req_llm_provider_tag": "openai",
  "base_url": "http://localhost:11434/v1",
  "api_key": "optional",
  "default_model": "qwen3-coder",
  "metadata": {}
}

Required fields: name, adapter. Known adapters: "req_llm", "mock".

Summary

Functions

Parse a decoded JSON map into a ProviderSpec.

Types

t()

@type t() :: %ExAthena.ProviderSpec{
  adapter: atom(),
  api_key: String.t() | nil,
  api_key_env: String.t() | nil,
  api_key_prompt: boolean(),
  base_url: String.t() | nil,
  default_model: String.t() | nil,
  display_name: String.t() | nil,
  extra_headers: map(),
  metadata: map(),
  model_discovery: map() | nil,
  module: module(),
  name: String.t(),
  req_llm_provider_tag: String.t() | nil
}

Functions

from_json(json)

@spec from_json(map()) :: {:ok, t()} | {:error, String.t()}

Parse a decoded JSON map into a ProviderSpec.

Returns {:ok, spec} on success or {:error, reason} when required fields are missing or the adapter is not recognized.