diff --git a/playground/agents/revgpt_agent.py b/playground/agents/revgpt_agent.py new file mode 100644 index 00000000..66b20fca --- /dev/null +++ b/playground/agents/revgpt_agent.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/revgpt.py b/revgpt.py index 66b20fca..89fcb1b9 100644 --- a/revgpt.py +++ b/revgpt.py @@ -1,8 +1,12 @@ import os +import sys from dotenv import load_dotenv from swarms.models.revgpt import RevChatGPTModel from swarms.workers.worker import Worker +root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) +sys.path.append(root_dir) + load_dotenv() config = { @@ -13,13 +17,12 @@ config = { "unverified_plugin_domains": [os.getenv("REVGPT_UNVERIFIED_PLUGIN_DOMAINS")] } -llm = RevChatGPTModel(access_token=os.getenv("ACCESS_TOKEN"), **config) +# For v1 model +# model = RevChatGPTModel(access_token=os.getenv("ACCESS_TOKEN"), **config) -worker = Worker( - ai_name="Optimus Prime", - llm=llm -) +# For v3 model +model = RevChatGPTModel(access_token=os.getenv("OPENAI_API_KEY"), **config) -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) +task = "Write a cli snake game" +response = model.run(task) print(response)