summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-04-06 21:17:50 +0200
committerGitHub <noreply@github.com>2024-04-06 21:17:50 +0200
commit2beade3c24e2f540548d5e750113740f0f676dd2 (patch)
tree423336bb9028a6fd9eb974e5316ce4a7e621d060
parentUpdate types.py (diff)
downloadgpt4free-2beade3c24e2f540548d5e750113740f0f676dd2.tar
gpt4free-2beade3c24e2f540548d5e750113740f0f676dd2.tar.gz
gpt4free-2beade3c24e2f540548d5e750113740f0f676dd2.tar.bz2
gpt4free-2beade3c24e2f540548d5e750113740f0f676dd2.tar.lz
gpt4free-2beade3c24e2f540548d5e750113740f0f676dd2.tar.xz
gpt4free-2beade3c24e2f540548d5e750113740f0f676dd2.tar.zst
gpt4free-2beade3c24e2f540548d5e750113740f0f676dd2.zip
Diffstat (limited to '')
-rw-r--r--g4f/client/async.py10
1 files changed, 2 insertions, 8 deletions
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