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
- Add a private
ModelSpecfield below (as astatic final). - Insert it into the
_catalogmap with its ID as the key. - Add
'<id>': falseto_validateduntil the model has been tested in CI; flip it totruewhen 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
trueifspecis 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
Static Methods
Constants
- defaultModelId → const String
- The ID of the default/recommended production model.