MainStreet123 commited on
Commit
77a5f44
·
verified ·
1 Parent(s): 0fcb9ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -28
app.py CHANGED
@@ -12,39 +12,17 @@ from Gradio_UI import GradioUI
12
  from smolagents import tool
13
  from duckduckgo_search import DDGS
14
 
15
- @tool
16
- def my_custom_tool(location: str) -> str:
17
- """Searches the web for 5 local gift shops in a given area and returns a table
18
- with store names, addresses, and contact information.
19
 
 
 
 
20
  Args:
21
- location: The location where the shops should be searched.
 
22
  """
23
- query = f"gift shops in {location} address phone"
24
-
25
- rows = []
26
- with DDGS() as ddgs:
27
- results = ddgs.text(query, max_results=10)
28
- for r in results:
29
- title = r.get("title", "Unknown")
30
- snippet = r.get("body", "No details found")
31
- link = r.get("href", "")
32
-
33
- rows.append((title, snippet, link))
34
- if len(rows) == 5:
35
- break
36
-
37
- if not rows:
38
- return f"No gift shops found for {location}."
39
 
40
- table = "| Store | Details | Source |\n"
41
- table += "|---|---|---|\n"
42
- for name, details, source in rows:
43
- table += f"| {name} | {details} | {source} |\n"
44
 
45
- return table
46
-
47
- @tool
48
  def get_current_time_in_timezone(timezone: str) -> str:
49
  """A tool that fetches the current local time in a specified timezone.
50
  Args:
@@ -60,6 +38,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
60
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
61
 
62
 
 
63
  final_answer = FinalAnswerTool()
64
 
65
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
 
12
  from smolagents import tool
13
  from duckduckgo_search import DDGS
14
 
 
 
 
 
15
 
16
+ def my_custom_tool(arg1:str, arg2:int)-> str: # it's important to specify the return type
17
+ # Keep this format for the tool description / args description but feel free to modify the tool
18
+ """A tool that does nothing yet
19
  Args:
20
+ arg1: the first argument
21
+ arg2: the second argument
22
  """
23
+ return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
 
 
 
 
25
 
 
 
 
26
  def get_current_time_in_timezone(timezone: str) -> str:
27
  """A tool that fetches the current local time in a specified timezone.
28
  Args:
 
38
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
39
 
40
 
41
+
42
  final_answer = FinalAnswerTool()
43
 
44
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder: