Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
@@ -3,9 +3,12 @@ import datetime
|
|
3 |
|
4 |
class SmartDuckDuckGoAgent:
|
5 |
def __init__(self):
|
|
|
6 |
self.wikipedia_tool = WikipediaSearchTool()
|
7 |
self.duckduckgo_tool = DuckDuckGoSearchTool()
|
|
|
8 |
self.model = HfApiModel()
|
|
|
9 |
self.agent = CodeAgent(
|
10 |
tools=[self.wikipedia_tool, self.duckduckgo_tool],
|
11 |
model=self.model,
|
@@ -14,7 +17,7 @@ class SmartDuckDuckGoAgent:
|
|
14 |
|
15 |
def __call__(self, question: str) -> str:
|
16 |
# 1. Intentar buscar en Wikipedia
|
17 |
-
wiki_response = self.wikipedia_tool.
|
18 |
if wiki_response and "No results found" not in wiki_response:
|
19 |
return wiki_response
|
20 |
|
|
|
3 |
|
4 |
class SmartDuckDuckGoAgent:
|
5 |
def __init__(self):
|
6 |
+
# Herramientas de búsqueda
|
7 |
self.wikipedia_tool = WikipediaSearchTool()
|
8 |
self.duckduckgo_tool = DuckDuckGoSearchTool()
|
9 |
+
# Modelo
|
10 |
self.model = HfApiModel()
|
11 |
+
# Agente con herramientas y modelo
|
12 |
self.agent = CodeAgent(
|
13 |
tools=[self.wikipedia_tool, self.duckduckgo_tool],
|
14 |
model=self.model,
|
|
|
17 |
|
18 |
def __call__(self, question: str) -> str:
|
19 |
# 1. Intentar buscar en Wikipedia
|
20 |
+
wiki_response = self.wikipedia_tool.search(question)
|
21 |
if wiki_response and "No results found" not in wiki_response:
|
22 |
return wiki_response
|
23 |
|