summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkqlio67 <kqlio67@users.noreply.github.com>2024-09-26 20:38:34 +0200
committerkqlio67 <kqlio67@users.noreply.github.com>2024-09-26 20:38:34 +0200
commit6a2e83c6c3dac4ba48d1769dd8ed338ecb148924 (patch)
tree3f3127fbcea768334f87ef163fd008857715d4f9
parentfeat(g4f/client/async_client.py): enhance image generation and logging (diff)
downloadgpt4free-6a2e83c6c3dac4ba48d1769dd8ed338ecb148924.tar
gpt4free-6a2e83c6c3dac4ba48d1769dd8ed338ecb148924.tar.gz
gpt4free-6a2e83c6c3dac4ba48d1769dd8ed338ecb148924.tar.bz2
gpt4free-6a2e83c6c3dac4ba48d1769dd8ed338ecb148924.tar.lz
gpt4free-6a2e83c6c3dac4ba48d1769dd8ed338ecb148924.tar.xz
gpt4free-6a2e83c6c3dac4ba48d1769dd8ed338ecb148924.tar.zst
gpt4free-6a2e83c6c3dac4ba48d1769dd8ed338ecb148924.zip
-rw-r--r--etc/unittest/async_client.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/etc/unittest/async_client.py b/etc/unittest/async_client.py
index a49b90ed..06ea5cdb 100644
--- a/etc/unittest/async_client.py
+++ b/etc/unittest/async_client.py
@@ -32,13 +32,13 @@ class AsyncTestPassModel(unittest.IsolatedAsyncioTestCase):
async def test_max_stream(self):
client = AsyncClient(provider=YieldProviderMock)
messages = [{'role': 'user', 'content': chunk} for chunk in ["How ", "are ", "you", "?"]]
- response = client.chat.completions.create(messages, "Hello", stream=True)
+ response = await client.chat.completions.create(messages, "Hello", stream=True)
async for chunk in response:
self.assertIsInstance(chunk, ChatCompletionChunk)
if chunk.choices[0].delta.content is not None:
self.assertIsInstance(chunk.choices[0].delta.content, str)
messages = [{'role': 'user', 'content': chunk} for chunk in ["You ", "You ", "Other", "?"]]
- response = client.chat.completions.create(messages, "Hello", stream=True, max_tokens=2)
+ response = await client.chat.completions.create(messages, "Hello", stream=True, max_tokens=2)
response = [chunk async for chunk in response]
self.assertEqual(len(response), 3)
for chunk in response:
@@ -53,4 +53,4 @@ class AsyncTestPassModel(unittest.IsolatedAsyncioTestCase):
self.assertEqual("How are you?", response.choices[0].message.content)
if __name__ == '__main__':
- unittest.main() \ No newline at end of file
+ unittest.main()