Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -74,6 +74,7 @@ class CustomDuckDuckGoSearchTool(Tool):
|
|
| 74 |
except Exception as e:
|
| 75 |
print(f"Error in DuckDuckGoSearchTool: {e}")
|
| 76 |
return f"Search error: {e}"
|
|
|
|
| 77 |
|
| 78 |
class CustomVisitWebpageTool(Tool):
|
| 79 |
def __call__(self, url: str) -> str:
|
|
@@ -88,7 +89,7 @@ class CustomVisitWebpageTool(Tool):
|
|
| 88 |
except Exception as e:
|
| 89 |
print(f"Error in VisitWebpageTool: {e}")
|
| 90 |
return f"Webpage access error: {e}"
|
| 91 |
-
|
| 92 |
|
| 93 |
#=======Agent========#
|
| 94 |
hf_token = os.environ.get("HF_TOKEN")
|
|
@@ -102,8 +103,8 @@ agent = CodeAgent(
|
|
| 102 |
modulus,
|
| 103 |
search_tool,
|
| 104 |
web_search,
|
| 105 |
-
|
| 106 |
-
|
| 107 |
model = model,
|
| 108 |
add_base_tools=True,
|
| 109 |
planning_interval=3
|
|
|
|
| 74 |
except Exception as e:
|
| 75 |
print(f"Error in DuckDuckGoSearchTool: {e}")
|
| 76 |
return f"Search error: {e}"
|
| 77 |
+
custome_duck_search = CustomDuckDuckGoSearchTool()
|
| 78 |
|
| 79 |
class CustomVisitWebpageTool(Tool):
|
| 80 |
def __call__(self, url: str) -> str:
|
|
|
|
| 89 |
except Exception as e:
|
| 90 |
print(f"Error in VisitWebpageTool: {e}")
|
| 91 |
return f"Webpage access error: {e}"
|
| 92 |
+
custome_web_search = CustomVisitWebpageTool()
|
| 93 |
|
| 94 |
#=======Agent========#
|
| 95 |
hf_token = os.environ.get("HF_TOKEN")
|
|
|
|
| 103 |
modulus,
|
| 104 |
search_tool,
|
| 105 |
web_search,
|
| 106 |
+
custome_web_search,
|
| 107 |
+
custome_duck_search],
|
| 108 |
model = model,
|
| 109 |
add_base_tools=True,
|
| 110 |
planning_interval=3
|