Danwei commited on
Commit
a54e556
·
verified ·
1 Parent(s): 2fcbffd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -9,14 +9,17 @@ from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
- #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that does nothing yet
 
15
  Args:
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:
@@ -57,7 +60,7 @@ with open("prompts.yaml", 'r') as stream:
57
 
58
  agent = CodeAgent(
59
  model=model,
60
- tools=[duckduckgo_search, get_current_time_in_timezone,final_answer], ## add your tools here (don't remove final answer)
61
  max_steps=6,
62
  verbosity_level=1,
63
  grammar=None,
@@ -66,7 +69,7 @@ agent = CodeAgent(
66
  description=None,
67
  prompt_templates=prompt_templates
68
  )
69
- result = agent.run("Generate an image of a sunrise over mountains, then tell me the current time in Tokyo.")
70
  print(result)
71
 
72
  GradioUI(agent).launch()
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def temperature_covert(celsius: float) -> float: #it's import to specify the return type
13
+ """
14
+ Convert Celsius temperature to Fahrenheit.
15
+
16
  Args:
17
+ celsius: Temperature in degrees Celsius.
18
+
19
+ Returns:
20
+ float: Temperature converted to Fahrenheit.
21
  """
22
+ return (celsius * 9/5) + 32
23
 
24
  @tool
25
  def get_current_time_in_timezone(timezone: str) -> str:
 
60
 
61
  agent = CodeAgent(
62
  model=model,
63
+ tools=[duckduckgo_search, get_current_time_in_timezone,temperature_covert,image_generation_tool,final_answer], ## add your tools here (don't remove final answer)
64
  max_steps=6,
65
  verbosity_level=1,
66
  grammar=None,
 
69
  description=None,
70
  prompt_templates=prompt_templates
71
  )
72
+ result = agent.run("Generate an image of a sunrise over mountains, then tell me the current time, and weather in Fahrenheit in Tokyo.")
73
  print(result)
74
 
75
  GradioUI(agent).launch()