test: handle watsonx rate limit error

This commit is contained in:
Krrish Dholakia 2024-05-13 18:27:39 -07:00
parent 155f1f164f
commit d4123951d9
4 changed files with 9 additions and 1 deletions

View file

@ -15,6 +15,7 @@ import dotenv, traceback, random, asyncio, time, contextvars
from copy import deepcopy
import httpx
import litellm
from ._logging import verbose_logger
from litellm import ( # type: ignore
client,

View file

@ -3447,6 +3447,8 @@ async def test_acompletion_stream_watsonx():
# Add any assertions here to check the response
async for chunk in response:
print(chunk)
except litellm.RateLimitError as e:
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")

View file

@ -494,6 +494,8 @@ def test_watsonx_embeddings():
)
print(f"response: {response}")
assert isinstance(response.usage, litellm.Usage)
except litellm.RateLimitError as e:
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")

View file

@ -457,6 +457,7 @@ def test_completion_claude_stream():
except Exception as e:
pytest.fail(f"Error occurred: {e}")
# test_completion_claude_stream()
def test_completion_claude_2_stream():
litellm.set_verbose = True
@ -1416,6 +1417,8 @@ def test_completion_watsonx_stream():
raise Exception("finish reason not set for last chunk")
if complete_response.strip() == "":
raise Exception("Empty response received")
except litellm.RateLimitError as e:
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")