From 0b712c2bde77fe7e3e347d71d5de3c9e62f26738 Mon Sep 17 00:00:00 2001 From: H Lohaus Date: Fri, 12 Apr 2024 18:01:54 +0200 Subject: Add unittests for async client (#1830) * Add unittests for async client * Add pollyfill for anext * Update integration tests --- g4f/client/async_client.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'g4f/client') diff --git a/g4f/client/async_client.py b/g4f/client/async_client.py index bab2fde9..51a9cf83 100644 --- a/g4f/client/async_client.py +++ b/g4f/client/async_client.py @@ -16,6 +16,13 @@ from ..errors import NoImageResponseError from ..image import ImageResponse as ImageProviderResponse from ..providers.base_provider import AsyncGeneratorProvider +try: + anext +except NameError: + async def anext(iter): + async for chunk in iter: + return chunk + async def iter_response( response: AsyncIterator[str], stream: bool, -- cgit v1.2.3