Planck.AI.Config (Planck.AI v0.1.8)

Copy Markdown View Source

Converts model configuration into Planck.AI.Model structs.

The entry point is from_config/2, which accepts the v0.1.6 config format: a providers map (user-keyed) and a models list where each entry references a provider by key.

Format

providers = %{
  "anthropic" => %{"type" => "anthropic"},
  "nvidia"    => %{"type" => "openai", "base_url" => "https://integrate.api.nvidia.com/v1", "identifier" => "NVIDIA"},
  "local"     => %{"type" => "openai", "base_url" => "http://localhost:11434", "has_api_key" => false}
}

models = [
  %{"id" => "sonnet",   "model" => "claude-sonnet-4-6",             "provider" => "anthropic"},
  %{"id" => "llama70b", "model" => "meta/llama-3.3-70b-instruct",   "provider" => "nvidia"},
  %{"id" => "llama3.2", "model" => "llama3.2",                      "provider" => "local"}
]

models = Planck.AI.Config.from_config(providers, models)

Summary

Functions

Builds a list of Model structs from the v0.1.6 config format, which separates provider entries (keyed map) from model entries (list).

Functions

from_config(providers, models)

@spec from_config(%{required(String.t()) => map()}, [map()]) :: [Planck.AI.Model.t()]

Builds a list of Model structs from the v0.1.6 config format, which separates provider entries (keyed map) from model entries (list).

Each model entry must reference a key in providers via its "provider" field. Invalid entries are skipped with a warning; the rest are returned.