akiollenberg commited on
Commit
5c423e8
·
1 Parent(s): 1fb9822

coin flip function

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
 
8
  from Gradio_UI import GradioUI
9
 
@@ -18,6 +19,12 @@ def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
20
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
@@ -54,7 +61,7 @@ with open("prompts.yaml", 'r') as stream:
54
 
55
  agent = CodeAgent(
56
  model=model,
57
- tools=[image_generation_tool,get_current_time_in_timezone,final_answer,DuckDuckGoSearchTool()], ## add your tools here (don't remove final answer)
58
  max_steps=6,
59
  verbosity_level=1,
60
  grammar=None,
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ import random
8
 
9
  from Gradio_UI import GradioUI
10
 
 
19
  """
20
  return "What magic will you build ?"
21
 
22
+ @tool
23
+ def flip_coin()-> str:
24
+ """ A tool that simulate flipping a fair coin once.
25
+ """
26
+ return "Heads" if random.random() < 0.5 else "Tails"
27
+
28
  @tool
29
  def get_current_time_in_timezone(timezone: str) -> str:
30
  """A tool that fetches the current local time in a specified timezone.
 
61
 
62
  agent = CodeAgent(
63
  model=model,
64
+ tools=[image_generation_tool,get_current_time_in_timezone,final_answer,DuckDuckGoSearchTool(),flip_coin], ## add your tools here (don't remove final answer)
65
  max_steps=6,
66
  verbosity_level=1,
67
  grammar=None,