Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,6 @@ import pytz
|
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
from tools.visit_webpage import VisitWebpageTool
|
| 8 |
-
from datetime import datetime
|
| 9 |
|
| 10 |
import os
|
| 11 |
|
|
@@ -24,7 +23,7 @@ def my_custom_tool(arg1:int, arg2:int)-> str: #it's import to specify the return
|
|
| 24 |
return f"the result is {a}"
|
| 25 |
|
| 26 |
@tool
|
| 27 |
-
def todays_useless_fact(date: datetime) -> str:
|
| 28 |
"""Fetches today's useless fact from an external public API.
|
| 29 |
Args:
|
| 30 |
date: the datetime value for the specified time zone retrieved from get_current_time_in_timezone.
|
|
@@ -53,7 +52,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 53 |
# Create timezone object
|
| 54 |
tz = pytz.timezone(timezone)
|
| 55 |
# Get current time in that timezone
|
| 56 |
-
local_time = datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 57 |
return f"The current local time in {timezone} is: {local_time}"
|
| 58 |
except Exception as e:
|
| 59 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
|
@@ -98,7 +97,7 @@ agent = CodeAgent(
|
|
| 98 |
final_answer,
|
| 99 |
get_current_time_in_timezone,
|
| 100 |
image_generation_tool,
|
| 101 |
-
|
| 102 |
], ## add your tools here (don't remove final answer)
|
| 103 |
max_steps=6,
|
| 104 |
verbosity_level=1,
|
|
|
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
from tools.visit_webpage import VisitWebpageTool
|
|
|
|
| 8 |
|
| 9 |
import os
|
| 10 |
|
|
|
|
| 23 |
return f"the result is {a}"
|
| 24 |
|
| 25 |
@tool
|
| 26 |
+
def todays_useless_fact(date: datetime.datetime) -> str:
|
| 27 |
"""Fetches today's useless fact from an external public API.
|
| 28 |
Args:
|
| 29 |
date: the datetime value for the specified time zone retrieved from get_current_time_in_timezone.
|
|
|
|
| 52 |
# Create timezone object
|
| 53 |
tz = pytz.timezone(timezone)
|
| 54 |
# Get current time in that timezone
|
| 55 |
+
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 56 |
return f"The current local time in {timezone} is: {local_time}"
|
| 57 |
except Exception as e:
|
| 58 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
|
|
|
| 97 |
final_answer,
|
| 98 |
get_current_time_in_timezone,
|
| 99 |
image_generation_tool,
|
| 100 |
+
todays_useless_fact # Include this!
|
| 101 |
], ## add your tools here (don't remove final answer)
|
| 102 |
max_steps=6,
|
| 103 |
verbosity_level=1,
|