mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
add context window exceeded error mapping to openai
This commit is contained in:
parent
d7fe4f6c90
commit
f7955d52b5
4 changed files with 10 additions and 5 deletions
|
@ -1343,6 +1343,12 @@ def exception_type(model, original_exception, custom_llm_provider):
|
|||
original_exception.llm_provider = "azure"
|
||||
else:
|
||||
original_exception.llm_provider = "openai"
|
||||
if "This model's maximum context length is" in original_exception:
|
||||
raise ContextWindowExceededError(
|
||||
message=str(original_exception),
|
||||
model=model,
|
||||
llm_provider=original_exception.llm_provider
|
||||
)
|
||||
raise original_exception
|
||||
elif model:
|
||||
error_str = str(original_exception)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue