Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::config::BundledModels Class Reference

Bundled model registry loaded from bundled_models.yaml. More...

#include <entropic/config/bundled_models.h>

Public Member Functions

std::string load (const std::filesystem::path &path)
 Load registry from YAML file.
 
bool contains (const std::string &key) const
 Check if a key exists in the registry.
 
const BundledModelEntryget (const std::string &key) const
 Get entry by key.
 
std::filesystem::path resolve (const std::string &value) const
 Resolve a model reference to a filesystem path.
 
const std::unordered_map< std::string, BundledModelEntry > & entries () const
 Get all entries.
 
std::string find_by (const std::string &family, const std::string &size_label, const std::string &quant) const
 Look up a registry key by (family, size, quant) (gh#62).
 
std::string auto_discover_and_load ()
 Auto-discover and load bundled_models.yaml.
 

Detailed Description

Bundled model registry loaded from bundled_models.yaml.

Resolution
When a config field contains a registry key (e.g., "primary"), resolve() returns ~/models/gguf/{name}.gguf. When the value is already a path, it passes through with ~ expansion.
Thread safety
Immutable after load. Safe to read from any thread.
Returns
A default-constructed BundledModels instance; populate via load(). @req REQ-CFG-003
Version
2.0.2

Definition at line 77 of file bundled_models.h.

Member Function Documentation

◆ auto_discover_and_load()

std::string entropic::config::BundledModels::auto_discover_and_load ( )

Auto-discover and load bundled_models.yaml.

Searches compile-time install path, source tree path, and CWD-relative "data/" for bundled_models.yaml. Loads the first one found.

Returns
Empty string on success, error message if not found.
Version
2.0.1

Discovery order (mirrors data_dir.cpp::resolve_data_dir): ENTROPIC_DATA_DIR env, then binary-relative via dladdr (<prefix>/share/entropic from librentropic.so's location), then the compile-time install path, source tree, and CWD-relative "data/" fallbacks. The dladdr step makes the registry findable on any install prefix, not just the build host.

Returns
Empty string on success, error message if none found.

Definition at line 267 of file bundled_models.cpp.

◆ contains()

bool entropic::config::BundledModels::contains ( const std::string &  key) const

Check if a key exists in the registry.

Parameters
keyRegistry key.
Returns
true if key exists.
Version
1.8.1
Parameters
keyRegistry key.
Returns
true if key exists.

Definition at line 129 of file bundled_models.cpp.

◆ entries()

const std::unordered_map< std::string, BundledModelEntry > & entropic::config::BundledModels::entries ( ) const

Get all entries.

Returns
Reference to the entries map.
Version
1.8.1
Returns
Reference to the entries map. @utility
Version
1.8.2

Definition at line 248 of file bundled_models.cpp.

◆ find_by()

std::string entropic::config::BundledModels::find_by ( const std::string &  family,
const std::string &  size_label,
const std::string &  quant 
) const

Look up a registry key by (family, size, quant) (gh#62).

gh#62: look up a flat key by (family, size_label, quant).

Returns the flat key of the first matching entry, or empty string if no entry matches. All three selectors must match exactly. Intended for consumers that want to express their tier config as "qwen3_5 / 4b / Q8_0" without remembering the historical flat key.

Until the bundled_models.yaml is fully backfilled with family/size_label/quant on every entry, this query will return "" for entries that don't yet declare them — callers should fall back to direct key lookup.

Parameters
familyFamily label (e.g. "qwen3_5").
size_labelSize label (e.g. "4b").
quantQuant label (e.g. "Q8_0").
Returns
Flat key string, or empty if no match.
Version
2.3.0

Linear scan — entries_.size() is small (< 100 in practice). All three selectors are required and matched exactly. Returns empty string when no entry matches OR when the matching entries haven't been backfilled with structured metadata yet.

Definition at line 161 of file bundled_models.cpp.

◆ get()

const BundledModelEntry * entropic::config::BundledModels::get ( const std::string &  key) const

Get entry by key.

Parameters
keyRegistry key.
Returns
Pointer to entry, or nullptr if not found.
Version
1.8.1
Parameters
keyRegistry key.
Returns
Pointer to entry, or nullptr if not found.

Definition at line 141 of file bundled_models.cpp.

◆ load()

std::string entropic::config::BundledModels::load ( const std::filesystem::path &  path)

Load registry from YAML file.

Parameters
pathPath to bundled_models.yaml.
Returns
Empty string on success, error message on failure.
Version
1.8.1
Parameters
pathPath to bundled_models.yaml.
Returns
Empty string on success, error message on failure.

Definition at line 95 of file bundled_models.cpp.

◆ resolve()

std::filesystem::path entropic::config::BundledModels::resolve ( const std::string &  value) const

Resolve a model reference to a filesystem path.

If value matches a registry key, returns ~/models/gguf/{name}.gguf. Otherwise treats value as a direct path with ~ expansion.

Parameters
valueRegistry key or direct path string.
Returns
Resolved filesystem path.
Version
1.8.1

If the argument is a known registry key, walk the v2.0.5 discovery order:

  1. ENTROPIC_MODEL_DIR env var — if set, wins unconditionally (operator intent), even if the file doesn't exist there yet. This lets the caller pre-specify a download destination.
  2. ~/.entropic/models/<name>.gguf (user convention)
  3. /opt/entropic/models/<name>.gguf (system convention)

For 2 and 3, first directory that actually contains <name>.gguf wins; if neither exists on disk, #2 is returned so error messages point at the most-likely-intended location.

Otherwise the argument is treated as a direct path (with ~-expansion).

Parameters
valueRegistry key or direct path string.
Returns
Resolved filesystem path.

Definition at line 199 of file bundled_models.cpp.


The documentation for this class was generated from the following files: