Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,24 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -55,7 +73,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
+
@tool
|
| 22 |
+
def web_search_tool(query:str)-> str:
|
| 23 |
+
"""This tool serves as an intelligent web search interface,
|
| 24 |
+
leveraging the DuckDuckGo search engine to retrieve accurate
|
| 25 |
+
and privacy-focused results from across the internet.
|
| 26 |
+
It extracts relevant information from web pages, processes the content,
|
| 27 |
+
and provides structured, contextualized responses.
|
| 28 |
+
The tool excels at finding current information, factual data,
|
| 29 |
+
and diverse perspectives while respecting user privacy and avoiding filter bubbles.
|
| 30 |
+
It can assist with research, fact-checking, and gathering
|
| 31 |
+
up-to-date information from reliable sources.
|
| 32 |
+
Args:
|
| 33 |
+
query: the web query, the thing you are looking for in internet
|
| 34 |
+
"""
|
| 35 |
+
search_tool = DuckDuckGoSearchTool()
|
| 36 |
+
return search_tool(query)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
@tool
|
| 40 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 41 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 73 |
|
| 74 |
agent = CodeAgent(
|
| 75 |
model=model,
|
| 76 |
+
tools=[web_search_tool,get_current_time_in_timezone,final_answer], ## add your tools here (don't remove final answer)
|
| 77 |
max_steps=6,
|
| 78 |
verbosity_level=1,
|
| 79 |
grammar=None,
|