diff --git a/.env.example b/.env.example index 212290bf..a367261e 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,4 @@ OPENAI_API_KEY="your_openai_api_key_here" -CHATGPT_BASE_URL="" GOOGLE_API_KEY="" ANTHROPIC_API_KEY="" @@ -33,8 +32,15 @@ HF_API_KEY="your_huggingface_api_key_here" REDIS_HOST= REDIS_PORT= - - #dbs PINECONE_API_KEY="" BING_COOKIE="" + +# RevGpt Configuration +ACCESS_TOKEN="your_access_token_here" +REVGPT_MODEL="gpt-4" +REVGPT_PLUGIN_IDS="plugin-d1d6eb04-3375-40aa-940a-c2fc57ce0f51" #plugins found here https://github.com/acheong08/ChatGPT/blob/main/docs/plugins.json +REVGPT_DISABLE_HISTORY=True +REVGPT_PUID="your_puid_here" +REVGPT_UNVERIFIED_PLUGIN_DOMAINS="showme.redstarplugin.com" +CHATGPT_BASE_URL="" diff --git a/pyproject.toml b/pyproject.toml index 96a337fd..031a4137 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,4 +77,4 @@ max_line_length = 120 ignore = "E501,W6" # or ["E501", "W6"] in-place = true recursive = true -aggressive = 3 \ No newline at end of file +aggressive = 3 diff --git a/revgpt.py b/revgpt.py new file mode 100644 index 00000000..66b20fca --- /dev/null +++ b/revgpt.py @@ -0,0 +1,25 @@ +import os +from dotenv import load_dotenv +from swarms.models.revgpt import RevChatGPTModel +from swarms.workers.worker import Worker + +load_dotenv() + +config = { + "model": os.getenv("REVGPT_MODEL"), + "plugin_ids": [os.getenv("REVGPT_PLUGIN_IDS")], + "disable_history": os.getenv("REVGPT_DISABLE_HISTORY") == "True", + "PUID": os.getenv("REVGPT_PUID"), + "unverified_plugin_domains": [os.getenv("REVGPT_UNVERIFIED_PLUGIN_DOMAINS")] +} + +llm = RevChatGPTModel(access_token=os.getenv("ACCESS_TOKEN"), **config) + +worker = Worker( + ai_name="Optimus Prime", + llm=llm +) + +task = "What were the winning boston marathon times for the past 5 years (ending in 2022)? Generate a table of the year, name, country of origin, and times." +response = worker.run(task) +print(response) diff --git a/swarms/models/revgpt.py b/swarms/models/revgpt.py index e69de29b..1233f2fd 100644 --- a/swarms/models/revgpt.py +++ b/swarms/models/revgpt.py @@ -0,0 +1,24 @@ +import os +import revChatGPT +from revChatGPT.V1 import Chatbot as RevChatGPTV1 +from revChatGPT.V3 import Chatbot as RevChatGPTV3 + +class RevChatGPTModel: + def __init__(self, access_token=None, api_key=None, **kwargs): + self.config = kwargs + if access_token: + self.chatbot = RevChatGPTV1(config={"access_token": access_token}) + elif api_key: + self.chatbot = RevChatGPTV3(api_key=api_key) + else: + raise ValueError("Either access_token or api_key must be provided.") + + def run(self, task: str) -> str: + response = "" + for data in self.chatbot.ask(task): + response = data["message"] + return response + + def generate_summary(self, text: str) -> str: + # Implement summary generation using RevChatGPT + pass