Ajeya95 commited on
Commit
1f71ef8
·
verified ·
1 Parent(s): 728b995

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -10,24 +10,24 @@ from Gradio_UI import GradioUI
10
  duckduckgo_tool=DuckDuckGoSearchTool()
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
- def animewatcher(anime_name:str)-> str: #it's import to specify the return type
14
- #Keep this format for the description / args / args description but feel free to modify the tool
15
- """A tool that does search the details abt a given anime using duckduckgo
16
  Args:
17
  anime_name: The name of the anime to search for.
18
  """
19
- # return "What magic will you build ?"
20
  try:
21
- search_query=f"{anime_name} anime details "
22
- result=duckduckgo_tool(search_query,max_results=3)#get the top 3 search results.
23
  if not results:
24
- return "No results found for the given anime. Maybe! it's underrrated!"
25
- response = f"Here are some info of '{anime_name}':\n"
26
- for i , result in enumerate (results,1):
27
- response+=f"{i} . **{result['title']}**\n{result['href']}\n\n"
 
28
  return response.strip()
 
29
  except Exception as e:
30
- return f"Error searching for '{anime_name}':{str(e)}"
31
 
32
  @tool
33
  def get_current_time_in_timezone(timezone: str) -> str:
 
10
  duckduckgo_tool=DuckDuckGoSearchTool()
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
+ def animewatcher(anime_name: str) -> str:
14
+ """A tool that searches for anime details using DuckDuckGo.
 
15
  Args:
16
  anime_name: The name of the anime to search for.
17
  """
 
18
  try:
19
+ search_query = f"{anime_name} anime details"
20
+ results = duckduckgo_tool(search_query, max_results=3) # Fix: `results` instead of `result`
21
  if not results:
22
+ return "No results found for the given anime. Maybe it's underrated!"
23
+
24
+ response = f"Here are some details about '{anime_name}':\n"
25
+ for i, result in enumerate(results, 1): # Fix: Iterate over `results`
26
+ response += f"{i}. **{result['title']}**\n{result['href']}\n\n"
27
  return response.strip()
28
+
29
  except Exception as e:
30
+ return f"Error searching for '{anime_name}': {str(e)}"
31
 
32
  @tool
33
  def get_current_time_in_timezone(timezone: str) -> str: