diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-05-22 20:18:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-22 20:18:42 +0200 |
commit | 6830dfcc6439562af805c8ea72e6e45bba5da401 (patch) | |
tree | 30609eb68c513387bd616a14f9cec3b82db6eaff /g4f/client/client.py | |
parent | Improve readme (diff) | |
parent | Fix image vision in You.com provider (diff) | |
download | gpt4free-6830dfcc6439562af805c8ea72e6e45bba5da401.tar gpt4free-6830dfcc6439562af805c8ea72e6e45bba5da401.tar.gz gpt4free-6830dfcc6439562af805c8ea72e6e45bba5da401.tar.bz2 gpt4free-6830dfcc6439562af805c8ea72e6e45bba5da401.tar.lz gpt4free-6830dfcc6439562af805c8ea72e6e45bba5da401.tar.xz gpt4free-6830dfcc6439562af805c8ea72e6e45bba5da401.tar.zst gpt4free-6830dfcc6439562af805c8ea72e6e45bba5da401.zip |
Diffstat (limited to 'g4f/client/client.py')
-rw-r--r-- | g4f/client/client.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/g4f/client/client.py b/g4f/client/client.py index acf53c70..63bae4fe 100644 --- a/g4f/client/client.py +++ b/g4f/client/client.py @@ -6,6 +6,7 @@ import string from ..typing import Union, Iterator, Messages, ImageType from ..providers.types import BaseProvider, ProviderType, FinishReason +from ..providers.conversation import BaseConversation from ..image import ImageResponse as ImageProviderResponse from ..errors import NoImageResponseError from .stubs import ChatCompletion, ChatCompletionChunk, Image, ImagesResponse @@ -29,6 +30,9 @@ def iter_response( if isinstance(chunk, FinishReason): finish_reason = chunk.reason break + elif isinstance(chunk, BaseConversation): + yield chunk + continue content += str(chunk) if max_tokens is not None and idx + 1 >= max_tokens: finish_reason = "length" |