you.com api (gpt 3.5 + internet)
This commit is contained in:
parent
5ec02f8a00
commit
633bcd81d7
3 changed files with 153 additions and 4 deletions
48
README.md
48
README.md
|
@ -9,7 +9,7 @@ This repository provides reverse-engineered language models from various sources
|
||||||
- [ ] implement poe.com create bot feature (4)
|
- [ ] implement poe.com create bot feature (4)
|
||||||
- [ ] poe.com chat history management (3)
|
- [ ] poe.com chat history management (3)
|
||||||
- [ ] renaming the 'poe' module to 'quora' (2)
|
- [ ] renaming the 'poe' module to 'quora' (2)
|
||||||
- [ ] add you.com api (1)
|
- [x] add you.com api (1)
|
||||||
|
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
@ -21,6 +21,7 @@ This repository provides reverse-engineered language models from various sources
|
||||||
- [`t3nsor`](#example-t3nsor)
|
- [`t3nsor`](#example-t3nsor)
|
||||||
- [`ora`](#example-ora)
|
- [`ora`](#example-ora)
|
||||||
- [`writesonic`](#example-writesonic)
|
- [`writesonic`](#example-writesonic)
|
||||||
|
- [`you`](#example-you)
|
||||||
|
|
||||||
## Current Sites <a name="current-sites"></a>
|
## Current Sites <a name="current-sites"></a>
|
||||||
|
|
||||||
|
@ -30,7 +31,8 @@ This repository provides reverse-engineered language models from various sources
|
||||||
| [nat.dev](https://nat.dev) | GPT-4/3.5 (paid now, looking for bypass)|
|
| [nat.dev](https://nat.dev) | GPT-4/3.5 (paid now, looking for bypass)|
|
||||||
| [poe.com](https://poe.com) | GPT-4/3.5 |
|
| [poe.com](https://poe.com) | GPT-4/3.5 |
|
||||||
| [writesonic.com](https://writesonic.com)|GPT-3.5 / Internet|
|
| [writesonic.com](https://writesonic.com)|GPT-3.5 / Internet|
|
||||||
|[t3nsor.com](https://t3nsor.com)|GPT-3.5|
|
| [t3nsor.com](https://t3nsor.com)|GPT-3.5|
|
||||||
|
| [you.com](https://you.com)|GPT-3.5 / Internet / good search|
|
||||||
|
|
||||||
## Sites with Authentication <a name="sites-with-authentication"></a>
|
## Sites with Authentication <a name="sites-with-authentication"></a>
|
||||||
|
|
||||||
|
@ -221,6 +223,43 @@ response = writesonic.Completion.create(
|
||||||
print(response.completion.choices[0].text) # Argentina won the 2022 FIFA World Cup tournament held in Qatar ...
|
print(response.completion.choices[0].text) # Argentina won the 2022 FIFA World Cup tournament held in Qatar ...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Example: `you` (use like openai pypi package) <a name="example-you"></a>
|
||||||
|
|
||||||
|
```python
|
||||||
|
import you
|
||||||
|
|
||||||
|
# simple request with links and details
|
||||||
|
response = you.Completion.create(
|
||||||
|
prompt = "hello world",
|
||||||
|
detailed = True,
|
||||||
|
includelinks = True,)
|
||||||
|
|
||||||
|
print(response)
|
||||||
|
|
||||||
|
# {
|
||||||
|
# "response": "...",
|
||||||
|
# "links": [...],
|
||||||
|
# "extra": {...},
|
||||||
|
# "slots": {...}
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
#chatbot
|
||||||
|
|
||||||
|
chat = []
|
||||||
|
|
||||||
|
while True:
|
||||||
|
prompt = input("You: ")
|
||||||
|
|
||||||
|
response = you.Completion.create(
|
||||||
|
prompt = prompt,
|
||||||
|
chat = chat)
|
||||||
|
|
||||||
|
print("Bot:", response["response"])
|
||||||
|
|
||||||
|
chat.append({"question": prompt, "answer": response["response"]})
|
||||||
|
```
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
The repository is written in Python and requires the following packages:
|
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:
|
||||||
You can install these packages using the provided `requirements.txt` file.
|
You can install these packages using the provided `requirements.txt` file.
|
||||||
|
|
||||||
## Repository structure:
|
## Repository structure:
|
||||||
|
|
||||||
.
|
.
|
||||||
├── ora/
|
├── ora/
|
||||||
├── poe/
|
├── poe/
|
||||||
├── t3nsor/
|
├── t3nsor/
|
||||||
|
├── testing/
|
||||||
├── writesonic/
|
├── writesonic/
|
||||||
|
├── you/
|
||||||
├── README.md <-- this file.
|
├── README.md <-- this file.
|
||||||
└── requirements.txt
|
└── requirements.txt
|
32
testing/you_test.py
Normal file
32
testing/you_test.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import you
|
||||||
|
|
||||||
|
# simple request with links and details
|
||||||
|
response = you.Completion.create(
|
||||||
|
prompt = "hello world",
|
||||||
|
detailed = True,
|
||||||
|
includelinks = True,)
|
||||||
|
|
||||||
|
print(response)
|
||||||
|
|
||||||
|
# {
|
||||||
|
# "response": "...",
|
||||||
|
# "links": [...],
|
||||||
|
# "extra": {...},
|
||||||
|
# "slots": {...}
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
#chatbot
|
||||||
|
|
||||||
|
chat = []
|
||||||
|
|
||||||
|
while True:
|
||||||
|
prompt = input("You: ")
|
||||||
|
|
||||||
|
response = you.Completion.create(
|
||||||
|
prompt = prompt,
|
||||||
|
chat = chat)
|
||||||
|
|
||||||
|
print("Bot:", response["response"])
|
||||||
|
|
||||||
|
chat.append({"question": prompt, "answer": response["response"]})
|
77
you/__init__.py
Normal file
77
you/__init__.py
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
from tls_client import Session
|
||||||
|
from re import findall
|
||||||
|
from json import loads, dumps
|
||||||
|
from uuid import uuid4
|
||||||
|
|
||||||
|
|
||||||
|
class Completion:
|
||||||
|
def create(
|
||||||
|
prompt : str,
|
||||||
|
page : int = 1,
|
||||||
|
count : int = 10,
|
||||||
|
safeSearch : str = "Moderate",
|
||||||
|
onShoppingpage : bool = False,
|
||||||
|
mkt : str = "",
|
||||||
|
responseFilter : str = "WebPages,Translations,TimeZone,Computation,RelatedSearches",
|
||||||
|
domain : str = "youchat",
|
||||||
|
queryTraceId : str = None,
|
||||||
|
chat : list = [],
|
||||||
|
includelinks : bool = False,
|
||||||
|
detailed : bool = False,
|
||||||
|
debug : bool = False ) -> dict:
|
||||||
|
|
||||||
|
client = Session(client_identifier="chrome_108")
|
||||||
|
client.headers = {
|
||||||
|
"authority" : "you.com",
|
||||||
|
"accept" : "text/event-stream",
|
||||||
|
"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",
|
||||||
|
"referer" : "https://you.com/search?q=who+are+you&tbm=youchat",
|
||||||
|
"sec-ch-ua" : '"Not_A Brand";v="99", "Google Chrome";v="109", "Chromium";v="109"',
|
||||||
|
"sec-ch-ua-mobile" : "?0",
|
||||||
|
"sec-ch-ua-platform": '"Windows"',
|
||||||
|
"sec-fetch-dest" : "empty",
|
||||||
|
"sec-fetch-mode" : "cors",
|
||||||
|
"sec-fetch-site" : "same-origin",
|
||||||
|
'cookie' : f'safesearch_guest=Moderate; uuid_guest={str(uuid4())}',
|
||||||
|
"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",
|
||||||
|
}
|
||||||
|
|
||||||
|
response = client.get(f"https://you.com/api/streamingSearch", params = {
|
||||||
|
"q" : prompt,
|
||||||
|
"page" : page,
|
||||||
|
"count" : count,
|
||||||
|
"safeSearch" : safeSearch,
|
||||||
|
"onShoppingPage" : onShoppingpage,
|
||||||
|
"mkt" : mkt,
|
||||||
|
"responseFilter" : responseFilter,
|
||||||
|
"domain" : domain,
|
||||||
|
"queryTraceId" : str(uuid4()) if queryTraceId is None else queryTraceId,
|
||||||
|
"chat" : str(chat), # {"question":"","answer":" '"}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
print('\n\n------------------\n\n')
|
||||||
|
print(response.text)
|
||||||
|
print('\n\n------------------\n\n')
|
||||||
|
|
||||||
|
youChatSerpResults = findall(r'youChatSerpResults\ndata: (.*)\n\nevent', response.text)[0]
|
||||||
|
thirdPartySearchResults = findall(r"thirdPartySearchResults\ndata: (.*)\n\nevent", response.text)[0]
|
||||||
|
slots = findall(r"slots\ndata: (.*)\n\nevent", response.text)[0]
|
||||||
|
|
||||||
|
text = response.text.split('}]}\n\nevent: youChatToken\ndata: {"youChatToken": "')[-1]
|
||||||
|
text = text.replace('"}\n\nevent: youChatToken\ndata: {"youChatToken": "', '')
|
||||||
|
text = text.replace('event: done\ndata: I\'m Mr. Meeseeks. Look at me.\n\n', '')
|
||||||
|
|
||||||
|
extra = {
|
||||||
|
'youChatSerpResults' : loads(youChatSerpResults),
|
||||||
|
'slots' : loads(slots)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'response': text,
|
||||||
|
'links' : loads(thirdPartySearchResults)['search']["third_party_search_results"] if includelinks else None,
|
||||||
|
'extra' : extra if detailed else None,
|
||||||
|
}
|
Loading…
Reference in a new issue