mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
(feat) improve bedrock, sagemaker exception mapping
This commit is contained in:
parent
893a2c3c7b
commit
00ac18e8b7
2 changed files with 18 additions and 2 deletions
|
@ -5895,6 +5895,7 @@ def exception_type(
|
|||
"too many tokens" in error_str
|
||||
or "expected maxLength:" in error_str
|
||||
or "Input is too long" in error_str
|
||||
or "prompt: length: 1.." in error_str
|
||||
or "Too many input tokens" in error_str
|
||||
):
|
||||
exception_mapping_worked = True
|
||||
|
@ -5988,6 +5989,17 @@ def exception_type(
|
|||
llm_provider="sagemaker",
|
||||
response=original_exception.response,
|
||||
)
|
||||
elif (
|
||||
"`inputs` tokens + `max_new_tokens` must be <=" in error_str
|
||||
or "instance type with more CPU capacity or memory" in error_str
|
||||
):
|
||||
exception_mapping_worked = True
|
||||
raise ContextWindowExceededError(
|
||||
message=f"SagemakerException - {error_str}",
|
||||
model=model,
|
||||
llm_provider="sagemaker",
|
||||
response=original_exception.response,
|
||||
)
|
||||
elif custom_llm_provider == "vertex_ai":
|
||||
if (
|
||||
"Vertex AI API has not been used in project" in error_str
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue