From 2beade3c24e2f540548d5e750113740f0f676dd2 Mon Sep 17 00:00:00 2001 From: H Lohaus Date: Sat, 6 Apr 2024 21:17:50 +0200 Subject: Update async.py --- g4f/client/async.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'g4f/client') diff --git a/g4f/client/async.py b/g4f/client/async.py index 96c715d4..c9ffd6cf 100644 --- a/g4f/client/async.py +++ b/g4f/client/async.py @@ -13,7 +13,7 @@ from ..typing import Union, Iterator, Messages, ImageType, AsyncIerator from ..image import ImageResponse as ImageProviderResponse from ..errors import NoImageResponseError, RateLimitError, MissingAuthError from .. import get_model_and_provider, get_last_provider -from .helper import read_json +from .helper import read_json, find_stop from .Provider.BingCreateImages import BingCreateImages from .Provider.needs_auth import Gemini, OpenaiChat @@ -30,7 +30,7 @@ async def iter_response( finish_reason = None completion_id = ''.join(random.choices(string.ascii_letters + string.digits, k=28)) count: int = 0 - async for idx, chunk in response: + async for chunk in response: if isinstance(chunk, FinishReason): finish_reason = chunk.reason break @@ -71,12 +71,6 @@ class Client(BaseClient): self.chat: Chat = Chat(self, provider) self.images: Images = Images(self, image_provider) -def filter_none(**kwargs): - for key in list(kwargs.keys()): - if kwargs[key] is None: - del kwargs[key] - return kwargs - class Completions(): def __init__(self, client: Client, provider: ProviderType = None): self.client: Client = client -- cgit v1.2.3