From 09f8258fa7dd92f8b270d39ceeaf62ea25868220 Mon Sep 17 00:00:00 2001 From: hlohaus <983577+hlohaus@users.noreply.github.com> Date: Sat, 25 Jan 2025 03:56:37 +0100 Subject: Add MiniMax providers, add HailuoAI provider Add OpenaiTemplate provider Remove some webdriver providers --- g4f/providers/base_provider.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'g4f/providers/base_provider.py') diff --git a/g4f/providers/base_provider.py b/g4f/providers/base_provider.py index 4d9fd85e..4096d95a 100644 --- a/g4f/providers/base_provider.py +++ b/g4f/providers/base_provider.py @@ -379,6 +379,8 @@ class RaiseErrorMixin(): raise ResponseError(data["error"]["message"]) else: raise ResponseError(data["error"]) + elif "choices" not in data or not data["choices"]: + raise ResponseError(f"Invalid response: {json.dumps(data)}") class AsyncAuthedProvider(AsyncGeneratorProvider): @@ -422,14 +424,12 @@ class AsyncAuthedProvider(AsyncGeneratorProvider): auth_result = AuthResult(**json.load(f)) else: auth_result = cls.on_auth(**kwargs) - try: for chunk in auth_result: + print(hasattr(chunk, "get_dict")) if hasattr(chunk, "get_dict"): auth_result = chunk else: yield chunk - except TypeError: - pass yield from to_sync_generator(cls.create_authed(model, messages, auth_result, **kwargs)) except (MissingAuthError, NoValidHarFileError): auth_result = cls.on_auth(**kwargs) -- cgit v1.2.3