From 95e61ad79bef879d90e6df413f3a25091f45ef9d Mon Sep 17 00:00:00 2001 From: H Lohaus Date: Sat, 6 Apr 2024 23:54:41 +0200 Subject: Update GeminiPro.py --- g4f/Provider/GeminiPro.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'g4f/Provider/GeminiPro.py') 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: -- cgit v1.2.3