Spaces:
Runtime error
Runtime error
Update app.py
Browse filesadd a tool for hawaii
app.py
CHANGED
@@ -33,6 +33,15 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
final_answer = FinalAnswerTool()
|
38 |
model = HfApiModel(
|
@@ -51,7 +60,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
51 |
|
52 |
agent = CodeAgent(
|
53 |
model=model,
|
54 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
55 |
max_steps=6,
|
56 |
verbosity_level=1,
|
57 |
grammar=None,
|
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
+
@tool
|
37 |
+
def get_time_hawaii() -> str
|
38 |
+
"A tool that fetches the current time in hawaii"
|
39 |
+
try:
|
40 |
+
results = DuckDuckGoSearchTool("what is the current time in hawaii")
|
41 |
+
return results
|
42 |
+
except Exception as e:
|
43 |
+
return f"i failed"
|
44 |
+
|
45 |
|
46 |
final_answer = FinalAnswerTool()
|
47 |
model = HfApiModel(
|
|
|
60 |
|
61 |
agent = CodeAgent(
|
62 |
model=model,
|
63 |
+
tools=[final_answer, get_time_hawaii], ## add your tools here (don't remove final answer)
|
64 |
max_steps=6,
|
65 |
verbosity_level=1,
|
66 |
grammar=None,
|