From 795e42a2967f43364128f93fb71625e9e573bf5c Mon Sep 17 00:00:00 2001 From: kqlio67 Date: Wed, 13 Nov 2024 14:38:39 +0200 Subject: Update (g4f/Provider/needs_auth/GeminiPro.py) --- g4f/Provider/needs_auth/GeminiPro.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3