Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,25 @@ 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.
|
|
@@ -56,7 +75,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 56 |
|
| 57 |
agent = CodeAgent(
|
| 58 |
model=model,
|
| 59 |
-
tools=[final_answer,
|
| 60 |
max_steps=6,
|
| 61 |
verbosity_level=1,
|
| 62 |
grammar=None,
|
|
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
+
@tool
|
| 22 |
+
def my_wiki_tool(arg1:str)-> str: #it's import to specify the return type
|
| 23 |
+
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 24 |
+
"""A tool that fetches the relevent information for wikipedia only
|
| 25 |
+
Args:
|
| 26 |
+
arg1: A string provides the details what needs to be searched in wikipedia
|
| 27 |
+
"""
|
| 28 |
+
duckduckgo_tool = DuckDuckGoSearchTool()
|
| 29 |
+
|
| 30 |
+
# You can now use it to search for any of the topics above
|
| 31 |
+
search_results = duckduckgo_tool.search(arg1)
|
| 32 |
+
result_str = "" # Initialize an empty string to accumulate the results
|
| 33 |
+
|
| 34 |
+
for result in search_results:
|
| 35 |
+
# Add each 'Text' value from the result to the result_str
|
| 36 |
+
result_str += result.get('Text', '') + '\n' # Adding a newline for each result
|
| 37 |
+
|
| 38 |
+
return result_str
|
| 39 |
+
|
| 40 |
@tool
|
| 41 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 42 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 75 |
|
| 76 |
agent = CodeAgent(
|
| 77 |
model=model,
|
| 78 |
+
tools=[final_answer,my_wiki_tool], ## add your tools here (don't remove final answer)
|
| 79 |
max_steps=6,
|
| 80 |
verbosity_level=1,
|
| 81 |
grammar=None,
|