MallikarjunSonna commited on
Commit
3151e4d
·
verified ·
1 Parent(s): 38abccb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -5,19 +5,17 @@ import yaml
5
  from tools.final_answer import FinalAnswerTool
6
  from Gradio_UI import GradioUI
7
 
8
- # Define the tool correctly using @tool decorator
9
  @tool
10
  def get_current_time_in_timezone(timezone: str) -> str:
11
  """
12
  Fetches the current local time in a specified timezone.
13
-
14
- Parameters:
15
- timezone (str): The name of the timezone in "Continent/City" format.
16
- Example: "Asia/Kolkata", "America/New_York".
17
-
18
  Returns:
19
- str: The current time in the given timezone in 'YYYY-MM-DD HH:MM:SS' format,
20
- or an error message if the timezone is invalid.
21
  """
22
  try:
23
  tz = pytz.timezone(timezone)
@@ -47,7 +45,12 @@ with open("prompts.yaml", 'r') as stream:
47
  # Create the Agent with properly defined tools
48
  agent = CodeAgent(
49
  model=model,
50
- tools=[final_answer, DuckDuckGoSearchTool(), get_current_time_in_timezone, image_generation_tool],
 
 
 
 
 
51
  max_steps=6,
52
  verbosity_level=1,
53
  grammar=None,
@@ -58,6 +61,4 @@ agent = CodeAgent(
58
  )
59
 
60
  # Launch UI
61
- GradioUI(agent).launch()
62
-
63
-
 
5
  from tools.final_answer import FinalAnswerTool
6
  from Gradio_UI import GradioUI
7
 
8
+ # Define the tool correctly with a properly formatted docstring
9
  @tool
10
  def get_current_time_in_timezone(timezone: str) -> str:
11
  """
12
  Fetches the current local time in a specified timezone.
13
+
14
+ Args:
15
+ timezone (str): The timezone string (e.g., 'America/New_York', 'Asia/Kolkata').
16
+
 
17
  Returns:
18
+ str: The current local time in the specified timezone.
 
19
  """
20
  try:
21
  tz = pytz.timezone(timezone)
 
45
  # Create the Agent with properly defined tools
46
  agent = CodeAgent(
47
  model=model,
48
+ tools=[
49
+ final_answer,
50
+ DuckDuckGoSearchTool(),
51
+ get_current_time_in_timezone, # Now properly formatted
52
+ image_generation_tool
53
+ ],
54
  max_steps=6,
55
  verbosity_level=1,
56
  grammar=None,
 
61
  )
62
 
63
  # Launch UI
64
+ GradioUI(agent).launch()