From 5d4f5a26295b672c2407c16117f41946c443ef9f Mon Sep 17 00:00:00 2001 From: Benoit Anastay <45088785+BenoitAnastay@users.noreply.github.com> Date: Tue, 1 Aug 2023 21:48:14 +0200 Subject: [PATCH 1/4] Fixing some errors --- AUTOGPT.py | 2 +- FreeLLM/HuggingChatAPI.py | 2 +- requirements.txt | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/AUTOGPT.py b/AUTOGPT.py index 50019a2..6cfb04e 100644 --- a/AUTOGPT.py +++ b/AUTOGPT.py @@ -8,7 +8,7 @@ from dotenv import load_dotenv from pathlib import Path from json import JSONDecodeError -from langchain.experimental.autonomous_agents.autogpt.agent import AutoGPT +from langchain_experimental.autonomous_agents import AutoGPT from FreeLLM import ChatGPTAPI # FREE CHATGPT API from FreeLLM import HuggingChatAPI # FREE HUGGINGCHAT API from FreeLLM import BingChatAPI # FREE BINGCHAT API diff --git a/FreeLLM/HuggingChatAPI.py b/FreeLLM/HuggingChatAPI.py index 1756bac..4082554 100644 --- a/FreeLLM/HuggingChatAPI.py +++ b/FreeLLM/HuggingChatAPI.py @@ -35,7 +35,7 @@ def _call(self, prompt: str, stop: Optional[List[str]] = None) -> str: cookies = sign.login() # Save cookies to usercookies/.json - sign.saveCookies() + sign.saveCookiesToDir("usercookies/") # Create a ChatBot self.chatbot = hugchat.ChatBot(cookies=cookies.get_dict()) diff --git a/requirements.txt b/requirements.txt index eab88d0..29921ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ requests langchain +langchain_experimental streamlit streamlit-chat-media numpy @@ -8,8 +9,8 @@ duckduckgo-search transformers tabulate wikipedia -faiss-gpu # if u have a GPU -#faiss-cpu # if u dont have a GPU +#faiss-gpu # if u have a GPU +faiss-cpu # if u dont have a GPU nest_asyncio torch # tensorflow >= 2.0 -- For other future models From 0b688bd69683218f92d4a533bf65e01205d5fbb9 Mon Sep 17 00:00:00 2001 From: Benoit Anastay <45088785+BenoitAnastay@users.noreply.github.com> Date: Tue, 1 Aug 2023 22:02:43 +0200 Subject: [PATCH 2/4] Fix EdgeGPT Path --- FreeLLM/BingChatAPI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FreeLLM/BingChatAPI.py b/FreeLLM/BingChatAPI.py index b35f37e..f09668e 100644 --- a/FreeLLM/BingChatAPI.py +++ b/FreeLLM/BingChatAPI.py @@ -1,4 +1,4 @@ -from EdgeGPT import Chatbot, ConversationStyle +from EdgeGPT.EdgeGPT import Chatbot, ConversationStyle import asyncio import requests From 7e579fb31e6779af70a8b370b26284b6c4924f5d Mon Sep 17 00:00:00 2001 From: Benoit Anastay <45088785+BenoitAnastay@users.noreply.github.com> Date: Tue, 1 Aug 2023 22:31:53 +0200 Subject: [PATCH 3/4] Updates for BARD API --- AUTOGPT.py | 9 +++++++-- FreeLLM/BardChatAPI.py | 9 +++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/AUTOGPT.py b/AUTOGPT.py index 6cfb04e..75f69af 100644 --- a/AUTOGPT.py +++ b/AUTOGPT.py @@ -84,6 +84,7 @@ elif select_model == "4": GB_TOKEN = os.getenv("BARDCHAT_TOKEN", "your-googlebard-token") + GB_PSIDTS = os.getenv("BARDCHAT_1PSITS", "your-googlebard-1PSITS") if GB_TOKEN != "your-googlebard-token": os.environ["BARDCHAT_TOKEN"] = GB_TOKEN @@ -91,8 +92,12 @@ raise ValueError( "GoogleBard Token EMPTY. Edit the .env file and put your GoogleBard token" ) - cookie_path = os.environ["BARDCHAT_TOKEN"] - llm = BardChatAPI.BardChat(cookie=cookie_path) + if GB_TOKEN != "your-googlebard-1PSITS": + os.environ["BARDCHAT_1PSITS"] = GB_PSIDTS + + secure_1psid = os.environ["BARDCHAT_TOKEN"] + secure_1psidts = os.environ["BARDCHAT_1PSITS"] + llm = BardChatAPI.BardChat(secure_1psid=secure_1psid,secure_1psidts=secure_1psidts) HF_TOKEN = os.getenv("HUGGINGFACE_TOKEN", "your-huggingface-token") diff --git a/FreeLLM/BardChatAPI.py b/FreeLLM/BardChatAPI.py index d44303c..2985906 100644 --- a/FreeLLM/BardChatAPI.py +++ b/FreeLLM/BardChatAPI.py @@ -14,7 +14,8 @@ class BardChat(LLM): history_data: Optional[List] = [] - cookie : Optional[str] + secure_1psid : Optional[str] + secure_1psidts : Optional[str] chatbot : Optional[Chatbot] = None @@ -28,11 +29,11 @@ async def call(self, prompt: str, stop: Optional[List[str]] = None) -> str: #raise ValueError("stop kwargs are not permitted.") #cookie is a must check if self.chatbot is None: - if self.cookie is None: + if self.secure_1psid is None or self.secure_1psidts is None: raise ValueError("Need a COOKIE , check https://github.com/acheong08/EdgeGPT/tree/master#getting-authentication-required for get your COOKIE AND SAVE") else: #if self.chatbot == None: - self.chatbot = Chatbot(self.cookie) + self.chatbot = Chatbot(self.secure_1psid,self.secure_1psidts) response = self.chatbot.ask(prompt) #print(response) @@ -48,7 +49,7 @@ def _call(self, prompt: str, stop: Optional[List[str]] = None) -> str: @property def _identifying_params(self) -> Mapping[str, Any]: """Get the identifying parameters.""" - return {"model": "BardCHAT", "cookie": self.cookie} + return {"model": "BardCHAT", "secure_1psid": self.secure_1psid} From 847e6147597f5a1c754b8e29fe98783a4d6d1cca Mon Sep 17 00:00:00 2001 From: Benoit Anastay <45088785+BenoitAnastay@users.noreply.github.com> Date: Tue, 1 Aug 2023 23:44:52 +0200 Subject: [PATCH 4/4] Update babyagi --- BABYAGI.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/BABYAGI.py b/BABYAGI.py index 436b02a..4d85250 100644 --- a/BABYAGI.py +++ b/BABYAGI.py @@ -17,7 +17,7 @@ from langchain.vectorstores.base import VectorStore from pydantic import BaseModel, Field from langchain.chains.base import Chain -from langchain.experimental import BabyAGI +from langchain_experimental.autonomous_agents import BabyAGI from BabyAgi import BabyAGIMod import faiss @@ -83,6 +83,7 @@ elif select_model == "4": GB_TOKEN = os.getenv("BARDCHAT_TOKEN", "your-googlebard-token") + GB_PSIDTS = os.getenv("BARDCHAT_1PSITS", "your-googlebard-1PSITS") if GB_TOKEN != "your-googlebard-token": os.environ["BARDCHAT_TOKEN"] = GB_TOKEN @@ -90,8 +91,12 @@ raise ValueError( "GoogleBard Token EMPTY. Edit the .env file and put your GoogleBard token" ) - cookie_path = os.environ["BARDCHAT_TOKEN"] - llm = BardChatAPI.BardChat(cookie=cookie_path) + if GB_TOKEN != "your-googlebard-1PSITS": + os.environ["BARDCHAT_1PSITS"] = GB_PSIDTS + + secure_1psid = os.environ["BARDCHAT_TOKEN"] + secure_1psidts = os.environ["BARDCHAT_1PSITS"] + llm = BardChatAPI.BardChat(secure_1psid=secure_1psid,secure_1psidts=secure_1psidts)