Skip to main content

resolve_route

Function resolve_route 

Source
pub async fn resolve_route<'a>(
    requested: &'a str,
    profiles: &'a [InferenceProfile],
    catalog: &dyn ModelCatalogPort,
) -> ModelRoute<'a>
Expand description

Resolve a requested model id into a ModelRoute.

Resolution order, first match wins:

  1. No : in the id — ModelRoute::Bare, without touching the catalog.
  2. The full id resolves in the catalog — ModelRoute::Bare. A real model whose name contains a colon always beats a profile reading.
  3. The suffix after the last : matches a configured profile — ModelRoute::Profiled.
  4. The base resolves in the catalog — ModelRoute::ProfileNotFound.
  5. Otherwise ModelRoute::Bare, leaving the existing model-not-found path to report it.

Splitting on the last colon lets a colon-bearing model name still carry a profile (qwen:27b:coding).

Catalog errors are treated as “not found” and logged: a degraded catalog should not turn into a hard failure on a request that may not need a profile at all.