summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-04-06 23:54:41 +0200
committerGitHub <noreply@github.com>2024-04-06 23:54:41 +0200
commit95e61ad79bef879d90e6df413f3a25091f45ef9d (patch)
tree60433e308e81f10d39905bd04ea0c71b87557f41 /g4f
parentUpdate GeminiProChat.py (diff)
downloadgpt4free-95e61ad79bef879d90e6df413f3a25091f45ef9d.tar
gpt4free-95e61ad79bef879d90e6df413f3a25091f45ef9d.tar.gz
gpt4free-95e61ad79bef879d90e6df413f3a25091f45ef9d.tar.bz2
gpt4free-95e61ad79bef879d90e6df413f3a25091f45ef9d.tar.lz
gpt4free-95e61ad79bef879d90e6df413f3a25091f45ef9d.tar.xz
gpt4free-95e61ad79bef879d90e6df413f3a25091f45ef9d.tar.zst
gpt4free-95e61ad79bef879d90e6df413f3a25091f45ef9d.zip
Diffstat (limited to 'g4f')
-rw-r--r--g4f/Provider/GeminiPro.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/g4f/Provider/GeminiPro.py b/g4f/Provider/GeminiPro.py
index 4e31915a..4378a18c 100644
--- a/g4f/Provider/GeminiPro.py
+++ b/g4f/Provider/GeminiPro.py
@@ -76,7 +76,7 @@ class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin):
if not response.ok:
data = await response.json()
data = data[0] if isinstance(data, list) else data
- raise RuntimeError(data["error"]["message"])
+ raise RuntimeError(f"Response {response.status}: {data["error"]["message"]}")
if stream:
lines = []
async for chunk in response.content:
@@ -88,7 +88,7 @@ class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin):
data = json.loads(data)
yield data["candidates"][0]["content"]["parts"][0]["text"]
except:
- data = data.decode() if isinstance(data, bytes) else data
+ data = data.decode(errors="ignore") if isinstance(data, bytes) else data
raise RuntimeError(f"Read chunk failed: {data}")
lines = []
else: