Function: rankModels()
rankModels(
endpoints,query?):object[]
Rank the live catalogue against a ModelQuery, best-first.
Candidates are the classified endpoints in the eligible classes:
classesAtOrBelow the requested modelClass, or - when none is given
- the chat bands only (CHAT_CLASS_ORDER), so a general ask never surfaces an embedding endpoint. Each class bucket is already best-first from classify.classifyEndpoints. Ranking is match then class:
- With a
search, only endpoints matching it survive, ordered by match distance (bucketed via matchBucket so near-identical scores tie), then by class (more capable first), then by the stable within-class rank. - Without a
search, the class-then-rank candidate order stands.
A limit truncates the result. Returns [] when nothing is eligible or
matches - callers layer their own fallback.
Parameters
Section titled “Parameters”endpoints
Section titled “endpoints”readonly object[]
query?
Section titled “query?”limit?
Section titled “limit?”number = ...
modelClass?
Section titled “modelClass?”ChatThinking | ChatBalanced | ChatFast | Embedding = ...
requiresTools?
Section titled “requiresTools?”boolean = ...
search?
Section titled “search?”string = ...
threshold?
Section titled “threshold?”number = ...
Returns
Section titled “Returns”object[]