summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/needs_auth/GeminiPro.py
diff options
context:
space:
mode:
authorkqlio67 <kqlio67@users.noreply.github.com>2024-11-13 13:38:39 +0100
committerkqlio67 <kqlio67@users.noreply.github.com>2024-11-13 13:38:39 +0100
commit795e42a2967f43364128f93fb71625e9e573bf5c (patch)
tree750826ed716f45b49b90fdb18e732c2e7b5742fe /g4f/Provider/needs_auth/GeminiPro.py
parentrefactor(g4f/client/client.py): Simplify AsyncClient methods (diff)
downloadgpt4free-795e42a2967f43364128f93fb71625e9e573bf5c.tar
gpt4free-795e42a2967f43364128f93fb71625e9e573bf5c.tar.gz
gpt4free-795e42a2967f43364128f93fb71625e9e573bf5c.tar.bz2
gpt4free-795e42a2967f43364128f93fb71625e9e573bf5c.tar.lz
gpt4free-795e42a2967f43364128f93fb71625e9e573bf5c.tar.xz
gpt4free-795e42a2967f43364128f93fb71625e9e573bf5c.tar.zst
gpt4free-795e42a2967f43364128f93fb71625e9e573bf5c.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/needs_auth/GeminiPro.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/g4f/Provider/needs_auth/GeminiPro.py b/g4f/Provider/needs_auth/GeminiPro.py
index 5c170ae5..7e52a194 100644
--- a/g4f/Provider/needs_auth/GeminiPro.py
+++ b/g4f/Provider/needs_auth/GeminiPro.py
@@ -104,4 +104,8 @@ class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin):
lines.append(chunk)
else:
data = await response.json()
- yield data["candidates"][0]["content"]["parts"][0]["text"]
+ candidate = data["candidates"][0]
+ if candidate["finishReason"] == "STOP":
+ yield candidate["content"]["parts"][0]["text"]
+ else:
+ yield candidate["finishReason"] + ' ' + candidate["safetyRatings"] \ No newline at end of file