lookup static method
- String id
Looks up the ModelSpec for id.
Throws ArgumentError if id is not registered in the catalog.
Throws UnsupportedError if the model is registered but not yet
validated for production use.
final spec = ModelCatalog.lookup('bge-small-en-v1.5');
print(spec.meta['dimensions']); // 384
Implementation
static ModelSpec lookup(String id) {
final catalog = _catalog;
final spec = catalog[id];
if (spec == null) {
final known = catalog.keys.join(', ');
throw ArgumentError(
"Unknown embedding model ID '$id'. "
"Registered models: $known. "
"Add the model to ModelCatalog to use it.",
);
}
if (!(_validated[id] ?? false)) {
throw UnsupportedError(
"Embedding model '$id' is registered in the catalog but has not "
"yet been validated for production use. It will be enabled in "
"a future release.",
);
}
return spec;
}