maxcine11 commited on
Commit
8a1eef1
·
verified ·
1 Parent(s): 06dca8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -7,18 +7,22 @@ from tools.final_answer import FinalAnswerTool
7
 
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 research_topic(topic: str, max_results: int = 5) -> str:
14
- """Researches a topic on the web and returns a compact briefing of the top findings.
15
  Args:
16
- topic: The subject to research, e.g. "fusion energy breakthroughs 2026".
17
  max_results: How many search results to include in the briefing (e.g. 3-10).
18
  """
19
  search = DuckDuckGoSearchTool(max_results=max_results)
20
  raw_results = search(topic)
21
- return f"Research briefing for '{topic}':\n\n{raw_results}"
22
 
23
  @tool
24
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -49,15 +53,14 @@ custom_role_conversions=None,
49
  )
50
 
51
 
52
- # Import tool from Hub
53
- image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
54
 
55
  with open("prompts.yaml", 'r') as stream:
56
  prompt_templates = yaml.safe_load(stream)
57
 
58
  agent = CodeAgent(
59
  model=model,
60
- tools=[final_answer,research_topic,get_current_time_in_timezone], ## add your tools here (don't remove final answer)
61
  max_steps=6,
62
  verbosity_level=1,
63
  grammar=None,
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
+
11
+ # Import tool from Hub
12
+ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
13
+
14
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
15
 
16
  @tool
17
+ def search_web(topic: str, max_results: int = 5) -> str:
18
+ """Search the web for pages that are related to the given topic.
19
  Args:
20
+ topic: The subject to search, e.g. "fusion energy breakthroughs 2026".
21
  max_results: How many search results to include in the briefing (e.g. 3-10).
22
  """
23
  search = DuckDuckGoSearchTool(max_results=max_results)
24
  raw_results = search(topic)
25
+ return f"Web searches for '{topic}':\n\n{raw_results}"
26
 
27
  @tool
28
  def get_current_time_in_timezone(timezone: str) -> str:
 
53
  )
54
 
55
 
56
+
 
57
 
58
  with open("prompts.yaml", 'r') as stream:
59
  prompt_templates = yaml.safe_load(stream)
60
 
61
  agent = CodeAgent(
62
  model=model,
63
+ tools=[final_answer,search_web,get_current_time_in_timezone], ## add your tools here (don't remove final answer)
64
  max_steps=6,
65
  verbosity_level=1,
66
  grammar=None,