GPT-4 browsing and plugin - Fixed HugChat and Bing

This commit is contained in:
IntelligenzaArtificiale
2023-06-25 18:09:28 +02:00
committed by GitHub
parent 254453f7b5
commit 9550cfaf19
5 changed files with 45 additions and 66 deletions
+11 -24
View File
@@ -31,7 +31,6 @@ select_model = input(
2) HuggingChat \n \
3) BingChat \n \
4) Google Bard \n \
5) HuggingFace \n \
>>> "
)
@@ -47,34 +46,24 @@ if select_model == "1":
start_chat = os.getenv("USE_EXISTING_CHAT", False)
if os.getenv("USE_GPT4") == "True":
model = "gpt4"
model = "gpt-4"
else:
model = "default"
if start_chat:
chat_id = os.getenv("CHAT_ID")
if chat_id == None:
raise ValueError("You have to set up your chat-id in the .env file")
llm = ChatGPTAPI.ChatGPT(
token=os.environ["CHATGPT_TOKEN"], conversation=chat_id, model=model
)
else:
llm = ChatGPTAPI.ChatGPT(token=os.environ["CHATGPT_TOKEN"], model=model)
llm = ChatGPTAPI.ChatGPT(token=os.environ["CHATGPT_TOKEN"], model=model)
elif select_model == "2":
if not os.path.exists("cookiesHuggingChat.json"):
emailHF = os.getenv("emailHF", "your-emailHF")
pswHF = os.getenv("pswHF", "your-pswHF")
if emailHF != "your-emailHF" or pswHF != "your-pswHF":
os.environ["emailHF"] = emailHF
os.environ["pswHF"] = pswHF
else:
raise ValueError(
"File 'cookiesHuggingChat.json' not found! Create it and put your cookies in there in the JSON format."
"HuggingChat Token EMPTY. Edit the .env file and put your HuggingChat credentials"
)
cookie_path = Path() / "cookiesHuggingChat.json"
with open("cookiesHuggingChat.json", "r") as file:
try:
file_json = json.loads(file.read())
except JSONDecodeError:
raise ValueError(
"You did not put your cookies inside 'cookiesHuggingChat.json'! You can find the simple guide to get the cookie file here: https://github.com/IntelligenzaArtificiale/Free-Auto-GPT"
)
llm = HuggingChatAPI.HuggingChat(cookiepath = str(cookie_path))
llm = HuggingChatAPI.HuggingChat(email=os.environ["emailHF"], psw=os.environ["pswHF"])
elif select_model == "3":
if not os.path.exists("cookiesBing.json"):
@@ -105,8 +94,6 @@ elif select_model == "4":
cookie_path = os.environ["BARDCHAT_TOKEN"]
llm = BardChatAPI.BardChat(cookie=cookie_path)
elif select_model == "5":
llm = HuggingFaceAPI.HuggingFace()
HF_TOKEN = os.getenv("HUGGINGFACE_TOKEN", "your-huggingface-token")
+11 -21
View File
@@ -45,34 +45,24 @@ if select_model == "1":
start_chat = os.getenv("USE_EXISTING_CHAT", False)
if os.getenv("USE_GPT4") == "True":
model = "gpt4"
model = "gpt-4"
else:
model = "default"
if start_chat:
chat_id = os.getenv("CHAT_ID")
if chat_id == None:
raise ValueError("You have to set up your chat-id in the .env file")
llm = ChatGPTAPI.ChatGPT(
token=os.environ["CHATGPT_TOKEN"], conversation=chat_id, model=model
)
else:
llm = ChatGPTAPI.ChatGPT(token=os.environ["CHATGPT_TOKEN"], model=model)
llm = ChatGPTAPI.ChatGPT(token=os.environ["CHATGPT_TOKEN"], model=model)
elif select_model == "2":
if not os.path.exists("cookiesHuggingChat.json"):
emailHF = os.getenv("emailHF", "your-emailHF")
pswHF = os.getenv("pswHF", "your-pswHF")
if emailHF != "your-emailHF" or pswHF != "your-pswHF":
os.environ["emailHF"] = emailHF
os.environ["pswHF"] = pswHF
else:
raise ValueError(
"File 'cookiesHuggingChat.json' not found! Create it and put your cookies in there in the JSON format."
"HuggingChat Token EMPTY. Edit the .env file and put your HuggingChat credentials"
)
cookie_path = Path() / "cookiesHuggingChat.json"
with open("cookiesHuggingChat.json", "r") as file:
try:
file_json = json.loads(file.read())
except JSONDecodeError:
raise ValueError(
"You did not put your cookies inside 'cookiesHuggingChat.json'! You can find the simple guide to get the cookie file here: https://github.com/IntelligenzaArtificiale/Free-Auto-GPT"
)
llm = HuggingChatAPI.HuggingChat(cookiepath = str(cookie_path))
llm = HuggingChatAPI.HuggingChat(email=os.environ["emailHF"], psw=os.environ["pswHF"])
elif select_model == "3":
if not os.path.exists("cookiesBing.json"):
+11 -1
View File
@@ -50,7 +50,17 @@ if select_model == "1":
llm = ChatGPTAPI.ChatGPT(token=os.environ["CHATGPT_TOKEN"], model=model)
elif select_model == "2":
llm = HuggingChatAPI.HuggingChat()
emailHF = os.getenv("emailHF", "your-emailHF")
pswHF = os.getenv("pswHF", "your-pswHF")
if emailHF != "your-emailHF" or pswHF != "your-pswHF":
os.environ["emailHF"] = emailHF
os.environ["pswHF"] = pswHF
else:
raise ValueError(
"HuggingChat Token EMPTY. Edit the .env file and put your HuggingChat credentials"
)
llm = HuggingChatAPI.HuggingChat(email=os.environ["emailHF"], psw=os.environ["pswHF"])
elif select_model == "3":
if not os.path.exists("cookiesBing.json"):
+11 -20
View File
@@ -34,33 +34,24 @@ if select_model == "1":
start_chat = os.getenv("USE_EXISTING_CHAT", False)
if os.getenv("USE_GPT4") == "True":
model = "gpt4"
model = "gpt-4"
else:
model = "default"
if start_chat:
chat_id = os.getenv("CHAT_ID")
if chat_id == None:
raise ValueError("You have to set up your chat-id in the .env file")
agent = agents.ChatGPTAgent(
token=os.environ["CHATGPT_TOKEN"], conversation=chat_id, model=model
)
else:
agent = agents.ChatGPTAgent(token=os.environ["CHATGPT_TOKEN"], model=model)
agent = agents.ChatGPTAgent(token=os.environ["CHATGPT_TOKEN"], model=model)
elif select_model == "2":
if not os.path.exists("cookiesHuggingChat.json"):
emailHF = os.getenv("emailHF", "your-emailHF")
pswHF = os.getenv("pswHF", "your-pswHF")
if emailHF != "your-emailHF" or pswHF != "your-pswHF":
os.environ["emailHF"] = emailHF
os.environ["pswHF"] = pswHF
else:
raise ValueError(
"File 'cookiesHuggingChat.json' not found! Create it and put your cookies in there in the JSON format."
"HuggingChat Token EMPTY. Edit the .env file and put your HuggingChat credentials"
)
cookie_path = Path() / "cookiesHuggingChat.json"
with open("cookiesHuggingChat.json", "r") as file:
try:
file_json = json.loads(file.read())
except JSONDecodeError:
raise ValueError(
"You did not put your cookies inside 'cookiesHuggingChat.json'! You can find the simple guide to get the cookie file here: https://github.com/IntelligenzaArtificiale/Free-Auto-GPT"
)
agent = agents.HuggingChatAgent()
elif select_model == "3":
+1
View File
@@ -24,3 +24,4 @@ GoogleBard
lark
accelerate
diffusers
gpt4-openai-api