ModelCatalog class final

Allowlist of supported embedding models for dense retrieval.

ModelCatalog is the single place where models are registered and the concrete AllowlistProvider implementation used with ModelDownloader. All models must appear here before they can be downloaded — attempting to look up an unregistered model ID throws ArgumentError. Attempting to load a model whose validation flag is false throws UnsupportedError.

Why AllowlistProvider

ModelCatalog implements AllowlistProvider from betto_onnxrt so that ModelDownloader can be constructed with allowlist: ModelCatalog() and will reject any model not in this catalog before touching the network.

Adding a new model

  1. Add a private ModelSpec field below (as a static final).
  2. Insert it into the _catalog map with its ID as the key.
  3. Add '<id>': false to _validated until the model has been tested in CI; flip it to true when the validation plan is complete.

Usage

final spec = ModelCatalog.lookup('bge-small-en-v1.5');
print(spec.meta['dimensions']); // 384

// Use with ModelDownloader to gate downloads:
final downloader = ModelDownloader(allowlist: ModelCatalog());
Implemented types

Constructors

ModelCatalog()
Creates a ModelCatalog.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

isAllowed(ModelSpec spec) bool
Returns true if spec is registered in this catalog.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

all Iterable<ModelSpec>
Returns all registered ModelSpecs (validated and unvalidated).
no setter

Static Methods

isKnown(String id) bool
Returns true if id is a known registered model ID (validated or not).
lookup(String id) ModelSpec
Looks up the ModelSpec for id.

Constants

defaultModelId → const String
The ID of the default/recommended production model.