summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/DeepAi.py
diff options
context:
space:
mode:
authorabc <98614666+xtekky@users.noreply.github.com>2023-08-27 17:37:44 +0200
committerabc <98614666+xtekky@users.noreply.github.com>2023-08-27 17:37:44 +0200
commitefd75a11b871d61ac31b0e274acdfb33daba361d (patch)
tree22bd158324444cdbb9dbed46f25f8dffa60f3756 /g4f/Provider/DeepAi.py
parent ~ | v-0.0.2.5 (diff)
downloadgpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar
gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.gz
gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.bz2
gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.lz
gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.xz
gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.zst
gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.zip
Diffstat (limited to '')
-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()