返回提交历史
Modified
README.md
+44
-4
Added
testing/you_test.py
+32
-0
Added
you/__init__.py
+77
-0
XFEstudio/gpt4free
you.com api (gpt 3.5 + internet)
633bcd81
代码差异
3 个文件
+153
-4
@@ -9,7 +9,7 @@ This repository provides reverse-engineered language models from various sources
9
9
- [ ] implement poe.com create bot feature (4)
10
10
- [ ] poe.com chat history management (3)
11
11
- [ ] renaming the 'poe' module to 'quora' (2)
12
- [ ] add you.com api (1)
12
- [x] add you.com api (1)
13
13
14
14
15
15
## Table of Contents
@@ -21,6 +21,7 @@ This repository provides reverse-engineered language models from various sources
21
21
- [`t3nsor`](#example-t3nsor)
22
22
- [`ora`](#example-ora)
23
23
- [`writesonic`](#example-writesonic)
24
- [`you`](#example-you)
24
25
25
26
## Current Sites <a name="current-sites"></a>
26
27
@@ -30,7 +31,8 @@ This repository provides reverse-engineered language models from various sources
30
31
| [nat.dev](https://nat.dev) | GPT-4/3.5 (paid now, looking for bypass)|
31
32
| [poe.com](https://poe.com) | GPT-4/3.5 |
32
33
| [writesonic.com](https://writesonic.com)|GPT-3.5 / Internet|
33
|[t3nsor.com](https://t3nsor.com)|GPT-3.5|
34
| [t3nsor.com](https://t3nsor.com)|GPT-3.5|
35
| [you.com](https://you.com)|GPT-3.5 / Internet / good search|
34
36
35
37
## Sites with Authentication <a name="sites-with-authentication"></a>
36
38
@@ -221,6 +223,43 @@ response = writesonic.Completion.create(
221
223
print(response.completion.choices[0].text) # Argentina won the 2022 FIFA World Cup tournament held in Qatar ...
222
224
```
223
225
226
### Example: `you` (use like openai pypi package) <a name="example-you"></a>
227
228
```python
229
import you
230
231
# simple request with links and details
232
response = you.Completion.create(
233
prompt = "hello world",
234
detailed = True,
235
includelinks = True,)
236
237
print(response)
238
239
# {
240
# "response": "...",
241
# "links": [...],
242
# "extra": {...},
243
# "slots": {...}
244
# }
245
# }
246
247
#chatbot
248
249
chat = []
250
251
while True:
252
prompt = input("You: ")
253
254
response = you.Completion.create(
255
prompt = prompt,
256
chat = chat)
257
258
print("Bot:", response["response"])
259
260
chat.append({"question": prompt, "answer": response["response"]})
261
```
262
224
263
## Dependencies
225
264
226
265
The repository is written in Python and requires the following packages:
@@ -232,11 +271,12 @@ The repository is written in Python and requires the following packages:
232
271
You can install these packages using the provided `requirements.txt` file.
233
272
234
273
## Repository structure:
235
236
274
.
237
275
├── ora/
238
276
├── poe/
239
277
├── t3nsor/
278
├── testing/
240
279
├── writesonic/
280
├── you/
241
281
├── README.md <-- this file.
242
└── requirements.txt
282
└── requirements.txt
@@ -0,0 +1,32 @@
1
import you
2
3
# simple request with links and details
4
response = you.Completion.create(
5
prompt = "hello world",
6
detailed = True,
7
includelinks = True,)
8
9
print(response)
10
11
# {
12
# "response": "...",
13
# "links": [...],
14
# "extra": {...},
15
# "slots": {...}
16
# }
17
# }
18
19
#chatbot
20
21
chat = []
22
23
while True:
24
prompt = input("You: ")
25
26
response = you.Completion.create(
27
prompt = prompt,
28
chat = chat)
29
30
print("Bot:", response["response"])
31
32
chat.append({"question": prompt, "answer": response["response"]})
@@ -0,0 +1,77 @@
1
from tls_client import Session
2
from re import findall
3
from json import loads, dumps
4
from uuid import uuid4
5
6
7
class Completion:
8
def create(
9
prompt : str,
10
page : int = 1,
11
count : int = 10,
12
safeSearch : str = "Moderate",
13
onShoppingpage : bool = False,
14
mkt : str = "",
15
responseFilter : str = "WebPages,Translations,TimeZone,Computation,RelatedSearches",
16
domain : str = "youchat",
17
queryTraceId : str = None,
18
chat : list = [],
19
includelinks : bool = False,
20
detailed : bool = False,
21
debug : bool = False ) -> dict:
22
23
client = Session(client_identifier="chrome_108")
24
client.headers = {
25
"authority" : "you.com",
26
"accept" : "text/event-stream",
27
"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",
28
"cache-control" : "no-cache",
29
"referer" : "https://you.com/search?q=who+are+you&tbm=youchat",
30
"sec-ch-ua" : '"Not_A Brand";v="99", "Google Chrome";v="109", "Chromium";v="109"',
31
"sec-ch-ua-mobile" : "?0",
32
"sec-ch-ua-platform": '"Windows"',
33
"sec-fetch-dest" : "empty",
34
"sec-fetch-mode" : "cors",
35
"sec-fetch-site" : "same-origin",
36
'cookie' : f'safesearch_guest=Moderate; uuid_guest={str(uuid4())}',
37
"user-agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
38
}
39
40
response = client.get(f"https://you.com/api/streamingSearch", params = {
41
"q" : prompt,
42
"page" : page,
43
"count" : count,
44
"safeSearch" : safeSearch,
45
"onShoppingPage" : onShoppingpage,
46
"mkt" : mkt,
47
"responseFilter" : responseFilter,
48
"domain" : domain,
49
"queryTraceId" : str(uuid4()) if queryTraceId is None else queryTraceId,
50
"chat" : str(chat), # {"question":"","answer":" '"}
51
}
52
)
53
54
55
if debug:
56
print('\n\n------------------\n\n')
57
print(response.text)
58
print('\n\n------------------\n\n')
59
60
youChatSerpResults = findall(r'youChatSerpResults\ndata: (.*)\n\nevent', response.text)[0]
61
thirdPartySearchResults = findall(r"thirdPartySearchResults\ndata: (.*)\n\nevent", response.text)[0]
62
slots = findall(r"slots\ndata: (.*)\n\nevent", response.text)[0]
63
64
text = response.text.split('}]}\n\nevent: youChatToken\ndata: {"youChatToken": "')[-1]
65
text = text.replace('"}\n\nevent: youChatToken\ndata: {"youChatToken": "', '')
66
text = text.replace('event: done\ndata: I\'m Mr. Meeseeks. Look at me.\n\n', '')
67
68
extra = {
69
'youChatSerpResults' : loads(youChatSerpResults),
70
'slots' : loads(slots)
71
}
72
73
return {
74
'response': text,
75
'links' : loads(thirdPartySearchResults)['search']["third_party_search_results"] if includelinks else None,
76
'extra' : extra if detailed else None,
77
}