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 routing rules to a parsed request body. On a routing decision the body’s model field is rewritten in place and the full decision is returned; on any miss/failure the body is untouched and None is returned (fail-open passthrough).

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.