mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(otel): drop the generic BaseLLMException fallback from exception_type
The fallback mapped every unbranched provider error by status code on every route, which changed the exception class and HTTP status for those providers and failed four provider test suites in CI. The /v1/messages handler change alone covers the ticket, since the anthropic branch already maps its errors
This commit is contained in:
parent
666648d58c
commit
d2e4e74685
2 changed files with 0 additions and 39 deletions
|
|
@ -2486,18 +2486,6 @@ def exception_type(
|
|||
exception_provider=exception_provider,
|
||||
extra_information=extra_information,
|
||||
)
|
||||
from litellm.llms.base_llm.chat.transformation import BaseLLMException
|
||||
|
||||
if custom_llm_provider and isinstance(original_exception, BaseLLMException):
|
||||
_map_openai_like_exception(
|
||||
model=model,
|
||||
original_exception=mappable_exception,
|
||||
custom_llm_provider=custom_llm_provider,
|
||||
error_str=error_str,
|
||||
exception_type=exception_type,
|
||||
exception_provider=exception_provider,
|
||||
extra_information=extra_information,
|
||||
)
|
||||
if "BadRequestError.__init__() missing 1 required positional argument: 'param'" in str(
|
||||
original_exception
|
||||
): # deal with edge-case invalid request error bug in openai-python sdk
|
||||
|
|
|
|||
|
|
@ -1092,30 +1092,3 @@ def test_bedrock_mantle_context_overflow_maps_to_context_window_exceeded():
|
|||
|
||||
assert excinfo.value.status_code == 400
|
||||
assert "prompt is too long: 1055489 tokens > 1050000 maximum" in excinfo.value.message
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"status_code, expected_class",
|
||||
[(401, litellm.AuthenticationError), (429, litellm.RateLimitError)],
|
||||
)
|
||||
def test_a_base_llm_exception_without_a_provider_branch_maps_by_status_code(
|
||||
status_code, expected_class, quiet_exception_mapping
|
||||
):
|
||||
"""Regression test for LIT-6164. Native /v1/messages handlers raise raw
|
||||
BaseLLMException, and providers without an exception_type branch (e.g.
|
||||
minimax) must keep the upstream status instead of collapsing every failure
|
||||
into a 500 APIConnectionError once that route maps its exceptions."""
|
||||
from litellm.llms.base_llm.chat.transformation import BaseLLMException
|
||||
|
||||
original_exception = BaseLLMException(status_code=status_code, message="upstream rejected the call")
|
||||
|
||||
with pytest.raises(expected_class) as excinfo:
|
||||
exception_type(
|
||||
model="MiniMax-M2.5",
|
||||
original_exception=original_exception,
|
||||
custom_llm_provider="minimax",
|
||||
)
|
||||
|
||||
assert excinfo.value.status_code == status_code
|
||||
assert excinfo.value.llm_provider == "minimax"
|
||||
assert "MinimaxException" in excinfo.value.message
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue