mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
test(test_streaming.py): try-except replicate api instability
This commit is contained in:
parent
c9a424d28d
commit
831745e710
2 changed files with 10 additions and 1 deletions
|
@ -1265,6 +1265,8 @@ async def test_completion_replicate_llama3_streaming(sync_mode):
|
||||||
raise Exception("finish reason not set")
|
raise Exception("finish reason not set")
|
||||||
if complete_response.strip() == "":
|
if complete_response.strip() == "":
|
||||||
raise Exception("Empty response received")
|
raise Exception("Empty response received")
|
||||||
|
except litellm.UnprocessableEntityError as e:
|
||||||
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
|
|
||||||
|
|
|
@ -6160,7 +6160,6 @@ def exception_type(
|
||||||
)
|
)
|
||||||
elif (
|
elif (
|
||||||
original_exception.status_code == 400
|
original_exception.status_code == 400
|
||||||
or original_exception.status_code == 422
|
|
||||||
or original_exception.status_code == 413
|
or original_exception.status_code == 413
|
||||||
):
|
):
|
||||||
exception_mapping_worked = True
|
exception_mapping_worked = True
|
||||||
|
@ -6170,6 +6169,14 @@ def exception_type(
|
||||||
llm_provider="replicate",
|
llm_provider="replicate",
|
||||||
response=original_exception.response,
|
response=original_exception.response,
|
||||||
)
|
)
|
||||||
|
elif original_exception.status_code == 422:
|
||||||
|
exception_mapping_worked = True
|
||||||
|
raise UnprocessableEntityError(
|
||||||
|
message=f"ReplicateException - {original_exception.message}",
|
||||||
|
model=model,
|
||||||
|
llm_provider="replicate",
|
||||||
|
response=original_exception.response,
|
||||||
|
)
|
||||||
elif original_exception.status_code == 408:
|
elif original_exception.status_code == 408:
|
||||||
exception_mapping_worked = True
|
exception_mapping_worked = True
|
||||||
raise Timeout(
|
raise Timeout(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue