summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/DeepAi.py
diff options
context:
space:
mode:
authorLuneye <73485421+Luneye@users.noreply.github.com>2023-08-28 16:55:36 +0200
committerGitHub <noreply@github.com>2023-08-28 16:55:36 +0200
commit01294db6995511de37e9078e03ce32e54dbdad52 (patch)
treed6c4c14f4e6a3a81660ddb75272bc5da81cacecc /g4f/Provider/DeepAi.py
parentUpdate Bing.py (diff)
parent~ | code styling (diff)
downloadgpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.gz
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.bz2
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.lz
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.xz
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.zst
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.zip
Diffstat (limited to 'g4f/Provider/DeepAi.py')
-rw-r--r--g4f/Provider/DeepAi.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/g4f/Provider/DeepAi.py b/g4f/Provider/DeepAi.py
index 01dc426d..073b04a5 100644
--- a/g4f/Provider/DeepAi.py
+++ b/g4f/Provider/DeepAi.py
@@ -1,26 +1,21 @@
-import json
+import json, js2py, requests
-import js2py
-import requests
-
-from ..typing import Any, CreateResult
+from ..typing import Any, CreateResult
from .base_provider import BaseProvider
class DeepAi(BaseProvider):
- url = "https://deepai.org"
- working = True
- supports_stream = True
+ url: str = "https://deepai.org"
+ 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:
- url = "https://api.deepai.org/make_me_a_pizza"
+ stream: bool, **kwargs: Any) -> CreateResult:
+
token_js = """
var agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
var a, b, c, d, e, h, f, l, g, k, m, n, r, x, C, E, N, F, T, O, P, w, D, G, Q, R, W, I, aa, fa, na, oa, ha, ba, X, ia, ja, ka, J, la, K, L, ca, S, U, M, ma, B, da, V, Y;
@@ -54,7 +49,9 @@ f = function () {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
}
- response = requests.post(url, headers=headers, data=payload, stream=True)
+ response = requests.post("https://api.deepai.org/make_me_a_pizza",
+ headers=headers, data=payload, stream=True)
+
for chunk in response.iter_content(chunk_size=None):
response.raise_for_status()
yield chunk.decode()