Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,22 +8,12 @@ from tools.final_answer import FinalAnswerTool
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
@tool
|
| 11 |
-
def
|
| 12 |
"""A tool that runs a DuckDuckGo search and returns a formatted result.
|
| 13 |
Args:
|
| 14 |
query: A string representing the query to search for.
|
| 15 |
"""
|
| 16 |
-
|
| 17 |
-
response = requests.get(
|
| 18 |
-
"https://lite.duckduckgo.com/lite/",
|
| 19 |
-
params={"q": query},
|
| 20 |
-
headers={"User-Agent": "Mozilla/5.0"},
|
| 21 |
-
)
|
| 22 |
-
response.raise_for_status()
|
| 23 |
-
print(f"Response: {response}")
|
| 24 |
-
return response
|
| 25 |
-
except Exception as e:
|
| 26 |
-
return f"Error running search: {str(e)}"
|
| 27 |
|
| 28 |
@tool
|
| 29 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -62,7 +52,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 62 |
|
| 63 |
agent = CodeAgent(
|
| 64 |
model=model,
|
| 65 |
-
tools=[final_answer, get_current_time_in_timezone,
|
| 66 |
max_steps=6,
|
| 67 |
verbosity_level=1,
|
| 68 |
grammar=None,
|
|
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
@tool
|
| 11 |
+
def custom_tool(query:str)-> str:
|
| 12 |
"""A tool that runs a DuckDuckGo search and returns a formatted result.
|
| 13 |
Args:
|
| 14 |
query: A string representing the query to search for.
|
| 15 |
"""
|
| 16 |
+
return "My custom tool"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
@tool
|
| 19 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 52 |
|
| 53 |
agent = CodeAgent(
|
| 54 |
model=model,
|
| 55 |
+
tools=[final_answer, get_current_time_in_timezone, DuckDuckGoSearchTool()], ## add your tools here (don't remove final answer)
|
| 56 |
max_steps=6,
|
| 57 |
verbosity_level=1,
|
| 58 |
grammar=None,
|