Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,9 +32,18 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 32 |
except Exception as e:
|
| 33 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
# Import tool from Hub
|
| 37 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 38 |
|
| 39 |
|
| 40 |
final_answer = FinalAnswerTool()
|
|
@@ -57,7 +66,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 57 |
|
| 58 |
agent = CodeAgent(
|
| 59 |
model=model,
|
| 60 |
-
tools=[final_answer,get_current_time_in_timezone,string_reverse_tool,
|
| 61 |
max_steps=6,
|
| 62 |
verbosity_level=1,
|
| 63 |
grammar=None,
|
|
|
|
| 32 |
except Exception as e:
|
| 33 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 34 |
|
| 35 |
+
|
| 36 |
+
web_search_tool =DuckDuckGoSearchTool()
|
| 37 |
+
|
| 38 |
+
@tool
|
| 39 |
+
def search_web(question: str) ->str:
|
| 40 |
+
"""A tool that can go to web and search the entire web to find the answer.
|
| 41 |
+
Args: question: actual question that needed to be searched."""
|
| 42 |
+
result = web_search_tool(question)
|
| 43 |
+
return result
|
| 44 |
+
|
| 45 |
# Import tool from Hub
|
| 46 |
+
# image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 47 |
|
| 48 |
|
| 49 |
final_answer = FinalAnswerTool()
|
|
|
|
| 66 |
|
| 67 |
agent = CodeAgent(
|
| 68 |
model=model,
|
| 69 |
+
tools=[final_answer,get_current_time_in_timezone,string_reverse_tool,web_search_tool], ## add your tools here (don't remove final answer)
|
| 70 |
max_steps=6,
|
| 71 |
verbosity_level=1,
|
| 72 |
grammar=None,
|