forked from phoenix/litellm-mirror
(test) async_fn with stream
This commit is contained in:
parent
c2c186eb28
commit
9d3a28e391
1 changed files with 2 additions and 2 deletions
|
@ -42,7 +42,7 @@ def test_async_response():
|
||||||
def test_get_response_streaming():
|
def test_get_response_streaming():
|
||||||
import asyncio
|
import asyncio
|
||||||
async def test_async_call():
|
async def test_async_call():
|
||||||
user_message = "Hello, how are you?"
|
user_message = "write a short poem in one sentence"
|
||||||
messages = [{"content": user_message, "role": "user"}]
|
messages = [{"content": user_message, "role": "user"}]
|
||||||
try:
|
try:
|
||||||
response = await acompletion(model="azure/chatgpt-v-2", messages=messages, stream=True)
|
response = await acompletion(model="azure/chatgpt-v-2", messages=messages, stream=True)
|
||||||
|
@ -62,7 +62,7 @@ def test_get_response_streaming():
|
||||||
print(f"output: {output}")
|
print(f"output: {output}")
|
||||||
assert output is not None, "output cannot be None."
|
assert output is not None, "output cannot be None."
|
||||||
assert isinstance(output, str), "output needs to be of type str"
|
assert isinstance(output, str), "output needs to be of type str"
|
||||||
assert len(output) > 0, "Length of output needs to be greater than 0."
|
assert len(output) > 0, f"Length of output needs to be greater than 0. {output}"
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"An exception occurred: {e}")
|
pytest.fail(f"An exception occurred: {e}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue