Skip to main content

route_request

Function route_request 

Source
pub fn route_request(
    parsed: &mut Value,
    provider_label: &str,
    upstreams: &Upstreams,
    rules: &RoutingRules,
    xlat_ok: bool,
) -> Option<RouteDecision>
Expand description

Applies the alias rules to a parsed request body. On a match the body’s model field is rewritten in place and the decision is returned; without a match or reachable target the body is untouched and None is returned.

xlat_ok — the caller vouches that this request may be shape-translated (exact messages-create path, shape-xlat compiled in). Subpaths like count_tokens/batches have no OpenAI equivalent and must stay within-shape.