From 54b4c789a75fec5c3a92a03dfd2d93d051309651 Mon Sep 17 00:00:00 2001 From: Raju Komati Date: Sat, 29 Apr 2023 14:55:24 +0530 Subject: added gpt4free package --- testing/forefront_test.py | 2 +- testing/poe_account_create_test.py | 4 ++-- testing/poe_test.py | 2 +- testing/quora_test_2.py | 2 +- testing/test_main.py | 20 ++++++++++++-------- testing/you_test.py | 6 +++--- 6 files changed, 20 insertions(+), 16 deletions(-) (limited to 'testing') diff --git a/testing/forefront_test.py b/testing/forefront_test.py index 8d25ed89..b7b5c57c 100644 --- a/testing/forefront_test.py +++ b/testing/forefront_test.py @@ -1,4 +1,4 @@ -from openai_rev import forefront +from gpt4free import forefront # create an account token = forefront.Account.create(logging=True) diff --git a/testing/poe_account_create_test.py b/testing/poe_account_create_test.py index 7072597f..ace2306e 100644 --- a/testing/poe_account_create_test.py +++ b/testing/poe_account_create_test.py @@ -6,8 +6,8 @@ from typing import Optional 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 +from gpt4free.quora import extract_formkey +from gpt4free.quora.mail import Emailnator solver = TwoCaptcha('72747bf24a9d89b4dcc1b24875efd358') diff --git a/testing/poe_test.py b/testing/poe_test.py index 809804f2..22d95f5f 100644 --- a/testing/poe_test.py +++ b/testing/poe_test.py @@ -1,6 +1,6 @@ from time import sleep -from openai_rev import quora +from gpt4free import quora token = quora.Account.create(proxy=None, logging=True) print('token', token) diff --git a/testing/quora_test_2.py b/testing/quora_test_2.py index 5d06f9ed..297ca7a1 100644 --- a/testing/quora_test_2.py +++ b/testing/quora_test_2.py @@ -1,4 +1,4 @@ -from openai_rev import quora +from gpt4free import quora token = quora.Account.create(logging=True, enable_bot_creation=True) diff --git a/testing/test_main.py b/testing/test_main.py index 612ec695..bd4d03e9 100644 --- a/testing/test_main.py +++ b/testing/test_main.py @@ -1,24 +1,28 @@ -from openai_rev import openai_rev, Provider, quora, forefront +import gpt4free +from gpt4free import Provider, quora, forefront # usage You -response = openai_rev.Completion.create(Provider.You, prompt='Write a poem on Lionel Messi') +response = gpt4free.Completion.create(Provider.You, prompt='Write a poem on Lionel Messi') print(response) # usage Poe -token = quora.Account.create(logging=False) -response = openai_rev.Completion.create( - Provider.Poe, prompt='Write a poem on Lionel Messi', token=token, model='ChatGPT' -) +# token = quora.Account.create(logging=False) +token = 'GKzCahZYGKhp76LfE197xw==' +response = gpt4free.Completion.create(Provider.Poe, prompt='Write a poem on Lionel Messi', token=token, model='ChatGPT') print(response) # usage forefront token = forefront.Account.create(logging=False) -response = openai_rev.Completion.create( +response = gpt4free.Completion.create( Provider.ForeFront, prompt='Write a poem on Lionel Messi', model='gpt-4', token=token ) print(response) print(f'END') # usage theb -response = openai_rev.Completion.create(Provider.Theb, prompt='Write a poem on Lionel Messi') +response = gpt4free.Completion.create(Provider.Theb, prompt='Write a poem on Lionel Messi') +print(response) + +# usage cocalc +response = gpt4free.Completion.create(Provider.CoCalc, prompt='Write a poem on Lionel Messi', cookie_input='') print(response) diff --git a/testing/you_test.py b/testing/you_test.py index 34800301..1e9f6205 100644 --- a/testing/you_test.py +++ b/testing/you_test.py @@ -1,4 +1,4 @@ -from openai_rev import you +from gpt4free import you # simple request with links and details response = you.Completion.create(prompt="hello world", detailed=True, include_links=True) @@ -22,6 +22,6 @@ while True: response = you.Completion.create(prompt=prompt, chat=chat) - print("Bot:", response["response"]) + print("Bot:", response.text) - chat.append({"question": prompt, "answer": response["response"]}) + chat.append({"question": prompt, "answer": response.text}) -- cgit v1.2.3 From 1981d379d5b79d858f1c0faa8e4c95bcb4e98236 Mon Sep 17 00:00:00 2001 From: Raju Komati Date: Sat, 29 Apr 2023 15:43:24 +0530 Subject: added readme for gpt4 module --- testing/test_main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'testing') diff --git a/testing/test_main.py b/testing/test_main.py index bd4d03e9..7c28f1d2 100644 --- a/testing/test_main.py +++ b/testing/test_main.py @@ -6,8 +6,7 @@ response = gpt4free.Completion.create(Provider.You, prompt='Write a poem on Lion print(response) # usage Poe -# token = quora.Account.create(logging=False) -token = 'GKzCahZYGKhp76LfE197xw==' +token = quora.Account.create(logging=False) response = gpt4free.Completion.create(Provider.Poe, prompt='Write a poem on Lionel Messi', token=token, model='ChatGPT') print(response) -- cgit v1.2.3