From fd97cceab0727e0e97e15c45c5b7ba979e143562 Mon Sep 17 00:00:00 2001 From: hlohaus <983577+hlohaus@users.noreply.github.com> Date: Fri, 24 Jan 2025 04:56:26 +0100 Subject: Restore AsyncClient streaming return type Improve error handling in DDG use OpenaiAPI provider in DeepInfraChat Support api_base and response_type parameters in API --- etc/unittest/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/unittest/client.py b/etc/unittest/client.py index c8882837..7ef4dbfe 100644 --- a/etc/unittest/client.py +++ b/etc/unittest/client.py @@ -37,14 +37,14 @@ 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 = await client.chat.completions.create(messages, "Hello", stream=True) + response = client.chat.completions.create(messages, "Hello", stream=True) async for chunk in response: chunk: ChatCompletionChunk = chunk 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 = await client.chat.completions.create(messages, "Hello", stream=True, max_tokens=2) + response = client.chat.completions.create(messages, "Hello", stream=True, max_tokens=2) response_list = [] async for chunk in response: response_list.append(chunk) -- cgit v1.2.3