diff --git a/pyproject.toml b/pyproject.toml index 2eec0501..441cafc7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,7 @@ black = "*" dalle3 = "*" torchvision = "*" rich = "*" +EdgeGPT = "*" [tool.poetry.dev-dependencies] diff --git a/requirements.txt b/requirements.txt index a1b5736c..03db2ded 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ # faiss-gpu transformers pandas -# langchain==0.0.240 langchain nest_asyncio pegasusx @@ -22,7 +21,6 @@ google-generativeai duckduckgo-search agent-protocol chromadb -exxa open-interpreter tabulate colored diff --git a/swarms/models/bing_chat.py b/swarms/models/bing_chat.py index 8525ab7a..3fcb3359 100644 --- a/swarms/models/bing_chat.py +++ b/swarms/models/bing_chat.py @@ -1,11 +1,12 @@ """EdgeGPT model by OpenAI""" -import asyncio, json +import asyncio +import json from EdgeGPT.EdgeGPT import Chatbot, ConversationStyle from EdgeGPT.EdgeUtils import ImageQuery, Query, Cookie from EdgeGPT.ImageGen import ImageGen from pathlib import Path -class EdgeGPTModel: +class BingChat: """ EdgeGPT model by OpenAI @@ -16,9 +17,9 @@ class EdgeGPTModel: Examples -------- - >>> edgegpt = EdgeGPTModel(cookies_path="./path/to/cookies.json") - >>> response = edgegpt.ask("Hello, my name is ChatGPT") - >>> image_path = edgegpt.generate_image("Sunset over mountains") + >>> edgegpt = BingChat(cookies_path="./path/to/cookies.json") + >>> response = edgegpt("Hello, my name is ChatGPT") + >>> image_path = edgegpt.create_img("Sunset over mountains") """ @@ -33,7 +34,7 @@ class EdgeGPTModel: response = asyncio.run(self.bot.ask(prompt=prompt, conversation_style=style, simplify_response=True)) return response['text'] - def generate_image(self, prompt: str, output_dir: str = "./output", auth_cookie: str = None) -> str: + def create_img(self, prompt: str, output_dir: str = "./output", auth_cookie: str = None) -> str: """ Generate an image based on the provided prompt and save it in the given output directory. Returns the path of the generated image. @@ -52,11 +53,4 @@ class EdgeGPTModel: """ Set the directory path for managing cookies. """ - Cookie.dir_path = Path(path) - -# Example Usage: -# edgegpt = EdgeGPTModel(cookies_path="./path/to/cookies.json") -# text_response = edgegpt.ask("Hello, my name is ChatGPT") -# image_path = edgegpt.generate_image("Sunset over mountains", auth_cookie="YOUR_AUTH_COOKIE") - - + Cookie.dir_path = Path(path) \ No newline at end of file