testing duckduckgosearchtool

#1
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -14,14 +14,15 @@ def wiki_of_person(name_of_person:str) -> str:
14
  Args:
15
  name_of_person: The name of the person to look up for in wikipedia
16
  """
17
- search_tool = DuckDuckGoSearchTool()
18
  # Use DuckDuckGoSearchTool to search for the wikipedia url of the person and then visit the url
19
  query = f"{name_of_person} wikipedia"
20
- wikipedia_url = search_tool(query)
21
  # Use the wikipedia url to get the person's description, location, and interesting facts
22
- wikipedia_results = visit_url(url=wikipedia_url)
23
- return f"Detailes description: {wikipedia_results['description']}, Location: {wikipedia_results['location']}, Interesting facts: {wikipedia_results['interesting facts']}"
24
-
 
25
  @tool
26
  def get_current_time_in_timezone(timezone: str) -> str:
27
  """A tool that fetches the current local time in a specified timezone.
@@ -96,7 +97,7 @@ with open("prompts.yaml", 'r') as stream:
96
 
97
  agent = CodeAgent(
98
  model=model,
99
- tools=[final_answer, image_generation_tool, get_current_time_in_timezone, wiki_of_person, convert_currency], ## add your tools here (don't remove final answer)
100
  add_base_tools=True,
101
  max_steps=6,
102
  verbosity_level=1,
 
14
  Args:
15
  name_of_person: The name of the person to look up for in wikipedia
16
  """
17
+ #search_tool = DuckDuckGoSearchTool()
18
  # Use DuckDuckGoSearchTool to search for the wikipedia url of the person and then visit the url
19
  query = f"{name_of_person} wikipedia"
20
+ #wikipedia_url = search_tool(query)
21
  # Use the wikipedia url to get the person's description, location, and interesting facts
22
+ wikipedia_results = DuckDuckGoSearchTool(query)
23
+ #return f"Detailes description: {wikipedia_results['description']}, Location: {wikipedia_results['location']}, Interesting facts: {wikipedia_results['interesting facts']}"
24
+ return wikipedia_results
25
+
26
  @tool
27
  def get_current_time_in_timezone(timezone: str) -> str:
28
  """A tool that fetches the current local time in a specified timezone.
 
97
 
98
  agent = CodeAgent(
99
  model=model,
100
+ tools=[final_answer, image_generation_tool, get_current_time_in_timezone, DuckDuckGoSearchTool(), convert_currency], ## add your tools here (don't remove final answer)
101
  add_base_tools=True,
102
  max_steps=6,
103
  verbosity_level=1,