test - test_mock_request_n_greater_than_1

This commit is contained in:
Ishaan Jaff 2024-06-25 10:54:18 -07:00
parent a230f5f6c5
commit 343e3f3e90

View file

@ -58,3 +58,18 @@ async def test_async_mock_streaming_request():
assert (
complete_response == "LiteLLM is awesome"
), f"Unexpected response got {complete_response}"
def test_mock_request_n_greater_than_1():
try:
model = "gpt-3.5-turbo"
messages = [{"role": "user", "content": "Hey, I'm a mock request"}]
response = litellm.mock_completion(model=model, messages=messages, n=5)
print("response: ", response)
assert len(response.choices) == 5
for choice in response.choices:
assert choice.message.content == "This is a mock request"
except:
traceback.print_exc()