summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTekky <98614666+xtekky@users.noreply.github.com>2024-11-13 12:33:11 +0100
committerGitHub <noreply@github.com>2024-11-13 12:33:11 +0100
commit377d3037d532f17390733a19394f65e34fa42a62 (patch)
tree339b624648855d8c6e95034d592c65d5610a011d
parentnew discord link (diff)
parentadded unexpected finishReason handler (diff)
downloadgpt4free-377d3037d532f17390733a19394f65e34fa42a62.tar
gpt4free-377d3037d532f17390733a19394f65e34fa42a62.tar.gz
gpt4free-377d3037d532f17390733a19394f65e34fa42a62.tar.bz2
gpt4free-377d3037d532f17390733a19394f65e34fa42a62.tar.lz
gpt4free-377d3037d532f17390733a19394f65e34fa42a62.tar.xz
gpt4free-377d3037d532f17390733a19394f65e34fa42a62.tar.zst
gpt4free-377d3037d532f17390733a19394f65e34fa42a62.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/GeminiPro.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/g4f/Provider/GeminiPro.py b/g4f/Provider/GeminiPro.py
index 06bf69ee..e7174c59 100644
--- a/g4f/Provider/GeminiPro.py
+++ b/g4f/Provider/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"] \ No newline at end of file
+ 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