dhiegorp commited on
Commit
d48e9fa
·
verified ·
1 Parent(s): bf951ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -8,6 +8,16 @@ from tools.final_answer import FinalAnswerTool
8
  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
@@ -50,12 +60,14 @@ custom_role_conversions=None,
50
  # Import tool from Hub
51
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
52
 
 
 
53
  with open("prompts.yaml", 'r') as stream:
54
  prompt_templates = yaml.safe_load(stream)
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
8
  from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
+
12
+ @tool
13
+ def useless_random_facts() -> str :
14
+ """A tool to generate random facts to entertain your users"""
15
+ url = "https://uselessfacts.jsph.pl/api/v2/facts/random"
16
+ try:
17
+ return requests.get(url)
18
+ except Exception e:
19
+ return f"Error fetching random facts: {str(e)}"
20
+
21
  @tool
22
  def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
23
  #Keep this format for the description / args / args description but feel free to modify the tool
 
60
  # Import tool from Hub
61
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
62
 
63
+ quacquackgo = DuckDuckGoSearchTool()
64
+
65
  with open("prompts.yaml", 'r') as stream:
66
  prompt_templates = yaml.safe_load(stream)
67
 
68
  agent = CodeAgent(
69
  model=model,
70
+ tools=[quacquackgo, useless_random_facts, image_generation_tool, get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
71
  max_steps=6,
72
  verbosity_level=1,
73
  grammar=None,