LLMDB.Sources.Local (LLM DB v2026.11.4)

Copy Markdown View Source

Loads model metadata from local TOML files in a directory structure.

Directory structure:

priv/llm_db/local/
├── openai/
│   ├── provider.toml         # Provider definition
│   ├── gpt-4o.toml           # Model
│   └── gpt-4o-mini.toml      # Model
├── anthropic/
│   ├── provider.toml
│   └── claude-3-5-sonnet.toml
└── ...

Provider TOML files are always named provider.toml and contain provider metadata. Model TOML files contain model metadata with provider field linking to provider.

Options

  • :dir - Directory path to scan (required)
  • :file_reader - Function for reading files (default: &File.read!/1)
  • :dir_reader - Function for listing directories (default: &File.ls!/1)

Examples

iex> Local.load(%{dir: "priv/llm_db"})
{:ok, %{"openai" => %{id: :openai, models: [...]}, ...}}

Error Handling

Individual file parse failures are logged and skipped. Returns {:error, :directory_not_found} if the directory doesn't exist.