mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
adding contextwindow exceeded error mapping for replicate
This commit is contained in:
parent
509120bf61
commit
ad493a3109
2 changed files with 10 additions and 2 deletions
|
@ -1333,7 +1333,7 @@ def exception_type(model, original_exception, custom_llm_provider):
|
|||
exception_mapping_worked = True
|
||||
if model in litellm.openrouter_models:
|
||||
if original_exception.http_status == 413:
|
||||
raise ContextWindowExceededError(
|
||||
raise InvalidRequestError(
|
||||
message=str(original_exception),
|
||||
model=model,
|
||||
llm_provider="openrouter"
|
||||
|
@ -1382,8 +1382,9 @@ def exception_type(model, original_exception, custom_llm_provider):
|
|||
)
|
||||
elif original_exception.status_code == 413:
|
||||
exception_mapping_worked = True
|
||||
raise ContextWindowExceededError(
|
||||
raise InvalidRequestError(
|
||||
message=f"AnthropicException - {original_exception.message}",
|
||||
model=model,
|
||||
llm_provider="anthropic",
|
||||
)
|
||||
elif original_exception.status_code == 429:
|
||||
|
@ -1408,6 +1409,13 @@ def exception_type(model, original_exception, custom_llm_provider):
|
|||
message=f"ReplicateException - {error_str}",
|
||||
llm_provider="replicate",
|
||||
)
|
||||
elif "input is too long" in error_str:
|
||||
exception_mapping_worked = True
|
||||
raise ContextWindowExceededError(
|
||||
message=f"ReplicateException - {error_str}",
|
||||
model=model,
|
||||
llm_provider="replicate",
|
||||
)
|
||||
elif exception_type == "ModelError":
|
||||
exception_mapping_worked = True
|
||||
raise InvalidRequestError(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue