mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix(utils.py): Fix anthropic tool calling exception mapping
Fixes https://github.com/BerriAI/litellm/issues/4348
This commit is contained in:
parent
72269b4c56
commit
03c7692c81
2 changed files with 19 additions and 8 deletions
|
@ -5922,21 +5922,28 @@ def exception_type(
|
|||
if "prompt is too long" in error_str or "prompt: length" in error_str:
|
||||
exception_mapping_worked = True
|
||||
raise ContextWindowExceededError(
|
||||
message=error_str,
|
||||
message="AnthropicError - {}".format(error_str),
|
||||
model=model,
|
||||
llm_provider="anthropic",
|
||||
)
|
||||
if "Invalid API Key" in error_str:
|
||||
exception_mapping_worked = True
|
||||
raise AuthenticationError(
|
||||
message=error_str,
|
||||
message="AnthropicError - {}".format(error_str),
|
||||
model=model,
|
||||
llm_provider="anthropic",
|
||||
)
|
||||
if "content filtering policy" in error_str:
|
||||
exception_mapping_worked = True
|
||||
raise ContentPolicyViolationError(
|
||||
message=error_str,
|
||||
message="AnthropicError - {}".format(error_str),
|
||||
model=model,
|
||||
llm_provider="anthropic",
|
||||
)
|
||||
if "Client error '400 Bad Request'" in error_str:
|
||||
exception_mapping_worked = True
|
||||
raise BadRequestError(
|
||||
message="AnthropicError - {}".format(error_str),
|
||||
model=model,
|
||||
llm_provider="anthropic",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue