feat: Add env configurations

Former-commit-id: 8e2b17e28a
discord-bot-framework
Zack 1 year ago
parent 8e6bcef56e
commit b8a4963807

@ -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=""

@ -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)

@ -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
Loading…
Cancel
Save