LLMDB.Packaged (LLM DB v2026.7.3)

Copy Markdown View Source

Provides access to the packaged base snapshot.

This is NOT a Source - it returns the pre-processed, version-stable snapshot that ships with each release. The snapshot has already been normalized, validated, merged, and enriched by the build-time ETL pipeline. Consumer filters and runtime indexes are applied later by LLMDB.load/1.

Build-time sources produce future packaged snapshots through LLMDB.Engine. They are not contacted or merged automatically when consumers load this packaged snapshot at runtime.

Loading Strategy

Behavior controlled by :compile_embed configuration option:

  • true - Snapshot embedded at compile-time (zero runtime IO, recommended for production)
  • false - Snapshot loaded at runtime from priv directory with integrity checking

Integrity and atom safety

Production deployments can use compile_embed: true to eliminate runtime file I/O. Embedded and file-based documents pass through the same checksum, migration, structural-validation, and bounded atom-decoding contract.

Snapshot IDs detect accidental corruption or content mismatch. They do not authenticate the snapshot or its publisher.

Integrity Policy

The :integrity_policy config option controls integrity check behavior:

  • :strict (default) - Fail on snapshot ID mismatch
  • :warn - Log warning and continue, useful in dev when snapshot regenerates frequently
  • :off - Skip mismatch warnings entirely

In development, use :warn mode. The snapshot file is marked as an @external_resource, so Mix automatically recompiles the module when it changes, refreshing the hash.

Summary

Functions

Returns the packaged base snapshot loaded from the runtime file.

Returns the absolute path to the packaged snapshot file.

Functions

snapshot()

@spec snapshot() :: map() | nil

Returns the packaged base snapshot loaded from the runtime file.

This snapshot is the pre-processed output of the ETL pipeline and serves as the stable foundation for this package version.

The same checksum, migration, structural validation, and atom-safety boundary used by compile-time embedded snapshots is applied.

Returns

Fully indexed snapshot map with providers, models, and indexes, or nil if not available.

snapshot_path()

@spec snapshot_path() :: String.t()

Returns the absolute path to the packaged snapshot file.

Returns

String path to priv/llm_db/snapshot.json within the application directory.