diff options
Diffstat (limited to 'g4f/Provider/Ails.py')
-rw-r--r-- | g4f/Provider/Ails.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/g4f/Provider/Ails.py b/g4f/Provider/Ails.py index 52b3745d..4eb21729 100644 --- a/g4f/Provider/Ails.py +++ b/g4f/Provider/Ails.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import hashlib import json import time @@ -11,18 +13,17 @@ from .base_provider import BaseProvider class Ails(BaseProvider): - url: str = "https://ai.ls" - working = True - supports_stream = True + url: str = "https://ai.ls" + working = True + supports_stream = True supports_gpt_35_turbo = True @staticmethod def create_completion( model: str, messages: list[dict[str, str]], - stream: bool, - **kwargs: Any, - ) -> CreateResult: + stream: bool, **kwargs: Any) -> CreateResult: + headers = { "authority": "api.caipacity.com", "accept": "*/*", @@ -72,6 +73,8 @@ class Ails(BaseProvider): if b"content" in token: completion_chunk = json.loads(token.decode().replace("data: ", "")) token = completion_chunk["choices"][0]["delta"].get("content") + if "ai.ls" in token.lower() or "ai.ci" in token.lower(): + raise Exception("Response Error: " + token) if token != None: yield token |