t.me/xtekky
commited on
Commit
·
351fbbb
1
Parent(s):
d0f5814
t3nsor.tech api unpatch
Browse files- t3nsor/__init__.py +20 -4
- {testing → t3nsor}/t3nsor_test.py +1 -1
t3nsor/__init__.py
CHANGED
@@ -1,6 +1,24 @@
|
|
1 |
from requests import post
|
2 |
from time import time
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
class T3nsorResponse:
|
5 |
|
6 |
class Completion:
|
@@ -53,9 +71,7 @@ class Completion:
|
|
53 |
prompt: str = 'hello world',
|
54 |
messages: list = []) -> T3nsorResponse:
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
response = post('https://www.t3nsor.tech/api/chat', json = Completion.model | {
|
59 |
'messages' : messages,
|
60 |
'key' : '',
|
61 |
'prompt' : prompt
|
@@ -91,7 +107,7 @@ class StreamCompletion:
|
|
91 |
prompt: str = 'hello world',
|
92 |
messages: list = []) -> T3nsorResponse:
|
93 |
|
94 |
-
response = post('https://www.t3nsor.tech/api/chat', stream = True, json = Completion.model | {
|
95 |
'messages' : messages,
|
96 |
'key' : '',
|
97 |
'prompt' : prompt
|
|
|
1 |
from requests import post
|
2 |
from time import time
|
3 |
|
4 |
+
headers = {
|
5 |
+
'authority': 'www.t3nsor.tech',
|
6 |
+
'accept': '*/*',
|
7 |
+
'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',
|
8 |
+
'cache-control': 'no-cache',
|
9 |
+
'content-type': 'application/json',
|
10 |
+
'origin': 'https://www.t3nsor.tech',
|
11 |
+
'pragma': 'no-cache',
|
12 |
+
'referer': 'https://www.t3nsor.tech/',
|
13 |
+
'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"',
|
14 |
+
'sec-ch-ua-mobile': '?0',
|
15 |
+
'sec-ch-ua-platform': '"macOS"',
|
16 |
+
'sec-fetch-dest': 'empty',
|
17 |
+
'sec-fetch-mode': 'cors',
|
18 |
+
'sec-fetch-site': 'same-origin',
|
19 |
+
'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',
|
20 |
+
}
|
21 |
+
|
22 |
class T3nsorResponse:
|
23 |
|
24 |
class Completion:
|
|
|
71 |
prompt: str = 'hello world',
|
72 |
messages: list = []) -> T3nsorResponse:
|
73 |
|
74 |
+
response = post('https://www.t3nsor.tech/api/chat', headers = headers, json = Completion.model | {
|
|
|
|
|
75 |
'messages' : messages,
|
76 |
'key' : '',
|
77 |
'prompt' : prompt
|
|
|
107 |
prompt: str = 'hello world',
|
108 |
messages: list = []) -> T3nsorResponse:
|
109 |
|
110 |
+
response = post('https://www.t3nsor.tech/api/chat', headers = headers, stream = True, json = Completion.model | {
|
111 |
'messages' : messages,
|
112 |
'key' : '',
|
113 |
'prompt' : prompt
|
{testing → t3nsor}/t3nsor_test.py
RENAMED
@@ -4,4 +4,4 @@ for response in t3nsor.StreamCompletion.create(
|
|
4 |
prompt = 'write python code to reverse a string',
|
5 |
messages = []):
|
6 |
|
7 |
-
print(response.completion.choices[0].text)
|
|
|
4 |
prompt = 'write python code to reverse a string',
|
5 |
messages = []):
|
6 |
|
7 |
+
print(response.completion.choices[0].text)
|