Packages
llm_db
2025.12.4
2026.7.3
2026.7.2
2026.7.1
2026.7.0
2026.6.4
2026.6.3
2026.6.2
2026.6.1
2026.6.0
2026.5.2
2026.5.1
2026.5.0
2026.4.8
2026.4.7
2026.4.6
2026.4.5
2026.4.4
2026.4.3
2026.4.2
2026.4.1
2026.4.0
2026.3.3
2026.3.2
2026.3.1
2026.3.0
2026.2.9
2026.2.8
2026.2.7
2026.2.6
2026.2.5
2026.2.4
2026.2.3
2026.2.2
2026.2.1
2026.2.0
2026.1.5
2026.1.4
2026.1.3
2026.1.2
2026.1.1
2026.1.0
2025.12.4
2025.12.3
2025.12.2
2025.12.1
2025.11.18-preview
2025.11.14-preview
2025.11.7-preview
LLM model metadata catalog with fast, capability-aware lookups.
Current section
Files
Jump to
Current section
Files
lib/llm_db/application.ex
defmodule LLMDB.Application do
@moduledoc """
OTP Application for LLMDB.
Automatically loads the pre-built snapshot on application start.
The snapshot is generated by `mix llm_db.build` and packaged
with the release.
"""
use Application
@impl true
def start(_type, _args) do
# Load .env file if it exists
load_dotenv()
# Ensure modality atoms exist before loading snapshot
_ = LLMDB.Generated.ValidModalities.list()
# Ensure provider atoms exist before loading snapshot
_ = LLMDB.Generated.ValidProviders.list()
if Application.get_env(:llm_db, :skip_packaged_load, false) do
{:ok, self()}
else
case LLMDB.load() do
{:ok, _snapshot} ->
{:ok, self()}
{:error, reason} ->
{:error, reason}
end
end
end
defp load_dotenv do
env_path = Path.join(File.cwd!(), ".env")
if File.exists?(env_path) and not File.dir?(env_path) do
vars = Dotenvy.source!(env_path)
System.put_env(vars)
end
end
end