diff options
-rw-r--r-- | openai_rev/__init__.py | 1 | ||||
-rw-r--r-- | openai_rev/forefront/__init__.py | 18 | ||||
-rw-r--r-- | openai_rev/openai_rev.py | 23 | ||||
-rw-r--r-- | openai_rev/phind/README.md | 37 | ||||
-rw-r--r-- | openai_rev/quora/__init__.py | 19 | ||||
-rw-r--r-- | testing/accounts.txt | 14 | ||||
-rw-r--r-- | testing/forefront_test.py | 2 | ||||
-rw-r--r-- | testing/poe_account_create_test.py | 9 | ||||
-rw-r--r-- | testing/poe_test.py | 2 | ||||
-rw-r--r-- | testing/test_main.py | 21 |
10 files changed, 72 insertions, 74 deletions
diff --git a/openai_rev/__init__.py b/openai_rev/__init__.py index e69de29b..9076abe9 100644 --- a/openai_rev/__init__.py +++ b/openai_rev/__init__.py @@ -0,0 +1 @@ +from .openai_rev import Provider diff --git a/openai_rev/forefront/__init__.py b/openai_rev/forefront/__init__.py index bef10e9e..10202615 100644 --- a/openai_rev/forefront/__init__.py +++ b/openai_rev/forefront/__init__.py @@ -1,9 +1,9 @@ from json import loads from re import match from time import time, sleep +from typing import Generator, Optional from uuid import uuid4 -from altair.vegalite.v3 import Generator from fake_useragent import UserAgent from requests import post from tls_client import Session @@ -14,7 +14,7 @@ from .models import ForeFrontResponse class Account: @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 start = time() @@ -57,7 +57,8 @@ class Account: while True: sleep(1) for _ in mail_client.fetch_inbox(): - print(mail_client.get_message_content(_['id'])) + if logging: + 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: @@ -166,7 +167,9 @@ class Completion: default_persona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default model='gpt-4', ) -> ForeFrontResponse: + text = '' final_response = None + res = list(StreamingCompletion.create(token=token, prompt=prompt)) for response in StreamingCompletion.create( token=token, chat_id=chat_id, @@ -175,6 +178,13 @@ class Completion: default_persona=default_persona, model=model, ): - final_response = response + if 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 diff --git a/openai_rev/openai_rev.py b/openai_rev/openai_rev.py index 6e1341c7..7d483c01 100644 --- a/openai_rev/openai_rev.py +++ b/openai_rev/openai_rev.py @@ -1,12 +1,14 @@ from enum import Enum -import quora -import you +from openai_rev import forefront +from openai_rev import quora +from openai_rev import you class Provider(Enum): You = 'you' Poe = 'poe' + ForeFront = 'fore_front' class Completion: @@ -16,20 +18,17 @@ class Completion: return Completion.__poe_service(prompt, **kwargs) elif provider == Provider.You: return Completion.__you_service(prompt, **kwargs) + elif provider == Provider.ForeFront: + return Completion.__fore_front_service(prompt, **kwargs) @classmethod def __you_service(cls, prompt: str, **kwargs) -> str: - return you.Completion.create(prompt).text + return you.Completion.create(prompt, **kwargs).text @classmethod def __poe_service(cls, prompt: str, **kwargs) -> str: - return quora.Completion.create(prompt=prompt).text + return quora.Completion.create(prompt=prompt, **kwargs).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) + @classmethod + def __fore_front_service(cls, prompt: str, **kwargs) -> str: + return forefront.Completion.create(prompt=prompt, **kwargs).text diff --git a/openai_rev/phind/README.md b/openai_rev/phind/README.md deleted file mode 100644 index 85288c06..00000000 --- a/openai_rev/phind/README.md +++ /dev/null @@ -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) -``` diff --git a/openai_rev/quora/__init__.py b/openai_rev/quora/__init__.py index f5d9e96e..5303f206 100644 --- a/openai_rev/quora/__init__.py +++ b/openai_rev/quora/__init__.py @@ -108,11 +108,6 @@ class Model: description: str = 'gpt-3.5 language model from openai, skidded by poe.com', handle: str = None, ) -> ModelResponse: - models = { - 'gpt-3.5-turbo': 'chinchilla', - 'claude-instant-v1.0': 'a2', - 'gpt-4': 'beaver', - } if not handle: handle = f'gptx{randint(1111111, 9999999)}' @@ -148,7 +143,7 @@ class Model: obj={ 'queryName': 'CreateBotMain_poeBotCreate_Mutation', 'variables': { - 'model': models[model], + 'model': MODELS[model], 'handle': handle, 'prompt': system_prompt, 'isPromptPublic': True, @@ -337,15 +332,7 @@ class Completion: prompt: str = 'hello world', token: str = '', ) -> PoeResponse: - models = { - '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 + _model = MODELS[model] if not custom_model else custom_model client = PoeClient(token) @@ -359,7 +346,7 @@ class Completion: 'object': 'text_completion', 'created': chunk['creationTime'], 'model': _model, - 'text': chunk['text_new'], + 'text': chunk['text'], 'choices': [ { 'text': chunk['text'], diff --git a/testing/accounts.txt b/testing/accounts.txt index 5d687ab7..82a8957d 100644 --- a/testing/accounts.txt +++ b/testing/accoun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OiJodHRwczovL2FjY291bnRzLmZvcmVmcm9udC5haSIsImV4cCI6MTY4MjYyODgwMSwiaWF0IjoxNjgyNjI4NzQxLCJpc3MiOiJodHRwczovL2NsZXJrLmZvcmVmcm9udC5haSIsIm5iZiI6MTY4MjYyODczMSwic2lkIjoic2Vzc18yUDFkdThHWkdJUHR4bXZvY2ZQMVJaSU12TnEiLCJzdWIiOiJ1c2VyXzJQMWR1N1RIN0VEeGx6NTQwTktITHdFalZSWCJ9.S-VMHfS9U-OYRBJsL6VjQzQawnV3opwYf0AQNQYiXaieMQTD8Op351zx9X6wKUk7JWeNZykP9-D8eNMBR8MeQ4ePxIRWmLtVnTBxJsoTNkXpC9FpbRzhTr84fXwkFccg-Yr3uPqdYuDz2EiPpROi3D2o072cNU1ZE2P4gSf6MOkatXP2l7ZYyNyI9WJEjkDJ5nRuGErPk9HLUuWzpqefmJSoo0PyrCT0OZSSGaNeB-QrcrLrw19UxqHcBdMYsay0HicX8A94HFerVlGz14s8aM4TdZNHWRZAgI627-HP23DZe53HUVTBCsRA6KYv4D7TI1PzVGrZVMweG1oaMkvr0A diff --git a/testing/forefront_test.py b/testing/forefront_test.py index 092d1a74..8d25ed89 100644 --- a/testing/forefront_test.py +++ b/testing/forefront_test.py @@ -6,4 +6,4 @@ print(token) # get a response for response in forefront.StreamingCompletion.create(token=token, prompt='hello world', model='gpt-4'): - print(response) + print(response.text, end='') diff --git a/testing/poe_account_create_test.py b/testing/poe_account_create_test.py index 24751c4a..7072597f 100644 --- a/testing/poe_account_create_test.py +++ b/testing/poe_account_create_test.py @@ -1,17 +1,20 @@ from hashlib import md5 from json import dumps 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 twocaptcha import TwoCaptcha +from openai_rev.quora import extract_formkey +from openai_rev.quora.mail import Emailnator + solver = TwoCaptcha('72747bf24a9d89b4dcc1b24875efd358') 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.proxies = {'http': f'http://{proxy}', 'https': f'http://{proxy}'} if proxy else None diff --git a/testing/poe_test.py b/testing/poe_test.py index 5cab067c..809804f2 100644 --- a/testing/poe_test.py +++ b/testing/poe_test.py @@ -1,6 +1,6 @@ from time import sleep -import quora +from openai_rev import quora token = quora.Account.create(proxy=None, logging=True) print('token', token) diff --git a/testing/test_main.py b/testing/test_main.py new file mode 100644 index 00000000..956c004b --- /dev/null +++ b/testing/test_main.py @@ -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) |