# `LLMDB.Sources.Local`
[🔗](https://github.com/agentjido/llm_db/blob/main/lib/llm_db/sources/local.ex#L1)

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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
