Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,21 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
36 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
37 |
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
final_answer = FinalAnswerTool()
|
40 |
visit_webpage = VisitWebpageTool()
|
41 |
duckDuckGo_search = DuckDuckGoSearchTool()
|
@@ -59,7 +74,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
59 |
|
60 |
agent = CodeAgent(
|
61 |
model=model,
|
62 |
-
tools=[final_answer, get_current_time_in_timezone, visit_webpage, duckDuckGo_search], ## add your tools here (don't remove final answer)
|
63 |
max_steps=6,
|
64 |
verbosity_level=1,
|
65 |
grammar=None,
|
|
|
36 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
37 |
|
38 |
|
39 |
+
@tool
|
40 |
+
def fetch_zen_quote() -> str:
|
41 |
+
"""Fetches a random zen quote and returns the 'h' field from the JSON response.
|
42 |
+
|
43 |
+
Returns:
|
44 |
+
A string containing the formatted quote with the author.
|
45 |
+
"""
|
46 |
+
response = requests.get("https://zenquotes.io/api/random")
|
47 |
+
json_data = response.json()
|
48 |
+
|
49 |
+
# Extract the 'h' field from the JSON response
|
50 |
+
quote_html = json_data[0]["h"]
|
51 |
+
|
52 |
+
return quote_html
|
53 |
+
|
54 |
final_answer = FinalAnswerTool()
|
55 |
visit_webpage = VisitWebpageTool()
|
56 |
duckDuckGo_search = DuckDuckGoSearchTool()
|
|
|
74 |
|
75 |
agent = CodeAgent(
|
76 |
model=model,
|
77 |
+
tools=[final_answer, get_current_time_in_timezone, visit_webpage, duckDuckGo_search, fetch_zen_quote], ## add your tools here (don't remove final answer)
|
78 |
max_steps=6,
|
79 |
verbosity_level=1,
|
80 |
grammar=None,
|