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

Function _should_try_fallback

uncommon_route/proxy.py:4965–4970  ·  view source on GitHub ↗
(status_code: int, content: bytes)

Source from the content-addressed store, hash-verified

4963 return _spend_error(check, api_format=api_format, headers=debug_headers)
4964
4965 def _should_try_fallback(status_code: int, content: bytes) -> bool:
4966 if not is_virtual or not fallback_models:
4967 return False
4968 if status_code in (500, 502, 503, 504):
4969 return True
4970 return status_code in (400, 404, 422) and _is_model_error(content)
4971
4972 def _transport_error_response(exc: httpx.TransportError) -> httpx.Response:
4973 status_code = 504 if isinstance(exc, httpx.TimeoutException) else 502

Callers 2

_select_stream_responseFunction · 0.85
_handle_chat_coreFunction · 0.85

Calls 1

_is_model_errorFunction · 0.85

Tested by

no test coverage detected