added main module for accessing all services
This commit is contained in:
parent
25428d58d5
commit
920fe19608
63 changed files with 511 additions and 443 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -14,3 +14,5 @@
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
cookie.json
|
cookie.json
|
||||||
|
|
||||||
|
*.pyc
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
### Example: `forefront` (use like openai pypi package) <a name="example-forefront"></a>
|
|
||||||
|
|
||||||
```python
|
|
||||||
import forefront
|
|
||||||
|
|
||||||
# create an account
|
|
||||||
token = forefront.Account.create(logging=True)
|
|
||||||
print(token)
|
|
||||||
|
|
||||||
# get a response
|
|
||||||
for response in forefront.StreamingCompletion.create(token = token,
|
|
||||||
prompt = 'hello world', model='gpt-4'):
|
|
||||||
|
|
||||||
print(response.completion.choices[0].text, end = '')
|
|
||||||
```
|
|
|
@ -1,152 +0,0 @@
|
||||||
from json import loads
|
|
||||||
from re import match
|
|
||||||
from time import time, sleep
|
|
||||||
from uuid import uuid4
|
|
||||||
|
|
||||||
from requests import post
|
|
||||||
from tls_client import Session
|
|
||||||
|
|
||||||
from forefront.mail import Mail
|
|
||||||
from forefront.typing import ForeFrontResponse
|
|
||||||
|
|
||||||
|
|
||||||
class Account:
|
|
||||||
@staticmethod
|
|
||||||
def create(proxy=None, logging=False):
|
|
||||||
|
|
||||||
proxies = {
|
|
||||||
'http': 'http://' + proxy,
|
|
||||||
'https': 'http://' + proxy} if proxy else False
|
|
||||||
|
|
||||||
start = time()
|
|
||||||
|
|
||||||
mail = Mail(proxies)
|
|
||||||
mail_token = None
|
|
||||||
mail_adress = mail.get_mail()
|
|
||||||
|
|
||||||
# print(mail_adress)
|
|
||||||
|
|
||||||
client = Session(client_identifier='chrome110')
|
|
||||||
client.proxies = proxies
|
|
||||||
client.headers = {
|
|
||||||
"origin": "https://accounts.forefront.ai",
|
|
||||||
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = client.post('https://clerk.forefront.ai/v1/client/sign_ups?_clerk_js_version=4.32.6',
|
|
||||||
data={
|
|
||||||
"email_address": mail_adress
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
trace_token = response.json()['response']['id']
|
|
||||||
if logging: print(trace_token)
|
|
||||||
|
|
||||||
response = client.post(
|
|
||||||
f"https://clerk.forefront.ai/v1/client/sign_ups/{trace_token}/prepare_verification?_clerk_js_version=4.32.6",
|
|
||||||
data={
|
|
||||||
"strategy": "email_code",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if logging: print(response.text)
|
|
||||||
|
|
||||||
if not 'sign_up_attempt' in response.text:
|
|
||||||
return 'Failed to create account!'
|
|
||||||
|
|
||||||
while True:
|
|
||||||
sleep(1)
|
|
||||||
for _ in mail.fetch_inbox():
|
|
||||||
print(mail.get_message_content(_["id"]))
|
|
||||||
mail_token = match(r"(\d){5,6}", mail.get_message_content(_["id"])).group(0)
|
|
||||||
|
|
||||||
if mail_token:
|
|
||||||
break
|
|
||||||
|
|
||||||
if logging: print(mail_token)
|
|
||||||
|
|
||||||
response = client.post(
|
|
||||||
f'https://clerk.forefront.ai/v1/client/sign_ups/{trace_token}/attempt_verification?_clerk_js_version=4.38.4',
|
|
||||||
data={
|
|
||||||
'code': mail_token,
|
|
||||||
'strategy': 'email_code'
|
|
||||||
})
|
|
||||||
|
|
||||||
if logging: print(response.json())
|
|
||||||
|
|
||||||
token = response.json()['client']['sessions'][0]['last_active_token']['jwt']
|
|
||||||
|
|
||||||
with open('accounts.txt', 'a') as f:
|
|
||||||
f.write(f'{mail_adress}:{token}\n')
|
|
||||||
|
|
||||||
if logging: print(time() - start)
|
|
||||||
|
|
||||||
return token
|
|
||||||
|
|
||||||
|
|
||||||
class StreamingCompletion:
|
|
||||||
@staticmethod
|
|
||||||
def create(
|
|
||||||
token=None,
|
|
||||||
chatId=None,
|
|
||||||
prompt='',
|
|
||||||
actionType='new',
|
|
||||||
defaultPersona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default
|
|
||||||
model='gpt-4') -> ForeFrontResponse:
|
|
||||||
|
|
||||||
if not token: raise Exception('Token is required!')
|
|
||||||
if not chatId: chatId = str(uuid4())
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
'authority': 'chat-server.tenant-forefront-default.knative.chi.coreweave.com',
|
|
||||||
'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',
|
|
||||||
'authorization': 'Bearer ' + token,
|
|
||||||
'cache-control': 'no-cache',
|
|
||||||
'content-type': 'application/json',
|
|
||||||
'origin': 'https://chat.forefront.ai',
|
|
||||||
'pragma': 'no-cache',
|
|
||||||
'referer': 'https://chat.forefront.ai/',
|
|
||||||
'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': 'cross-site',
|
|
||||||
'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',
|
|
||||||
}
|
|
||||||
|
|
||||||
json_data = {
|
|
||||||
'text': prompt,
|
|
||||||
'action': actionType,
|
|
||||||
'parentId': chatId,
|
|
||||||
'workspaceId': chatId,
|
|
||||||
'messagePersona': defaultPersona,
|
|
||||||
'model': model
|
|
||||||
}
|
|
||||||
|
|
||||||
for chunk in post('https://chat-server.tenant-forefront-default.knative.chi.coreweave.com/chat',
|
|
||||||
headers=headers, json=json_data, stream=True).iter_lines():
|
|
||||||
|
|
||||||
if b'finish_reason":null' in chunk:
|
|
||||||
data = loads(chunk.decode('utf-8').split('data: ')[1])
|
|
||||||
token = data['choices'][0]['delta'].get('content')
|
|
||||||
|
|
||||||
if token != None:
|
|
||||||
yield ForeFrontResponse({
|
|
||||||
'id': chatId,
|
|
||||||
'object': 'text_completion',
|
|
||||||
'created': int(time()),
|
|
||||||
'model': model,
|
|
||||||
'choices': [{
|
|
||||||
'text': token,
|
|
||||||
'index': 0,
|
|
||||||
'logprobs': None,
|
|
||||||
'finish_reason': 'stop'
|
|
||||||
}],
|
|
||||||
'usage': {
|
|
||||||
'prompt_tokens': len(prompt),
|
|
||||||
'completion_tokens': len(token),
|
|
||||||
'total_tokens': len(prompt) + len(token)
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -1,36 +0,0 @@
|
||||||
class ForeFrontResponse:
|
|
||||||
class Completion:
|
|
||||||
class Choices:
|
|
||||||
def __init__(self, choice: dict) -> None:
|
|
||||||
self.text = choice['text']
|
|
||||||
self.content = self.text.encode()
|
|
||||||
self.index = choice['index']
|
|
||||||
self.logprobs = choice['logprobs']
|
|
||||||
self.finish_reason = choice['finish_reason']
|
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
|
||||||
return f'''<__main__.APIResponse.Completion.Choices(\n text = {self.text.encode()},\n index = {self.index},\n logprobs = {self.logprobs},\n finish_reason = {self.finish_reason})object at 0x1337>'''
|
|
||||||
|
|
||||||
def __init__(self, choices: dict) -> None:
|
|
||||||
self.choices = [self.Choices(choice) for choice in choices]
|
|
||||||
|
|
||||||
class Usage:
|
|
||||||
def __init__(self, usage_dict: dict) -> None:
|
|
||||||
self.prompt_tokens = usage_dict['prompt_tokens']
|
|
||||||
self.completion_tokens = usage_dict['completion_tokens']
|
|
||||||
self.total_tokens = usage_dict['total_tokens']
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return f'''<__main__.APIResponse.Usage(\n prompt_tokens = {self.prompt_tokens},\n completion_tokens = {self.completion_tokens},\n total_tokens = {self.total_tokens})object at 0x1337>'''
|
|
||||||
|
|
||||||
def __init__(self, response_dict: dict) -> None:
|
|
||||||
self.response_dict = response_dict
|
|
||||||
self.id = response_dict['id']
|
|
||||||
self.object = response_dict['object']
|
|
||||||
self.created = response_dict['created']
|
|
||||||
self.model = response_dict['model']
|
|
||||||
self.completion = self.Completion(response_dict['choices'])
|
|
||||||
self.usage = self.Usage(response_dict['usage'])
|
|
||||||
|
|
||||||
def json(self) -> dict:
|
|
||||||
return self.response_dict
|
|
|
@ -4,19 +4,21 @@ import sys
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
|
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
|
||||||
|
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
import you
|
from openai_rev import you
|
||||||
|
|
||||||
|
|
||||||
def get_answer(question: str) -> str:
|
def get_answer(question: str) -> str:
|
||||||
# Set cloudflare clearance cookie and get answer from GPT-4 model
|
# Set cloudflare clearance cookie and get answer from GPT-4 model
|
||||||
try:
|
try:
|
||||||
result = you.Completion.create(
|
result = you.Completion.create(prompt=question)
|
||||||
prompt = question)
|
|
||||||
|
return result.text
|
||||||
return result['response']
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Return error message if an exception occurs
|
# Return error message if an exception occurs
|
||||||
return f'An error occurred: {e}. Please make sure you are using a valid cloudflare clearance token and user agent.'
|
return (
|
||||||
|
f'An error occurred: {e}. Please make sure you are using a valid cloudflare clearance token and user agent.'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Set page configuration and add header
|
# Set page configuration and add header
|
||||||
|
@ -27,14 +29,13 @@ st.set_page_config(
|
||||||
menu_items={
|
menu_items={
|
||||||
'Get Help': 'https://github.com/xtekky/gpt4free/blob/main/README.md',
|
'Get Help': 'https://github.com/xtekky/gpt4free/blob/main/README.md',
|
||||||
'Report a bug': "https://github.com/xtekky/gpt4free/issues",
|
'Report a bug': "https://github.com/xtekky/gpt4free/issues",
|
||||||
'About': "### gptfree GUI"
|
'About': "### gptfree GUI",
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
st.header('GPT4free GUI')
|
st.header('GPT4free GUI')
|
||||||
|
|
||||||
# Add text area for user input and button to get answer
|
# Add text area for user input and button to get answer
|
||||||
question_text_area = st.text_area(
|
question_text_area = st.text_area('🤖 Ask Any Question :', placeholder='Explain quantum computing in 50 words')
|
||||||
'🤖 Ask Any Question :', placeholder='Explain quantum computing in 50 words')
|
|
||||||
if st.button('🧠 Think'):
|
if st.button('🧠 Think'):
|
||||||
answer = get_answer(question_text_area)
|
answer = get_answer(question_text_area)
|
||||||
# Display answer
|
# Display answer
|
||||||
|
|
15
openai_rev/forefront/README.md
Normal file
15
openai_rev/forefront/README.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
### Example: `forefront` (use like openai pypi package) <a name="example-forefront"></a>
|
||||||
|
|
||||||
|
```python
|
||||||
|
|
||||||
|
from openai_rev import forefront
|
||||||
|
|
||||||
|
# create an account
|
||||||
|
token = forefront.Account.create(logging=True)
|
||||||
|
print(token)
|
||||||
|
|
||||||
|
# get a response
|
||||||
|
for response in forefront.StreamingCompletion.create(token=token,
|
||||||
|
prompt='hello world', model='gpt-4'):
|
||||||
|
print(response.completion.choices[0].text, end='')
|
||||||
|
```
|
180
openai_rev/forefront/__init__.py
Normal file
180
openai_rev/forefront/__init__.py
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
from json import loads
|
||||||
|
from re import match
|
||||||
|
from time import time, sleep
|
||||||
|
from uuid import uuid4
|
||||||
|
|
||||||
|
from altair.vegalite.v3 import Generator
|
||||||
|
from fake_useragent import UserAgent
|
||||||
|
from requests import post
|
||||||
|
from tls_client import Session
|
||||||
|
|
||||||
|
from .mail import Mail
|
||||||
|
from .models import ForeFrontResponse
|
||||||
|
|
||||||
|
|
||||||
|
class Account:
|
||||||
|
@staticmethod
|
||||||
|
def create(proxy=None, logging=False):
|
||||||
|
proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else False
|
||||||
|
|
||||||
|
start = time()
|
||||||
|
|
||||||
|
mail_client = Mail(proxies)
|
||||||
|
mail_token = None
|
||||||
|
mail_address = mail_client.get_mail()
|
||||||
|
|
||||||
|
# print(mail_address)
|
||||||
|
|
||||||
|
client = Session(client_identifier='chrome110')
|
||||||
|
client.proxies = proxies
|
||||||
|
client.headers = {
|
||||||
|
'origin': 'https://accounts.forefront.ai',
|
||||||
|
'user-agent': UserAgent().random,
|
||||||
|
}
|
||||||
|
|
||||||
|
response = client.post(
|
||||||
|
'https://clerk.forefront.ai/v1/client/sign_ups?_clerk_js_version=4.32.6',
|
||||||
|
data={'email_address': mail_address},
|
||||||
|
)
|
||||||
|
|
||||||
|
trace_token = response.json()['response']['id']
|
||||||
|
if logging:
|
||||||
|
print(trace_token)
|
||||||
|
|
||||||
|
response = client.post(
|
||||||
|
f'https://clerk.forefront.ai/v1/client/sign_ups/{trace_token}/prepare_verification?_clerk_js_version=4.32.6',
|
||||||
|
data={
|
||||||
|
'strategy': 'email_code',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if logging:
|
||||||
|
print(response.text)
|
||||||
|
|
||||||
|
if 'sign_up_attempt' not in response.text:
|
||||||
|
return 'Failed to create account!'
|
||||||
|
|
||||||
|
while True:
|
||||||
|
sleep(1)
|
||||||
|
for _ in mail_client.fetch_inbox():
|
||||||
|
print(mail_client.get_message_content(_['id']))
|
||||||
|
mail_token = match(r'(\d){5,6}', mail_client.get_message_content(_['id'])).group(0)
|
||||||
|
|
||||||
|
if mail_token:
|
||||||
|
break
|
||||||
|
|
||||||
|
if logging:
|
||||||
|
print(mail_token)
|
||||||
|
|
||||||
|
response = client.post(
|
||||||
|
f'https://clerk.forefront.ai/v1/client/sign_ups/{trace_token}/attempt_verification?_clerk_js_version=4.38.4',
|
||||||
|
data={'code': mail_token, 'strategy': 'email_code'},
|
||||||
|
)
|
||||||
|
|
||||||
|
if logging:
|
||||||
|
print(response.json())
|
||||||
|
|
||||||
|
token = response.json()['client']['sessions'][0]['last_active_token']['jwt']
|
||||||
|
|
||||||
|
with open('accounts.txt', 'a') as f:
|
||||||
|
f.write(f'{mail_address}:{token}\n')
|
||||||
|
|
||||||
|
if logging:
|
||||||
|
print(time() - start)
|
||||||
|
|
||||||
|
return token
|
||||||
|
|
||||||
|
|
||||||
|
class StreamingCompletion:
|
||||||
|
@staticmethod
|
||||||
|
def create(
|
||||||
|
token=None,
|
||||||
|
chat_id=None,
|
||||||
|
prompt='',
|
||||||
|
action_type='new',
|
||||||
|
default_persona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default
|
||||||
|
model='gpt-4',
|
||||||
|
) -> Generator[ForeFrontResponse, None, None]:
|
||||||
|
if not token:
|
||||||
|
raise Exception('Token is required!')
|
||||||
|
if not chat_id:
|
||||||
|
chat_id = str(uuid4())
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
'authority': 'chat-server.tenant-forefront-default.knative.chi.coreweave.com',
|
||||||
|
'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',
|
||||||
|
'authorization': 'Bearer ' + token,
|
||||||
|
'cache-control': 'no-cache',
|
||||||
|
'content-type': 'application/json',
|
||||||
|
'origin': 'https://chat.forefront.ai',
|
||||||
|
'pragma': 'no-cache',
|
||||||
|
'referer': 'https://chat.forefront.ai/',
|
||||||
|
'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': 'cross-site',
|
||||||
|
'user-agent': UserAgent().random,
|
||||||
|
}
|
||||||
|
|
||||||
|
json_data = {
|
||||||
|
'text': prompt,
|
||||||
|
'action': action_type,
|
||||||
|
'parentId': chat_id,
|
||||||
|
'workspaceId': chat_id,
|
||||||
|
'messagePersona': default_persona,
|
||||||
|
'model': model,
|
||||||
|
}
|
||||||
|
|
||||||
|
for chunk in post(
|
||||||
|
'https://chat-server.tenant-forefront-default.knative.chi.coreweave.com/chat',
|
||||||
|
headers=headers,
|
||||||
|
json=json_data,
|
||||||
|
stream=True,
|
||||||
|
).iter_lines():
|
||||||
|
if b'finish_reason":null' in chunk:
|
||||||
|
data = loads(chunk.decode('utf-8').split('data: ')[1])
|
||||||
|
token = data['choices'][0]['delta'].get('content')
|
||||||
|
|
||||||
|
if token is not None:
|
||||||
|
yield ForeFrontResponse(
|
||||||
|
**{
|
||||||
|
'id': chat_id,
|
||||||
|
'object': 'text_completion',
|
||||||
|
'created': int(time()),
|
||||||
|
'text': token,
|
||||||
|
'model': model,
|
||||||
|
'choices': [{'text': token, 'index': 0, 'logprobs': None, 'finish_reason': 'stop'}],
|
||||||
|
'usage': {
|
||||||
|
'prompt_tokens': len(prompt),
|
||||||
|
'completion_tokens': len(token),
|
||||||
|
'total_tokens': len(prompt) + len(token),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Completion:
|
||||||
|
@staticmethod
|
||||||
|
def create(
|
||||||
|
token=None,
|
||||||
|
chat_id=None,
|
||||||
|
prompt='',
|
||||||
|
action_type='new',
|
||||||
|
default_persona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default
|
||||||
|
model='gpt-4',
|
||||||
|
) -> ForeFrontResponse:
|
||||||
|
final_response = None
|
||||||
|
for response in StreamingCompletion.create(
|
||||||
|
token=token,
|
||||||
|
chat_id=chat_id,
|
||||||
|
prompt=prompt,
|
||||||
|
action_type=action_type,
|
||||||
|
default_persona=default_persona,
|
||||||
|
model=model,
|
||||||
|
):
|
||||||
|
final_response = response
|
||||||
|
|
||||||
|
return final_response
|
|
@ -23,21 +23,17 @@ class Mail:
|
||||||
"sec-fetch-dest": "empty",
|
"sec-fetch-dest": "empty",
|
||||||
"referer": "https://mail.tm/",
|
"referer": "https://mail.tm/",
|
||||||
"accept-encoding": "gzip, deflate, br",
|
"accept-encoding": "gzip, deflate, br",
|
||||||
"accept-language": "en-GB,en-US;q=0.9,en;q=0.8"
|
"accept-language": "en-GB,en-US;q=0.9,en;q=0.8",
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_mail(self) -> str:
|
def get_mail(self) -> str:
|
||||||
token = ''.join(choices(ascii_letters, k=14)).lower()
|
token = ''.join(choices(ascii_letters, k=14)).lower()
|
||||||
init = self.client.post("https://api.mail.tm/accounts", json={
|
init = self.client.post(
|
||||||
"address": f"{token}@bugfoo.com",
|
"https://api.mail.tm/accounts", json={"address": f"{token}@bugfoo.com", "password": token}
|
||||||
"password": token
|
)
|
||||||
})
|
|
||||||
|
|
||||||
if init.status_code == 201:
|
if init.status_code == 201:
|
||||||
resp = self.client.post("https://api.mail.tm/token", json={
|
resp = self.client.post("https://api.mail.tm/token", json={**init.json(), "password": token})
|
||||||
**init.json(),
|
|
||||||
"password": token
|
|
||||||
})
|
|
||||||
|
|
||||||
self.client.headers['authorization'] = 'Bearer ' + resp.json()['token']
|
self.client.headers['authorization'] = 'Bearer ' + resp.json()['token']
|
||||||
|
|
26
openai_rev/forefront/models.py
Normal file
26
openai_rev/forefront/models.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
from typing import Any, List
|
||||||
|
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class Choice(BaseModel):
|
||||||
|
text: str
|
||||||
|
index: int
|
||||||
|
logprobs: Any
|
||||||
|
finish_reason: str
|
||||||
|
|
||||||
|
|
||||||
|
class Usage(BaseModel):
|
||||||
|
prompt_tokens: int
|
||||||
|
completion_tokens: int
|
||||||
|
total_tokens: int
|
||||||
|
|
||||||
|
|
||||||
|
class ForeFrontResponse(BaseModel):
|
||||||
|
id: str
|
||||||
|
object: str
|
||||||
|
created: int
|
||||||
|
model: str
|
||||||
|
choices: List[Choice]
|
||||||
|
usage: Usage
|
||||||
|
text: str
|
35
openai_rev/openai_rev.py
Normal file
35
openai_rev/openai_rev.py
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
import quora
|
||||||
|
import you
|
||||||
|
|
||||||
|
|
||||||
|
class Provider(Enum):
|
||||||
|
You = 'you'
|
||||||
|
Poe = 'poe'
|
||||||
|
|
||||||
|
|
||||||
|
class Completion:
|
||||||
|
@staticmethod
|
||||||
|
def create(provider: Provider, prompt: str, **kwargs):
|
||||||
|
if provider == Provider.Poe:
|
||||||
|
return Completion.__poe_service(prompt, **kwargs)
|
||||||
|
elif provider == Provider.You:
|
||||||
|
return Completion.__you_service(prompt, **kwargs)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __you_service(cls, prompt: str, **kwargs) -> str:
|
||||||
|
return you.Completion.create(prompt).text
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __poe_service(cls, prompt: str, **kwargs) -> str:
|
||||||
|
return quora.Completion.create(prompt=prompt).text
|
||||||
|
|
||||||
|
|
||||||
|
# usage You
|
||||||
|
response = Completion.create(Provider.You, prompt='Write a poem on Lionel Messi')
|
||||||
|
print(response)
|
||||||
|
|
||||||
|
# usage Poe
|
||||||
|
response = Completion.create(Provider.Poe, prompt='Write a poem on Lionel Messi', token='GKzCahZYGKhp76LfE197xw==')
|
||||||
|
print(response)
|
37
openai_rev/phind/README.md
Normal file
37
openai_rev/phind/README.md
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
### Example: `phind` (use like openai pypi package) <a name="example-phind"></a>
|
||||||
|
|
||||||
|
```python
|
||||||
|
|
||||||
|
from openai_rev import phind
|
||||||
|
|
||||||
|
# set cf_clearance cookie (needed again)
|
||||||
|
phind.cf_clearance = 'xx.xx-1682166681-0-160'
|
||||||
|
phind.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' # same as the one from browser you got cf_clearance from
|
||||||
|
|
||||||
|
prompt = 'who won the quatar world cup'
|
||||||
|
|
||||||
|
# help needed: not getting newlines from the stream, please submit a PR if you know how to fix this
|
||||||
|
# stream completion
|
||||||
|
for result in phind.StreamingCompletion.create(
|
||||||
|
model='gpt-4',
|
||||||
|
prompt=prompt,
|
||||||
|
results=phind.Search.create(prompt, actualSearch=True),
|
||||||
|
# create search (set actualSearch to False to disable internet)
|
||||||
|
creative=False,
|
||||||
|
detailed=False,
|
||||||
|
codeContext=''): # up to 3000 chars of code
|
||||||
|
|
||||||
|
print(result.completion.choices[0].text, end='', flush=True)
|
||||||
|
|
||||||
|
# normal completion
|
||||||
|
result = phind.Completion.create(
|
||||||
|
model='gpt-4',
|
||||||
|
prompt=prompt,
|
||||||
|
results=phind.Search.create(prompt, actualSearch=True),
|
||||||
|
# create search (set actualSearch to False to disable internet)
|
||||||
|
creative=False,
|
||||||
|
detailed=False,
|
||||||
|
codeContext='') # up to 3000 chars of code
|
||||||
|
|
||||||
|
print(result.completion.choices[0].text)
|
||||||
|
```
|
|
@ -20,37 +20,37 @@ models = {
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# import quora (poe) package
|
# import quora (poe) package
|
||||||
import quora
|
from openai_rev import quora
|
||||||
|
|
||||||
# create account
|
# create account
|
||||||
# make sure to set enable_bot_creation to True
|
# make sure to set enable_bot_creation to True
|
||||||
token = quora.Account.create(logging = True, enable_bot_creation=True)
|
token = quora.Account.create(logging=True, enable_bot_creation=True)
|
||||||
|
|
||||||
model = quora.Model.create(
|
model = quora.Model.create(
|
||||||
token = token,
|
token=token,
|
||||||
model = 'gpt-3.5-turbo', # or claude-instant-v1.0
|
model='gpt-3.5-turbo', # or claude-instant-v1.0
|
||||||
system_prompt = 'you are ChatGPT a large language model ...'
|
system_prompt='you are ChatGPT a large language model ...'
|
||||||
)
|
)
|
||||||
|
|
||||||
print(model.name) # gptx....
|
print(model.name) # gptx....
|
||||||
|
|
||||||
# streaming response
|
# streaming response
|
||||||
for response in quora.StreamingCompletion.create(
|
for response in quora.StreamingCompletion.create(
|
||||||
custom_model = model.name,
|
custom_model=model.name,
|
||||||
prompt ='hello world',
|
prompt='hello world',
|
||||||
token = token):
|
token=token):
|
||||||
|
print(response.text)
|
||||||
print(response.completion.choices[0].text)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Normal Response:
|
#### Normal Response:
|
||||||
```python
|
```python
|
||||||
|
import quora
|
||||||
|
|
||||||
response = quora.Completion.create(model = 'gpt-4',
|
response = quora.Completion.create(model = 'gpt-4',
|
||||||
prompt = 'hello world',
|
prompt = 'hello world',
|
||||||
token = token)
|
token = 'token')
|
||||||
|
|
||||||
print(response.completion.choices[0].text)
|
print(response.text)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Update Use This For Poe
|
#### Update Use This For Poe
|
|
@ -6,11 +6,12 @@ from pathlib import Path
|
||||||
from random import choice, choices, randint
|
from random import choice, choices, randint
|
||||||
from re import search, findall
|
from re import search, findall
|
||||||
from string import ascii_letters, digits
|
from string import ascii_letters, digits
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union, List, Any, Generator
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
||||||
import selenium.webdriver.support.expected_conditions as EC
|
import selenium.webdriver.support.expected_conditions as EC
|
||||||
from fake_useragent import UserAgent
|
from fake_useragent import UserAgent
|
||||||
|
from pydantic import BaseModel
|
||||||
from pypasser import reCaptchaV3
|
from pypasser import reCaptchaV3
|
||||||
from requests import Session
|
from requests import Session
|
||||||
from selenium.webdriver import Firefox, Chrome, FirefoxOptions, ChromeOptions
|
from selenium.webdriver import Firefox, Chrome, FirefoxOptions, ChromeOptions
|
||||||
|
@ -18,8 +19,8 @@ from selenium.webdriver.common.by import By
|
||||||
from selenium.webdriver.support.wait import WebDriverWait
|
from selenium.webdriver.support.wait import WebDriverWait
|
||||||
from tls_client import Session as TLS
|
from tls_client import Session as TLS
|
||||||
|
|
||||||
from quora.api import Client as PoeClient
|
from .api import Client as PoeClient
|
||||||
from quora.mail import Emailnator
|
from .mail import Emailnator
|
||||||
|
|
||||||
SELENIUM_WEB_DRIVER_ERROR_MSG = b'''The error message you are receiving is due to the `geckodriver` executable not
|
SELENIUM_WEB_DRIVER_ERROR_MSG = b'''The error message you are receiving is due to the `geckodriver` executable not
|
||||||
being found in your system\'s PATH. To resolve this issue, you need to download the geckodriver and add its location
|
being found in your system\'s PATH. To resolve this issue, you need to download the geckodriver and add its location
|
||||||
|
@ -67,42 +68,27 @@ def extract_formkey(html):
|
||||||
return formkey
|
return formkey
|
||||||
|
|
||||||
|
|
||||||
class PoeResponse:
|
class Choice(BaseModel):
|
||||||
class Completion:
|
text: str
|
||||||
class Choices:
|
index: int
|
||||||
def __init__(self, choice: dict) -> None:
|
logprobs: Any
|
||||||
self.text = choice['text']
|
finish_reason: str
|
||||||
self.content = self.text.encode()
|
|
||||||
self.index = choice['index']
|
|
||||||
self.logprobs = choice['logprobs']
|
|
||||||
self.finish_reason = choice['finish_reason']
|
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
|
||||||
return f'''<__main__.APIResponse.Completion.Choices(\n text = {self.text.encode()},\n index = {self.index},\n logprobs = {self.logprobs},\n finish_reason = {self.finish_reason})object at 0x1337>'''
|
|
||||||
|
|
||||||
def __init__(self, choices: dict) -> None:
|
class Usage(BaseModel):
|
||||||
self.choices = [self.Choices(choice) for choice in choices]
|
prompt_tokens: int
|
||||||
|
completion_tokens: int
|
||||||
|
total_tokens: int
|
||||||
|
|
||||||
class Usage:
|
|
||||||
def __init__(self, usage_dict: dict) -> None:
|
|
||||||
self.prompt_tokens = usage_dict['prompt_tokens']
|
|
||||||
self.completion_tokens = usage_dict['completion_tokens']
|
|
||||||
self.total_tokens = usage_dict['total_tokens']
|
|
||||||
|
|
||||||
def __repr__(self):
|
class PoeResponse(BaseModel):
|
||||||
return f'''<__main__.APIResponse.Usage(\n prompt_tokens = {self.prompt_tokens},\n completion_tokens = {self.completion_tokens},\n total_tokens = {self.total_tokens})object at 0x1337>'''
|
id: int
|
||||||
|
object: str
|
||||||
def __init__(self, response_dict: dict) -> None:
|
created: int
|
||||||
self.response_dict = response_dict
|
model: str
|
||||||
self.id = response_dict['id']
|
choices: List[Choice]
|
||||||
self.object = response_dict['object']
|
usage: Usage
|
||||||
self.created = response_dict['created']
|
text: str
|
||||||
self.model = response_dict['model']
|
|
||||||
self.completion = self.Completion(response_dict['choices'])
|
|
||||||
self.usage = self.Usage(response_dict['usage'])
|
|
||||||
|
|
||||||
def json(self) -> dict:
|
|
||||||
return self.response_dict
|
|
||||||
|
|
||||||
|
|
||||||
class ModelResponse:
|
class ModelResponse:
|
||||||
|
@ -116,11 +102,11 @@ class ModelResponse:
|
||||||
class Model:
|
class Model:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create(
|
def create(
|
||||||
token: str,
|
token: str,
|
||||||
model: str = 'gpt-3.5-turbo', # claude-instant
|
model: str = 'gpt-3.5-turbo', # claude-instant
|
||||||
system_prompt: str = 'You are ChatGPT a large language model developed by Openai. Answer as consisely as possible',
|
system_prompt: str = 'You are ChatGPT a large language model developed by Openai. Answer as consisely as possible',
|
||||||
description: str = 'gpt-3.5 language model from openai, skidded by poe.com',
|
description: str = 'gpt-3.5 language model from openai, skidded by poe.com',
|
||||||
handle: str = None,
|
handle: str = None,
|
||||||
) -> ModelResponse:
|
) -> ModelResponse:
|
||||||
models = {
|
models = {
|
||||||
'gpt-3.5-turbo': 'chinchilla',
|
'gpt-3.5-turbo': 'chinchilla',
|
||||||
|
@ -202,9 +188,9 @@ class Model:
|
||||||
class Account:
|
class Account:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create(
|
def create(
|
||||||
proxy: Optional[str] = None,
|
proxy: Optional[str] = None,
|
||||||
logging: bool = False,
|
logging: bool = False,
|
||||||
enable_bot_creation: bool = False,
|
enable_bot_creation: bool = False,
|
||||||
):
|
):
|
||||||
client = TLS(client_identifier='chrome110')
|
client = TLS(client_identifier='chrome110')
|
||||||
client.proxies = {'http': f'http://{proxy}', 'https': f'http://{proxy}'} if proxy else None
|
client.proxies = {'http': f'http://{proxy}', 'https': f'http://{proxy}'} if proxy else None
|
||||||
|
@ -309,22 +295,23 @@ class Account:
|
||||||
class StreamingCompletion:
|
class StreamingCompletion:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create(
|
def create(
|
||||||
model: str = 'gpt-4',
|
model: str = 'gpt-4',
|
||||||
custom_model: bool = None,
|
custom_model: bool = None,
|
||||||
prompt: str = 'hello world',
|
prompt: str = 'hello world',
|
||||||
token: str = '',
|
token: str = '',
|
||||||
):
|
) -> Generator[PoeResponse, None, None]:
|
||||||
_model = MODELS[model] if not custom_model else custom_model
|
_model = MODELS[model] if not custom_model else custom_model
|
||||||
|
|
||||||
client = PoeClient(token)
|
client = PoeClient(token)
|
||||||
|
|
||||||
for chunk in client.send_message(_model, prompt):
|
for chunk in client.send_message(_model, prompt):
|
||||||
yield PoeResponse(
|
yield PoeResponse(
|
||||||
{
|
**{
|
||||||
'id': chunk['messageId'],
|
'id': chunk['messageId'],
|
||||||
'object': 'text_completion',
|
'object': 'text_completion',
|
||||||
'created': chunk['creationTime'],
|
'created': chunk['creationTime'],
|
||||||
'model': _model,
|
'model': _model,
|
||||||
|
'text': chunk['text_new'],
|
||||||
'choices': [
|
'choices': [
|
||||||
{
|
{
|
||||||
'text': chunk['text_new'],
|
'text': chunk['text_new'],
|
||||||
|
@ -343,12 +330,13 @@ class StreamingCompletion:
|
||||||
|
|
||||||
|
|
||||||
class Completion:
|
class Completion:
|
||||||
|
@staticmethod
|
||||||
def create(
|
def create(
|
||||||
model: str = 'gpt-4',
|
model: str = 'gpt-4',
|
||||||
custom_model: str = None,
|
custom_model: str = None,
|
||||||
prompt: str = 'hello world',
|
prompt: str = 'hello world',
|
||||||
token: str = '',
|
token: str = '',
|
||||||
):
|
) -> PoeResponse:
|
||||||
models = {
|
models = {
|
||||||
'sage': 'capybara',
|
'sage': 'capybara',
|
||||||
'gpt-4': 'beaver',
|
'gpt-4': 'beaver',
|
||||||
|
@ -361,15 +349,17 @@ class Completion:
|
||||||
|
|
||||||
client = PoeClient(token)
|
client = PoeClient(token)
|
||||||
|
|
||||||
for chunk in client.send_message(_model, prompt):
|
chunk = None
|
||||||
pass
|
for response in client.send_message(_model, prompt):
|
||||||
|
chunk = response
|
||||||
|
|
||||||
return PoeResponse(
|
return PoeResponse(
|
||||||
{
|
**{
|
||||||
'id': chunk['messageId'],
|
'id': chunk['messageId'],
|
||||||
'object': 'text_completion',
|
'object': 'text_completion',
|
||||||
'created': chunk['creationTime'],
|
'created': chunk['creationTime'],
|
||||||
'model': _model,
|
'model': _model,
|
||||||
|
'text': chunk['text_new'],
|
||||||
'choices': [
|
'choices': [
|
||||||
{
|
{
|
||||||
'text': chunk['text'],
|
'text': chunk['text'],
|
||||||
|
@ -389,12 +379,12 @@ class Completion:
|
||||||
|
|
||||||
class Poe:
|
class Poe:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
model: str = 'ChatGPT',
|
model: str = 'ChatGPT',
|
||||||
driver: str = 'firefox',
|
driver: str = 'firefox',
|
||||||
download_driver: bool = False,
|
download_driver: bool = False,
|
||||||
driver_path: Optional[str] = None,
|
driver_path: Optional[str] = None,
|
||||||
cookie_path: str = './quora/cookie.json',
|
cookie_path: str = './quora/cookie.json',
|
||||||
):
|
):
|
||||||
# validating the model
|
# validating the model
|
||||||
if model and model not in MODELS:
|
if model and model not in MODELS:
|
||||||
|
@ -473,12 +463,12 @@ class Poe:
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def create_bot(
|
def create_bot(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
/,
|
/,
|
||||||
prompt: str = '',
|
prompt: str = '',
|
||||||
base_model: str = 'ChatGPT',
|
base_model: str = 'ChatGPT',
|
||||||
description: str = '',
|
description: str = '',
|
||||||
) -> None:
|
) -> None:
|
||||||
if base_model not in MODELS:
|
if base_model not in MODELS:
|
||||||
raise RuntimeError('Sorry, the base_model you provided does not exist. Please check and try again.')
|
raise RuntimeError('Sorry, the base_model you provided does not exist. Please check and try again.')
|
|
@ -384,7 +384,7 @@ class Client:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# update info about response
|
# update info about response
|
||||||
message["text_new"] = message["text"][len(last_text):]
|
message["text_new"] = message["text"][len(last_text) :]
|
||||||
last_text = message["text"]
|
last_text = message["text"]
|
||||||
message_id = message["messageId"]
|
message_id = message["messageId"]
|
||||||
|
|
||||||
|
@ -456,21 +456,21 @@ class Client:
|
||||||
logger.info(f"No more messages left to delete.")
|
logger.info(f"No more messages left to delete.")
|
||||||
|
|
||||||
def create_bot(
|
def create_bot(
|
||||||
self,
|
self,
|
||||||
handle,
|
handle,
|
||||||
prompt="",
|
prompt="",
|
||||||
base_model="chinchilla",
|
base_model="chinchilla",
|
||||||
description="",
|
description="",
|
||||||
intro_message="",
|
intro_message="",
|
||||||
api_key=None,
|
api_key=None,
|
||||||
api_bot=False,
|
api_bot=False,
|
||||||
api_url=None,
|
api_url=None,
|
||||||
prompt_public=True,
|
prompt_public=True,
|
||||||
pfp_url=None,
|
pfp_url=None,
|
||||||
linkification=False,
|
linkification=False,
|
||||||
markdown_rendering=True,
|
markdown_rendering=True,
|
||||||
suggested_replies=False,
|
suggested_replies=False,
|
||||||
private=False,
|
private=False,
|
||||||
):
|
):
|
||||||
result = self.send_query(
|
result = self.send_query(
|
||||||
"PoeBotCreateMutation",
|
"PoeBotCreateMutation",
|
||||||
|
@ -499,21 +499,21 @@ class Client:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def edit_bot(
|
def edit_bot(
|
||||||
self,
|
self,
|
||||||
bot_id,
|
bot_id,
|
||||||
handle,
|
handle,
|
||||||
prompt="",
|
prompt="",
|
||||||
base_model="chinchilla",
|
base_model="chinchilla",
|
||||||
description="",
|
description="",
|
||||||
intro_message="",
|
intro_message="",
|
||||||
api_key=None,
|
api_key=None,
|
||||||
api_url=None,
|
api_url=None,
|
||||||
private=False,
|
private=False,
|
||||||
prompt_public=True,
|
prompt_public=True,
|
||||||
pfp_url=None,
|
pfp_url=None,
|
||||||
linkification=False,
|
linkification=False,
|
||||||
markdown_rendering=True,
|
markdown_rendering=True,
|
||||||
suggested_replies=False,
|
suggested_replies=False,
|
||||||
):
|
):
|
||||||
result = self.send_query(
|
result = self.send_query(
|
||||||
"PoeBotEditMutation",
|
"PoeBotEditMutation",
|
0
openai_rev/quora/graphql/__init__.py
Normal file
0
openai_rev/quora/graphql/__init__.py
Normal file
|
@ -42,9 +42,7 @@ class Emailnator:
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
sleep(2)
|
sleep(2)
|
||||||
mail_token = self.client.post(
|
mail_token = self.client.post("https://www.emailnator.com/message-list", json={"email": self.email})
|
||||||
"https://www.emailnator.com/message-list", json={"email": self.email}
|
|
||||||
)
|
|
||||||
|
|
||||||
mail_token = loads(mail_token.text)["messageData"]
|
mail_token = loads(mail_token.text)["messageData"]
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
### Example: `you` (use like openai pypi package) <a name="example-you"></a>
|
### Example: `you` (use like openai pypi package) <a name="example-you"></a>
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import you
|
|
||||||
|
from openai_rev import you
|
||||||
|
|
||||||
# simple request with links and details
|
# simple request with links and details
|
||||||
response = you.Completion.create(
|
response = you.Completion.create(
|
|
@ -1,28 +1,36 @@
|
||||||
|
import json
|
||||||
import re
|
import re
|
||||||
from json import loads
|
from typing import Optional, List, Dict, Any
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from fake_useragent import UserAgent
|
from fake_useragent import UserAgent
|
||||||
|
from pydantic import BaseModel
|
||||||
from tls_client import Session
|
from tls_client import Session
|
||||||
|
|
||||||
|
|
||||||
|
class PoeResponse(BaseModel):
|
||||||
|
text: Optional[str] = None
|
||||||
|
links: List[str] = []
|
||||||
|
extra: Dict[str, Any] = {}
|
||||||
|
|
||||||
|
|
||||||
class Completion:
|
class Completion:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create(
|
def create(
|
||||||
prompt: str,
|
prompt: str,
|
||||||
page: int = 1,
|
page: int = 1,
|
||||||
count: int = 10,
|
count: int = 10,
|
||||||
safe_search: str = 'Moderate',
|
safe_search: str = 'Moderate',
|
||||||
on_shopping_page: bool = False,
|
on_shopping_page: bool = False,
|
||||||
mkt: str = '',
|
mkt: str = '',
|
||||||
response_filter: str = 'WebPages,Translations,TimeZone,Computation,RelatedSearches',
|
response_filter: str = 'WebPages,Translations,TimeZone,Computation,RelatedSearches',
|
||||||
domain: str = 'youchat',
|
domain: str = 'youchat',
|
||||||
query_trace_id: str = None,
|
query_trace_id: str = None,
|
||||||
chat: list = None,
|
chat: list = None,
|
||||||
include_links: bool = False,
|
include_links: bool = False,
|
||||||
detailed: bool = False,
|
detailed: bool = False,
|
||||||
debug: bool = False,
|
debug: bool = False,
|
||||||
) -> dict:
|
) -> PoeResponse:
|
||||||
if chat is None:
|
if chat is None:
|
||||||
chat = []
|
chat = []
|
||||||
|
|
||||||
|
@ -57,23 +65,25 @@ class Completion:
|
||||||
r'(?<=event: youChatSerpResults\ndata:)(.*\n)*?(?=event: )', response.text
|
r'(?<=event: youChatSerpResults\ndata:)(.*\n)*?(?=event: )', response.text
|
||||||
).group()
|
).group()
|
||||||
third_party_search_results = re.search(
|
third_party_search_results = re.search(
|
||||||
r'(?<=event: thirdPartySearchResults\ndata:)(.*\n)*?(?=event: )', response.text).group()
|
r'(?<=event: thirdPartySearchResults\ndata:)(.*\n)*?(?=event: )', response.text
|
||||||
|
).group()
|
||||||
# slots = findall(r"slots\ndata: (.*)\n\nevent", response.text)[0]
|
# slots = findall(r"slots\ndata: (.*)\n\nevent", response.text)[0]
|
||||||
|
|
||||||
text = ''.join(re.findall(r'{\"youChatToken\": \"(.*?)\"}', response.text))
|
text = ''.join(re.findall(r'{\"youChatToken\": \"(.*?)\"}', response.text))
|
||||||
|
|
||||||
extra = {
|
extra = {
|
||||||
'youChatSerpResults': loads(you_chat_serp_results),
|
'youChatSerpResults': json.loads(you_chat_serp_results),
|
||||||
# 'slots' : loads(slots)
|
# 'slots' : loads(slots)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
response = PoeResponse(text=text.replace('\\n', '\n').replace('\\\\', '\\').replace('\\"', '"'))
|
||||||
'response': text.replace('\\n', '\n').replace('\\\\', '\\').replace('\\"', '"'),
|
if include_links:
|
||||||
'links': loads(third_party_search_results)['search']['third_party_search_results']
|
response.links = json.loads(third_party_search_results)['search']['third_party_search_results']
|
||||||
if include_links
|
|
||||||
else None,
|
if detailed:
|
||||||
'extra': extra if detailed else None,
|
response.extra = extra
|
||||||
}
|
|
||||||
|
return response
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __get_headers(cls) -> dict:
|
def __get_headers(cls) -> dict:
|
||||||
|
@ -94,5 +104,5 @@ class Completion:
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __get_failure_response(cls) -> dict:
|
def __get_failure_response(cls) -> PoeResponse:
|
||||||
return dict(response='Unable to fetch the response, Please try again.', links=[], extra={})
|
return PoeResponse(text='Unable to fetch the response, Please try again.')
|
|
@ -1,5 +1,5 @@
|
||||||
websocket-client
|
websocket-client
|
||||||
requests
|
requests==2.29.0
|
||||||
tls-client
|
tls-client
|
||||||
pypasser
|
pypasser
|
||||||
names
|
names
|
||||||
|
@ -9,3 +9,4 @@ streamlit==1.21.0
|
||||||
selenium
|
selenium
|
||||||
fake-useragent
|
fake-useragent
|
||||||
twocaptcha
|
twocaptcha
|
||||||
|
pydantic
|
3
testing/accounts.txt
Normal file
3
testing/accounts.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
idkaovprvbrjbb@bugfoo.com:eyJhbGciOiJSUzI1NiIsImtpZCI6Imluc18yTzZ3UTFYd3dxVFdXUWUyQ1VYZHZ2bnNaY2UiLCJ0eXAiOiJKV1QifQ.eyJhenAiOiJodHRwczovL2FjY291bnRzLmZvcmVmcm9udC5haSIsImV4cCI6MTY4MjYxNDUxOSwiaWF0IjoxNjgyNjE0NDU5LCJpc3MiOiJodHRwczovL2NsZXJrLmZvcmVmcm9udC5haSIsIm5iZiI6MTY4MjYxNDQ0OSwic2lkIjoic2Vzc18yUDFBeFNHNnFHdzhWSFNla2lhMVB0NWJYdW8iLCJzdWIiOiJ1c2VyXzJQMUF4TWlNRzFLb00xeFFUQVExcFFjd0d3dyJ9.Nw82ExUQMvJE8oVAmUYl81dS9J43YK0AQYwLJjE5fCozanqQi946q_6DRRQz-9kkm-Zd60zuFzl_ANgZ9lLOOSMd89oJArbu3VUOA8Q-BOtUE0INmwvPCP7KtLDEVRGEsF8oIddwE1Da1rEToBEHrwBuzOVbRvoKqbJ7KZrRB7tHzUVyik3n7K3bddyecIA5Gtj8Nmc_NvwVaBelHOfjH0eoU7y0oza-bOJPNCRosjV3kFdoYhHNtNvQkfIF7MSmqyeC-NHhDVdmv57ehkVdr_H0_MyoT2kNWEk1ETzST36Lhu06yaaWzAPhjpcThN8Q7OFNXSHUAhTJibMHER6UGw
|
||||||
|
vpmysvdoydnumi@bugfoo.com:eyJhbGciOiJSUzI1NiIsImtpZCI6Imluc18yTzZ3UTFYd3dxVFdXUWUyQ1VYZHZ2bnNaY2UiLCJ0eXAiOiJKV1QifQ.eyJhenAiOiJodHRwczovL2FjY291bnRzLmZvcmVmcm9udC5haSIsImV4cCI6MTY4MjYyMDM4MSwiaWF0IjoxNjgyNjIwMzIxLCJpc3MiOiJodHRwczovL2NsZXJrLmZvcmVmcm9udC5haSIsIm5iZiI6MTY4MjYyMDMxMSwic2lkIjoic2Vzc18yUDFNcTM1Tmtld3lIa2NOYUJvNDcyV1haR0MiLCJzdWIiOiJ1c2VyXzJQMU1xNFRYcmJlYVhSYVdKUWFjZGRZTVNyMiJ9.PVQlpsxJxgTOaizJ34AGkP3yJzhDAUFBw29gEP0cHCuUZcAUk1MVKeXYoXr32nqQmUmPO5-kmbp3p639idzA3E7EYnOCJ6xOTs6qB4QvmtEfAJQLD84-h5cYXkLzpqcWZeszDkoAQAZKhmI5kGn_OJzblYVodSjz92klrGSASuqIwqywvGNKb2NwQ80yRrNHUcGeI6tRPtMdZ0ieOi04SphXpyB7-JLZuco8nwqivs3uX97Jtkw3EYsTjhp5MKwfG9hGjHk54IwxAJtbMCSMDxDcOYxO2vxVL4W4syCHCB3yUJANmuFjL7mIv76uy4w0YIJtDFAYn3oad7dbHWKtSQ
|
||||||
|
xjwollilwtumif@bugfoo.com:eyJhbGciOiJSUzI1NiIsImtpZCI6Imluc18yTzZ3UTFYd3dxVFdXUWUyQ1VYZHZ2bnNaY2UiLCJ0eXAiOiJKV1QifQ.eyJhenAiOiJodHRwczovL2FjY291bnRzLmZvcmVmcm9udC5haSIsImV4cCI6MTY4MjYyMDcwNywiaWF0IjoxNjgyNjIwNjQ3LCJpc3MiOiJodHRwczovL2NsZXJrLmZvcmVmcm9udC5haSIsIm5iZiI6MTY4MjYyMDYzNywic2lkIjoic2Vzc18yUDFOVjBjMm5JdWVLak82SjVWUTVoTHVZTWQiLCJzdWIiOiJ1c2VyXzJQMU5VelpRWjZUZXRETkhnT0dWOHlaZ09pciJ9.O6GsP0QtekV5UMxvMEpUa65I5E_2ahihRbLGAfjSAnyWNY72fQgCgbi75n4L85ej9V9qeDxMqCPF0BA5hXN606ybdlBY_HvlvwRIgyKU2r5JyaltOow7bg6vu_qwj91YejvTDHR7w_cwq-FF4VRYysiJfoc-8jcO2HZl8HM0R8aaSf8xDHy0wCfpBYKN2Mw3-mP23Z08NxlehKXNdKoQq_zKQOJbl0DxfWaoFB6b-xocIl8RO2PR6r1yf0VzHaPNxa1PUrPcs94iaqXuOjpCzqEqO9kZf6WM0rWKRx6-u9A0BECaeirfYpNvdaNQHzIRSndzpTO-Kvnww6HtjDD-tg
|
|
@ -1,10 +1,9 @@
|
||||||
import forefront
|
from openai_rev import forefront
|
||||||
|
|
||||||
# create an account
|
# create an account
|
||||||
token = forefront.Account.create(logging=True)
|
token = forefront.Account.create(logging=True)
|
||||||
print(token)
|
print(token)
|
||||||
|
|
||||||
# get a response
|
# get a response
|
||||||
for response in forefront.StreamingCompletion.create(token=token,
|
for response in forefront.StreamingCompletion.create(token=token, prompt='hello world', model='gpt-4'):
|
||||||
prompt='hello world', model='gpt-4'):
|
print(response)
|
||||||
print(response.completion.choices[0].text, end='')
|
|
||||||
|
|
|
@ -2,11 +2,10 @@ from hashlib import md5
|
||||||
from json import dumps
|
from json import dumps
|
||||||
from re import findall
|
from re import findall
|
||||||
|
|
||||||
from tls_client import Session as TLS
|
|
||||||
from twocaptcha import TwoCaptcha
|
|
||||||
|
|
||||||
from quora import extract_formkey
|
from quora import extract_formkey
|
||||||
from quora.mail import Emailnator
|
from quora.mail import Emailnator
|
||||||
|
from tls_client import Session as TLS
|
||||||
|
from twocaptcha import TwoCaptcha
|
||||||
|
|
||||||
solver = TwoCaptcha('72747bf24a9d89b4dcc1b24875efd358')
|
solver = TwoCaptcha('72747bf24a9d89b4dcc1b24875efd358')
|
||||||
|
|
||||||
|
@ -14,14 +13,13 @@ solver = TwoCaptcha('72747bf24a9d89b4dcc1b24875efd358')
|
||||||
class Account:
|
class Account:
|
||||||
def create(proxy: None or str = None, logging: bool = False, enable_bot_creation: bool = False):
|
def create(proxy: None or str = None, logging: bool = False, enable_bot_creation: bool = False):
|
||||||
client = TLS(client_identifier='chrome110')
|
client = TLS(client_identifier='chrome110')
|
||||||
client.proxies = {
|
client.proxies = {'http': f'http://{proxy}', 'https': f'http://{proxy}'} if proxy else None
|
||||||
'http': f'http://{proxy}',
|
|
||||||
'https': f'http://{proxy}'} if proxy else None
|
|
||||||
|
|
||||||
mail_client = Emailnator()
|
mail_client = Emailnator()
|
||||||
mail_address = mail_client.get_mail()
|
mail_address = mail_client.get_mail()
|
||||||
|
|
||||||
if logging: print('email', mail_address)
|
if logging:
|
||||||
|
print('email', mail_address)
|
||||||
|
|
||||||
client.headers = {
|
client.headers = {
|
||||||
'authority': 'poe.com',
|
'authority': 'poe.com',
|
||||||
|
@ -39,29 +37,30 @@ class Account:
|
||||||
'sec-fetch-dest': 'empty',
|
'sec-fetch-dest': 'empty',
|
||||||
'sec-fetch-mode': 'cors',
|
'sec-fetch-mode': 'cors',
|
||||||
'sec-fetch-site': 'same-origin',
|
'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'
|
'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',
|
||||||
}
|
}
|
||||||
|
|
||||||
client.headers["poe-formkey"] = extract_formkey(client.get('https://poe.com/login').text)
|
client.headers["poe-formkey"] = extract_formkey(client.get('https://poe.com/login').text)
|
||||||
client.headers["poe-tchannel"] = client.get('https://poe.com/api/settings').json()['tchannelData']['channel']
|
client.headers["poe-tchannel"] = client.get('https://poe.com/api/settings').json()['tchannelData']['channel']
|
||||||
|
|
||||||
# token = reCaptchaV3('https://www.recaptcha.net/recaptcha/enterprise/anchor?ar=1&k=6LflhEElAAAAAI_ewVwRWI9hsyV4mbZnYAslSvlG&co=aHR0cHM6Ly9wb2UuY29tOjQ0Mw..&hl=en&v=4PnKmGB9wRHh1i04o7YUICeI&size=invisible&cb=bi6ivxoskyal')
|
# token = reCaptchaV3('https://www.recaptcha.net/recaptcha/enterprise/anchor?ar=1&k=6LflhEElAAAAAI_ewVwRWI9hsyV4mbZnYAslSvlG&co=aHR0cHM6Ly9wb2UuY29tOjQ0Mw..&hl=en&v=4PnKmGB9wRHh1i04o7YUICeI&size=invisible&cb=bi6ivxoskyal')
|
||||||
token = solver.recaptcha(sitekey='6LflhEElAAAAAI_ewVwRWI9hsyV4mbZnYAslSvlG',
|
token = solver.recaptcha(
|
||||||
url='https://poe.com/login?redirect_url=%2F',
|
sitekey='6LflhEElAAAAAI_ewVwRWI9hsyV4mbZnYAslSvlG',
|
||||||
version='v3',
|
url='https://poe.com/login?redirect_url=%2F',
|
||||||
enterprise=1,
|
version='v3',
|
||||||
invisible=1,
|
enterprise=1,
|
||||||
action='login', )['code']
|
invisible=1,
|
||||||
|
action='login',
|
||||||
|
)['code']
|
||||||
|
|
||||||
payload = dumps(separators=(',', ':'), obj={
|
payload = dumps(
|
||||||
'queryName': 'MainSignupLoginSection_sendVerificationCodeMutation_Mutation',
|
separators=(',', ':'),
|
||||||
'variables': {
|
obj={
|
||||||
'emailAddress': mail_address,
|
'queryName': 'MainSignupLoginSection_sendVerificationCodeMutation_Mutation',
|
||||||
'phoneNumber': None,
|
'variables': {'emailAddress': mail_address, 'phoneNumber': None, 'recaptchaToken': token},
|
||||||
'recaptchaToken': token
|
'query': 'mutation MainSignupLoginSection_sendVerificationCodeMutation_Mutation(\n $emailAddress: String\n $phoneNumber: String\n $recaptchaToken: String\n) {\n sendVerificationCode(verificationReason: login, emailAddress: $emailAddress, phoneNumber: $phoneNumber, recaptchaToken: $recaptchaToken) {\n status\n errorMessage\n }\n}\n',
|
||||||
},
|
},
|
||||||
'query': 'mutation MainSignupLoginSection_sendVerificationCodeMutation_Mutation(\n $emailAddress: String\n $phoneNumber: String\n $recaptchaToken: String\n) {\n sendVerificationCode(verificationReason: login, emailAddress: $emailAddress, phoneNumber: $phoneNumber, recaptchaToken: $recaptchaToken) {\n status\n errorMessage\n }\n}\n',
|
)
|
||||||
})
|
|
||||||
|
|
||||||
base_string = payload + client.headers["poe-formkey"] + 'WpuLMiXEKKE98j56k'
|
base_string = payload + client.headers["poe-formkey"] + 'WpuLMiXEKKE98j56k'
|
||||||
client.headers["poe-tag-id"] = md5(base_string.encode()).hexdigest()
|
client.headers["poe-tag-id"] = md5(base_string.encode()).hexdigest()
|
||||||
|
@ -74,31 +73,34 @@ class Account:
|
||||||
print('please try using a proxy / wait for fix')
|
print('please try using a proxy / wait for fix')
|
||||||
|
|
||||||
if 'Bad Request' in response.text:
|
if 'Bad Request' in response.text:
|
||||||
if logging: print('bad request, retrying...', response.json())
|
if logging:
|
||||||
|
print('bad request, retrying...', response.json())
|
||||||
quit()
|
quit()
|
||||||
|
|
||||||
if logging: print('send_code', response.json())
|
if logging:
|
||||||
|
print('send_code', response.json())
|
||||||
|
|
||||||
mail_content = mail_client.get_message()
|
mail_content = mail_client.get_message()
|
||||||
mail_token = findall(r';">(\d{6,7})</div>', mail_content)[0]
|
mail_token = findall(r';">(\d{6,7})</div>', mail_content)[0]
|
||||||
|
|
||||||
if logging: print('code', mail_token)
|
if logging:
|
||||||
|
print('code', mail_token)
|
||||||
|
|
||||||
payload = dumps(separators=(',', ':'), obj={
|
payload = dumps(
|
||||||
"queryName": "SignupOrLoginWithCodeSection_signupWithVerificationCodeMutation_Mutation",
|
separators=(',', ':'),
|
||||||
"variables": {
|
obj={
|
||||||
"verificationCode": str(mail_token),
|
"queryName": "SignupOrLoginWithCodeSection_signupWithVerificationCodeMutation_Mutation",
|
||||||
"emailAddress": mail_address,
|
"variables": {"verificationCode": str(mail_token), "emailAddress": mail_address, "phoneNumber": None},
|
||||||
"phoneNumber": None
|
"query": "mutation SignupOrLoginWithCodeSection_signupWithVerificationCodeMutation_Mutation(\n $verificationCode: String!\n $emailAddress: String\n $phoneNumber: String\n) {\n signupWithVerificationCode(verificationCode: $verificationCode, emailAddress: $emailAddress, phoneNumber: $phoneNumber) {\n status\n errorMessage\n }\n}\n",
|
||||||
},
|
},
|
||||||
"query": "mutation SignupOrLoginWithCodeSection_signupWithVerificationCodeMutation_Mutation(\n $verificationCode: String!\n $emailAddress: String\n $phoneNumber: String\n) {\n signupWithVerificationCode(verificationCode: $verificationCode, emailAddress: $emailAddress, phoneNumber: $phoneNumber) {\n status\n errorMessage\n }\n}\n"
|
)
|
||||||
})
|
|
||||||
|
|
||||||
base_string = payload + client.headers["poe-formkey"] + 'WpuLMiXEKKE98j56k'
|
base_string = payload + client.headers["poe-formkey"] + 'WpuLMiXEKKE98j56k'
|
||||||
client.headers["poe-tag-id"] = md5(base_string.encode()).hexdigest()
|
client.headers["poe-tag-id"] = md5(base_string.encode()).hexdigest()
|
||||||
|
|
||||||
response = client.post('https://poe.com/api/gql_POST', data=payload)
|
response = client.post('https://poe.com/api/gql_POST', data=payload)
|
||||||
if logging: print('verify_code', response.json())
|
if logging:
|
||||||
|
print('verify_code', response.json())
|
||||||
|
|
||||||
|
|
||||||
Account.create(proxy='xtekky:wegwgwegwed_streaming-1@geo.iproyal.com:12321', logging=True)
|
Account.create(proxy='xtekky:wegwgwegwed_streaming-1@geo.iproyal.com:12321', logging=True)
|
||||||
|
|
|
@ -7,7 +7,5 @@ print('token', token)
|
||||||
|
|
||||||
sleep(2)
|
sleep(2)
|
||||||
|
|
||||||
for response in quora.StreamingCompletion.create(model='gpt-3.5-turbo',
|
for response in quora.StreamingCompletion.create(model='ChatGPT', prompt='hello world', token=token):
|
||||||
prompt='hello world',
|
print(response.text, flush=True)
|
||||||
token=token):
|
|
||||||
print(response.completion.choices[0].text, end="", flush=True)
|
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
import quora
|
from openai_rev import quora
|
||||||
|
|
||||||
token = quora.Account.create(logging=True, enable_bot_creation=True)
|
token = quora.Account.create(logging=True, enable_bot_creation=True)
|
||||||
|
|
||||||
model = quora.Model.create(
|
model = quora.Model.create(
|
||||||
token=token,
|
token=token, model='ChatGPT', system_prompt='you are ChatGPT a large language model ...' # or claude-instant-v1.0
|
||||||
model='gpt-3.5-turbo', # or claude-instant-v1.0
|
|
||||||
system_prompt='you are ChatGPT a large language model ...'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
print(model.name)
|
print(model.name)
|
||||||
|
|
||||||
for response in quora.StreamingCompletion.create(
|
for response in quora.StreamingCompletion.create(custom_model=model.name, prompt='hello world', token=token):
|
||||||
custom_model=model.name,
|
print(response.text)
|
||||||
prompt='hello world',
|
|
||||||
token=token):
|
|
||||||
print(response.completion.choices[0].text)
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import sqlchat
|
import sqlchat
|
||||||
|
|
||||||
for response in sqlchat.StreamCompletion.create(
|
for response in sqlchat.StreamCompletion.create(prompt='write python code to reverse a string', messages=[]):
|
||||||
prompt='write python code to reverse a string',
|
|
||||||
messages=[]):
|
|
||||||
print(response.completion.choices[0].text, end='')
|
print(response.completion.choices[0].text, end='')
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import t3nsor
|
import t3nsor
|
||||||
|
|
||||||
for response in t3nsor.StreamCompletion.create(
|
for response in t3nsor.StreamCompletion.create(prompt='write python code to reverse a string', messages=[]):
|
||||||
prompt='write python code to reverse a string',
|
|
||||||
messages=[]):
|
|
||||||
print(response.completion.choices[0].text)
|
print(response.completion.choices[0].text)
|
||||||
|
|
|
@ -4,17 +4,14 @@ import writesonic
|
||||||
# create account (3-4s)
|
# create account (3-4s)
|
||||||
account = writesonic.Account.create(logging=True)
|
account = writesonic.Account.create(logging=True)
|
||||||
|
|
||||||
# with loging:
|
# with loging:
|
||||||
# 2023-04-06 21:50:25 INFO __main__ -> register success : '{"id":"51aa0809-3053-44f7-922a...' (2s)
|
# 2023-04-06 21:50:25 INFO __main__ -> register success : '{"id":"51aa0809-3053-44f7-922a...' (2s)
|
||||||
# 2023-04-06 21:50:25 INFO __main__ -> id : '51aa0809-3053-44f7-922a-2b85d8d07edf'
|
# 2023-04-06 21:50:25 INFO __main__ -> id : '51aa0809-3053-44f7-922a-2b85d8d07edf'
|
||||||
# 2023-04-06 21:50:25 INFO __main__ -> token : 'eyJhbGciOiJIUzI1NiIsInR5cCI6Ik...'
|
# 2023-04-06 21:50:25 INFO __main__ -> token : 'eyJhbGciOiJIUzI1NiIsInR5cCI6Ik...'
|
||||||
# 2023-04-06 21:50:28 INFO __main__ -> got key : '194158c4-d249-4be0-82c6-5049e869533c' (2s)
|
# 2023-04-06 21:50:28 INFO __main__ -> got key : '194158c4-d249-4be0-82c6-5049e869533c' (2s)
|
||||||
|
|
||||||
# simple completion
|
# simple completion
|
||||||
response = writesonic.Completion.create(
|
response = writesonic.Completion.create(api_key=account.key, prompt='hello world')
|
||||||
api_key=account.key,
|
|
||||||
prompt='hello world'
|
|
||||||
)
|
|
||||||
|
|
||||||
print(response.completion.choices[0].text) # Hello! How may I assist you today?
|
print(response.completion.choices[0].text) # Hello! How may I assist you today?
|
||||||
|
|
||||||
|
@ -24,16 +21,7 @@ response = writesonic.Completion.create(
|
||||||
api_key=account.key,
|
api_key=account.key,
|
||||||
prompt='what is my name ?',
|
prompt='what is my name ?',
|
||||||
enable_memory=True,
|
enable_memory=True,
|
||||||
history_data=[
|
history_data=[{'is_sent': True, 'message': 'my name is Tekky'}, {'is_sent': False, 'message': 'hello Tekky'}],
|
||||||
{
|
|
||||||
'is_sent': True,
|
|
||||||
'message': 'my name is Tekky'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'is_sent': False,
|
|
||||||
'message': 'hello Tekky'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
print(response.completion.choices[0].text) # Your name is Tekky.
|
print(response.completion.choices[0].text) # Your name is Tekky.
|
||||||
|
@ -41,9 +29,7 @@ print(response.completion.choices[0].text) # Your name is Tekky.
|
||||||
# enable internet
|
# enable internet
|
||||||
|
|
||||||
response = writesonic.Completion.create(
|
response = writesonic.Completion.create(
|
||||||
api_key=account.key,
|
api_key=account.key, prompt='who won the quatar world cup ?', enable_google_results=True
|
||||||
prompt='who won the quatar world cup ?',
|
|
||||||
enable_google_results=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
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 ...
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import you
|
from openai_rev import you
|
||||||
|
|
||||||
# simple request with links and details
|
# simple request with links and details
|
||||||
response = you.Completion.create(prompt="hello world", detailed=True, include_links=True)
|
response = you.Completion.create(prompt="hello world", detailed=True, include_links=True)
|
||||||
|
|
Loading…
Reference in a new issue