1
0
Fork 0

update openai_rev module add test file with simple use

This commit is contained in:
Raju Komati 2023-04-28 02:27:06 +05:30
parent 920fe19608
commit b206a1eb63
No known key found for this signature in database
GPG key ID: A581A5D67A8EB090
10 changed files with 72 additions and 74 deletions

View file

@ -0,0 +1 @@
from .openai_rev import Provider

View file

@ -1,9 +1,9 @@
from json import loads from json import loads
from re import match from re import match
from time import time, sleep from time import time, sleep
from typing import Generator, Optional
from uuid import uuid4 from uuid import uuid4
from altair.vegalite.v3 import Generator
from fake_useragent import UserAgent from fake_useragent import UserAgent
from requests import post from requests import post
from tls_client import Session from tls_client import Session
@ -14,7 +14,7 @@ from .models import ForeFrontResponse
class Account: class Account:
@staticmethod @staticmethod
def create(proxy=None, logging=False): def create(proxy: Optional[str] = None, logging: bool = False):
proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else False proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else False
start = time() start = time()
@ -57,6 +57,7 @@ class Account:
while True: while True:
sleep(1) sleep(1)
for _ in mail_client.fetch_inbox(): for _ in mail_client.fetch_inbox():
if logging:
print(mail_client.get_message_content(_['id'])) print(mail_client.get_message_content(_['id']))
mail_token = match(r'(\d){5,6}', mail_client.get_message_content(_['id'])).group(0) mail_token = match(r'(\d){5,6}', mail_client.get_message_content(_['id'])).group(0)
@ -166,7 +167,9 @@ class Completion:
default_persona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default default_persona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default
model='gpt-4', model='gpt-4',
) -> ForeFrontResponse: ) -> ForeFrontResponse:
text = ''
final_response = None final_response = None
res = list(StreamingCompletion.create(token=token, prompt=prompt))
for response in StreamingCompletion.create( for response in StreamingCompletion.create(
token=token, token=token,
chat_id=chat_id, chat_id=chat_id,
@ -175,6 +178,13 @@ class Completion:
default_persona=default_persona, default_persona=default_persona,
model=model, model=model,
): ):
if response:
final_response = response final_response = response
text += response.text
if final_response:
final_response.text = text
else:
raise Exception('Unable to get the response, Please try again')
return final_response return final_response

View file

@ -1,12 +1,14 @@
from enum import Enum from enum import Enum
import quora from openai_rev import forefront
import you from openai_rev import quora
from openai_rev import you
class Provider(Enum): class Provider(Enum):
You = 'you' You = 'you'
Poe = 'poe' Poe = 'poe'
ForeFront = 'fore_front'
class Completion: class Completion:
@ -16,20 +18,17 @@ class Completion:
return Completion.__poe_service(prompt, **kwargs) return Completion.__poe_service(prompt, **kwargs)
elif provider == Provider.You: elif provider == Provider.You:
return Completion.__you_service(prompt, **kwargs) return Completion.__you_service(prompt, **kwargs)
elif provider == Provider.ForeFront:
return Completion.__fore_front_service(prompt, **kwargs)
@classmethod @classmethod
def __you_service(cls, prompt: str, **kwargs) -> str: def __you_service(cls, prompt: str, **kwargs) -> str:
return you.Completion.create(prompt).text return you.Completion.create(prompt, **kwargs).text
@classmethod @classmethod
def __poe_service(cls, prompt: str, **kwargs) -> str: def __poe_service(cls, prompt: str, **kwargs) -> str:
return quora.Completion.create(prompt=prompt).text return quora.Completion.create(prompt=prompt, **kwargs).text
@classmethod
# usage You def __fore_front_service(cls, prompt: str, **kwargs) -> str:
response = Completion.create(Provider.You, prompt='Write a poem on Lionel Messi') return forefront.Completion.create(prompt=prompt, **kwargs).text
print(response)
# usage Poe
response = Completion.create(Provider.Poe, prompt='Write a poem on Lionel Messi', token='GKzCahZYGKhp76LfE197xw==')
print(response)

View file

