summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authort.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-04-13 17:49:16 +0200
committert.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-04-13 17:49:16 +0200
commit351fbbb1e6ac47b1e0e3ba5107a65d570ec6f4ce (patch)
treec792ea5f18fabede77f7d1180fd85868d17eef76
parent quora (poe) [gpt-4/3.5] create bot feature fix (diff)
downloadgpt4free-351fbbb1e6ac47b1e0e3ba5107a65d570ec6f4ce.tar
gpt4free-351fbbb1e6ac47b1e0e3ba5107a65d570ec6f4ce.tar.gz
gpt4free-351fbbb1e6ac47b1e0e3ba5107a65d570ec6f4ce.tar.bz2
gpt4free-351fbbb1e6ac47b1e0e3ba5107a65d570ec6f4ce.tar.lz
gpt4free-351fbbb1e6ac47b1e0e3ba5107a65d570ec6f4ce.tar.xz
gpt4free-351fbbb1e6ac47b1e0e3ba5107a65d570ec6f4ce.tar.zst
gpt4free-351fbbb1e6ac47b1e0e3ba5107a65d570ec6f4ce.zip
Diffstat (limited to '')
-rw-r--r--t3nsor/__init__.py24
-rw-r--r--t3nsor/t3nsor_test.py (renamed from testing/t3nsor_test.py)2
2 files changed, 21 insertions, 5 deletions
diff --git a/t3nsor/__init__.py b/t3nsor/__init__.py
index 255fea4f..f8d12055 100644
--- a/t3nsor/__init__.py
+++ b/t3nsor/__init__.py
@@ -1,6 +1,24 @@
from requests import post
from time import time
+headers = {
+ 'authority': 'www.t3nsor.tech',
+ 'accept': '*/*',
+ 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
+ 'cache-control': 'no-cache',
+ 'content-type': 'application/json',
+ 'origin': 'https://www.t3nsor.tech',
+ 'pragma': 'no-cache',
+ 'referer': 'https://www.t3nsor.tech/',
+ 'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"',
+ 'sec-ch-ua-mobile': '?0',
+ 'sec-ch-ua-platform': '"macOS"',
+ 'sec-fetch-dest': 'empty',
+ 'sec-fetch-mode': 'cors',
+ 'sec-fetch-site': 'same-origin',
+ 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
+}
+
class T3nsorResponse:
class Completion:
@@ -53,9 +71,7 @@ class Completion:
prompt: str = 'hello world',
messages: list = []) -> T3nsorResponse:
- raise Exception('The t3nsor.tech API is currently down.')
-
- response = post('https://www.t3nsor.tech/api/chat', json = Completion.model | {
+ response = post('https://www.t3nsor.tech/api/chat', headers = headers, json = Completion.model | {
'messages' : messages,
'key' : '',
'prompt' : prompt
@@ -91,7 +107,7 @@ class StreamCompletion:
prompt: str = 'hello world',
messages: list = []) -> T3nsorResponse:
- response = post('https://www.t3nsor.tech/api/chat', stream = True, json = Completion.model | {
+ response = post('https://www.t3nsor.tech/api/chat', headers = headers, stream = True, json = Completion.model | {
'messages' : messages,
'key' : '',
'prompt' : prompt
diff --git a/testing/t3nsor_test.py b/t3nsor/t3nsor_test.py
index 38e047b9..eb8e2ae8 100644
--- a/testing/t3nsor_test.py
+++ b/t3nsor/t3nsor_test.py
@@ -4,4 +4,4 @@ for response in t3nsor.StreamCompletion.create(
prompt = 'write python code to reverse a string',
messages = []):
- print(response.completion.choices[0].text) \ No newline at end of file
+ print(response.completion.choices[0].text)