Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -16,7 +16,8 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
16
  arg1: the first argument
17
  arg2: the second argument
18
  """
19
- return "What magic will you build ?"
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -25,9 +26,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
25
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
26
  """
27
  try:
28
- # Create timezone object
29
  tz = pytz.timezone(timezone)
30
- # Get current time in that timezone
31
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
32
  return f"The current local time in {timezone} is: {local_time}"
33
  except Exception as e:
@@ -55,15 +54,22 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer], ## add your tools here (don't remove final answer)
 
 
 
 
 
 
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
62
  planning_interval=None,
63
- name=None,
64
- description=None,
65
  prompt_templates=prompt_templates
66
  )
67
 
68
 
 
69
  GradioUI(agent).launch()
 
16
  arg1: the first argument
17
  arg2: the second argument
18
  """
19
+ return f"Custom tool received arg1='{arg1}' and arg2={arg2}. What magic will you build?"
20
+
21
 
22
  @tool
23
  def get_current_time_in_timezone(timezone: str) -> str:
 
26
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
27
  """
28
  try:
 
29
  tz = pytz.timezone(timezone)
 
30
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
31
  return f"The current local time in {timezone} is: {local_time}"
32
  except Exception as e:
 
54
 
55
  agent = CodeAgent(
56
  model=model,
57
+ tools=[
58
+ final_answer,
59
+ my_custom_tool,
60
+ get_current_time_in_timezone,
61
+ image_generation_tool,
62
+ DuckDuckGoSearchTool() # added useful web search tool
63
+ ],
64
  max_steps=6,
65
  verbosity_level=1,
66
  grammar=None,
67
  planning_interval=None,
68
+ name="EnhancedCodeAgent",
69
+ description="An agent capable of answering, searching, generating images, and fetching time info.",
70
  prompt_templates=prompt_templates
71
  )
72
 
73
 
74
+
75
  GradioUI(agent).launch()