Skip to content

Function: rankModelIdLive()

rankModelIdLive(load, search, options?): Promise<ResolvedModel>

rankModelId against a catalogue the caller may be holding stale: match the loaded snapshot, and on a miss reload once with force and match again. That way a model deployed after the catalogue was cached still resolves on first use, without a restart and without giving up caching.

The catalogue arrives as a loader rather than a client so the caller keeps ownership of how it is cached - listServingEndpoints and its CacheManager, a plain process-lifetime field in a CLI, or a test double. Only one reload is attempted: a genuinely unknown name should fail fast rather than re-list on every request.

(force) => Promise<readonly object[]>

Returns the catalogue; force asks it to bypass its cache.

string

ResolveModelOptions = {}

Promise<ResolvedModel>