diff --git a/pyproject.toml b/pyproject.toml index 031a4137..f7301660 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ classifiers = [ [tool.poetry.dependencies] python = "^3.8.1" +revChatGPT = "*" transformers = "*" openai = "*" langchain = "*" diff --git a/requirements.txt b/requirements.txt index c92b868c..8581892a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ # faiss-gpu transformers +revChatGPT pandas langchain nest_asyncio diff --git a/swarms/models/revgpt.py b/swarms/models/revgpt.py index 1233f2fd..67f1b1dd 100644 --- a/swarms/models/revgpt.py +++ b/swarms/models/revgpt.py @@ -1,24 +1,29 @@ import os import revChatGPT -from revChatGPT.V1 import Chatbot as RevChatGPTV1 +from revChatGPT.V1 import Chatbot as RevChatGPTV1, time from revChatGPT.V3 import Chatbot as RevChatGPTV3 +from abc import ABC, abstractmethod +from revChatGPT.V1 import Chatbot + class RevChatGPTModel: - def __init__(self, access_token=None, api_key=None, **kwargs): + def __init__(self, access_token=None, **kwargs): + super().__init__() self.config = kwargs if access_token: - self.chatbot = RevChatGPTV1(config={"access_token": access_token}) - elif api_key: - self.chatbot = RevChatGPTV3(api_key=api_key) + self.chatbot = Chatbot(config={"access_token": access_token}) else: - raise ValueError("Either access_token or api_key must be provided.") + raise ValueError("access_token must be provided.") def run(self, task: str) -> str: - response = "" + self.start_time = time.time() + prev_text = "" for data in self.chatbot.ask(task): - response = data["message"] - return response + message = data["message"][len(prev_text):] + prev_text = data["message"] + self.end_time = time.time() + return prev_text def generate_summary(self, text: str) -> str: - # Implement summary generation using RevChatGPT + # Implement this method based on your requirements pass