MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _routing_infeasible_payload

Function _routing_infeasible_payload

uncommon_route/proxy.py:1975–1998  ·  view source on GitHub ↗
(
    error: RoutingInfeasibleError,
    *,
    api_format: str = "openai",
)

Source from the content-addressed store, hash-verified

1973
1974
1975def _routing_infeasible_payload(
1976 error: RoutingInfeasibleError,
1977 *,
1978 api_format: str = "openai",
1979) -> dict[str, Any]:
1980 detail = error.infeasibility.as_dict()
1981 code = str(detail.pop("code"))
1982 message = str(detail.pop("message"))
1983 if api_format == "anthropic":
1984 body = anthropic_error_response(400, message)
1985 body["error"]["code"] = code
1986 if detail:
1987 body["error"]["details"] = detail
1988 return body
1989 payload: dict[str, Any] = {
1990 "error": {
1991 "message": message,
1992 "type": "routing_infeasible",
1993 "code": code,
1994 },
1995 }
1996 if detail:
1997 payload["error"]["details"] = detail
1998 return payload
1999
2000
2001def _routing_infeasible_response(

Callers 3

handle_selectorFunction · 0.85
handle_route_previewFunction · 0.85

Calls 3

anthropic_error_responseFunction · 0.90
popMethod · 0.80
as_dictMethod · 0.45

Tested by

no test coverage detected