summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/DeepAi.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/Provider/DeepAi.py')
-rw-r--r--g4f/Provider/DeepAi.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/g4f/Provider/DeepAi.py b/g4f/Provider/DeepAi.py
index 01dc426d..feba6b41 100644
--- a/g4f/Provider/DeepAi.py
+++ b/g4f/Provider/DeepAi.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import json
import js2py
@@ -8,19 +10,17 @@ 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 +54,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()