From 421e5d6c2df4efe5b00a9f7f6e0a3d651c154803 Mon Sep 17 00:00:00 2001 From: Zack Date: Thu, 19 Oct 2023 23:46:06 -0500 Subject: [PATCH] fix: tool --- bingchat.py | 4 ++-- swarms/tools/tool.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bingchat.py b/bingchat.py index 07c2a21b..db4db08b 100644 --- a/bingchat.py +++ b/bingchat.py @@ -1,9 +1,9 @@ from swarms.models.bing_chat import EdgeGPTModel from swarms.workers.worker import Worker -from swarms.tools.tool.bing_chat import EdgeGPTTool +from swarms.tools.tool import EdgeGPTTool # Initialize the EdgeGPTModel -edgegpt = EdgeGPTModel(cookies_path="./path/to/cookies.json") +edgegpt = EdgeGPTModel(cookies_path="./cookies.txt") # Initialize the custom tool edgegpt_tool = EdgeGPTTool(edgegpt) diff --git a/swarms/tools/tool.py b/swarms/tools/tool.py index 783f0946..ed364556 100644 --- a/swarms/tools/tool.py +++ b/swarms/tools/tool.py @@ -849,3 +849,11 @@ def tool( return _partial else: raise ValueError("Too many arguments for tool decorator") + +class EdgeGPTTool(BaseTool): + def __init__(self, model, name="EdgeGPTTool", description="Tool that uses EdgeGPTModel to generate responses"): + super().__init__(name=name, description=description) + self.model = model + + def _run(self, prompt): + return self.model.__call__(prompt)