fix test_completion_bedrock_httpx_models

This commit is contained in:
Ishaan Jaff 2024-07-10 17:42:40 -07:00
parent 9590d63a38
commit ca76d2fd72

View file

@ -3065,32 +3065,38 @@ def response_format_tests(response: litellm.ModelResponse):
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_completion_bedrock_httpx_models(sync_mode, model): async def test_completion_bedrock_httpx_models(sync_mode, model):
litellm.set_verbose = True litellm.set_verbose = True
try:
if sync_mode: if sync_mode:
response = completion( response = completion(
model=model, model=model,
messages=[{"role": "user", "content": "Hey! how's it going?"}], messages=[{"role": "user", "content": "Hey! how's it going?"}],
temperature=0.2, temperature=0.2,
max_tokens=200, max_tokens=200,
) )
assert isinstance(response, litellm.ModelResponse) assert isinstance(response, litellm.ModelResponse)
response_format_tests(response=response) response_format_tests(response=response)
else: else:
response = await litellm.acompletion( response = await litellm.acompletion(
model=model, model=model,
messages=[{"role": "user", "content": "Hey! how's it going?"}], messages=[{"role": "user", "content": "Hey! how's it going?"}],
temperature=0.2, temperature=0.2,
max_tokens=100, max_tokens=100,
) )
assert isinstance(response, litellm.ModelResponse) assert isinstance(response, litellm.ModelResponse)
print(f"response: {response}")
response_format_tests(response=response)
print(f"response: {response}") print(f"response: {response}")
response_format_tests(response=response) except litellm.RateLimitError as e:
print("got rate limit error=", e)
print(f"response: {response}") pass
except Exception as e:
pytest.fail(f"An error occurred - {str(e)}")
def test_completion_bedrock_titan_null_response(): def test_completion_bedrock_titan_null_response():