@ -1,37 +0,0 @@
### 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)
```

View file

@ -108,11 +108,6 @@ class Model:
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 = {
'gpt-3.5-turbo': 'chinchilla',
'claude-instant-v1.0': 'a2',
'gpt-4': 'beaver',
}
if not handle: if not handle:
handle = f'gptx{randint(1111111, 9999999)}' handle = f'gptx{randint(1111111, 9999999)}'
@ -148,7 +143,7 @@ class Model:
obj={ obj={
'queryName': 'CreateBotMain_poeBotCreate_Mutation', 'queryName': 'CreateBotMain_poeBotCreate_Mutation',
'variables': { 'variables': {
'model': models[model], 'model': MODELS[model],
'handle': handle, 'handle': handle,
'prompt': system_prompt, 'prompt': system_prompt,
'isPromptPublic': True, 'isPromptPublic': True,
@ -337,15 +332,7 @@ class Completion:
prompt: str = 'hello world', prompt: str = 'hello world',
token: str = '', token: str = '',
) -> PoeResponse: ) -> PoeResponse:
models = { _model = MODELS[model] if not custom_model else custom_model
'sage': 'capybara',
'gpt-4': 'beaver',
'claude-v1.2': 'a2_2',
'claude-instant-v1.0': 'a2',
'gpt-3.5-turbo': 'chinchilla',
}
_model = models[model] if not custom_model else custom_model
client = PoeClient(token) client = PoeClient(token)
@ -359,7 +346,7 @@ class Completion:
'object': 'text_completion', 'object': 'text_completion',
'created': chunk['creationTime'], 'created': chunk['creationTime'],
'model': _model, 'model': _model,
'text': chunk['text_new'], 'text': chunk['text'],
'choices': [ 'choices': [
{ {
'text': chunk['text'], 'text': chunk['text'],

View file

@ -1,3 +1,17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iOiJKV1QifQ.eyJhenAiOiJodHRwczovL2FjY291bnRzLmZvcmVmcm9udC5haSIsImV4cCI6MTY4MjYyODgwMSwiaWF0IjoxNjgyNjI4NzQxLCJpc3MiOiJodHRwczovL2NsZXJrLmZvcmVmcm9udC5haSIsIm5iZiI6MTY4MjYyODczMSwic2lkIjoic2Vzc18yUDFkdThHWkdJUHR4bXZvY2ZQMVJaSU12TnEiLCJzdWIiOiJ1c2VyXzJQMWR1N1RIN0VEeGx6NTQwTktITHdFalZSWCJ9.S-VMHfS9U-OYRBJsL6VjQzQawnV3opwYf0AQNQYiXaieMQTD8Op351zx9X6wKUk7JWeNZykP9-D8eNMBR8MeQ4ePxIRWmLtVnTBxJsoTNkXpC9FpbRzhTr84fXwkFccg-Yr3uPqdYuDz2EiPpROi3D2o072cNU1ZE2P4gSf6MOkatXP2l7ZYyNyI9WJEjkDJ5nRuGErPk9HLUuWzpqefmJSoo0PyrCT0OZSSGaNeB-QrcrLrw19UxqHcBdMYsay0HicX8A94HFerVlGz14s8aM4TdZNHWRZAgI627-HP23DZe53HUVTBCsRA6KYv4D7TI1PzVGrZVMweG1oaMkvr0A

View file

@ -6,4 +6,4 @@ print(token)
# get a response # get a response
for response in forefront.StreamingCompletion.create(token=token, prompt='hello world', model='gpt-4'): for response in forefront.StreamingCompletion.create(token=token, prompt='hello world', model='gpt-4'):
print(response) print(response.text, end='')

View file

@ -1,17 +1,20 @@
from hashlib import md5 from hashlib import md5
from json import dumps from json import dumps
from re import findall from re import findall
from typing import Optional
from quora import extract_formkey
from quora.mail import Emailnator
from tls_client import Session as TLS from tls_client import Session as TLS
from twocaptcha import TwoCaptcha from twocaptcha import TwoCaptcha
from openai_rev.quora import extract_formkey
from openai_rev.quora.mail import Emailnator
solver = TwoCaptcha('72747bf24a9d89b4dcc1b24875efd358') solver = TwoCaptcha('72747bf24a9d89b4dcc1b24875efd358')
class Account: class Account:
def create(proxy: None or str = None, logging: bool = False, enable_bot_creation: bool = False): @staticmethod
def create(proxy: Optional[str] = None, logging: 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

View file

@ -1,6 +1,6 @@
from time import sleep from time import sleep
import quora from openai_rev import quora
token = quora.Account.create(proxy=None, logging=True) token = quora.Account.create(proxy=None, logging=True)
print('token', token) print('token', token)

21
testing/test_main.py Normal file
View file

@ -0,0 +1,21 @@
from openai_rev import openai_rev, Provider, quora, forefront
# usage You
response = openai_rev.Completion.create(Provider.You, prompt='Write a poem on Lionel Messi')
print(response)
print(f'END')
# usage Poe
# token = quora.Account.create(logging=False)
token = 'GKzCahZYGKhp76LfE197xw=='
response = openai_rev.Completion.create(
Provider.Poe, prompt='Write a poem on Lionel Messi', token=token, model='ChatGPT'
)
print(response)
print(f'END')
# usage forefront
token = forefront.Account.create(logging=False)
response = openai_rev.Completion.create(
Provider.ForeFront, prompt='Write a poem on Lionel Messi', model='gpt-4', token=token
)
print(response)