Seewhatson commited on
Commit
548b3d7
·
verified ·
1 Parent(s): ae7a494

Update app.py

Browse files

Updated dummy tool to a stock ticker search

Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -9,15 +9,18 @@ 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
14
- """A tool that does nothing yet
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
18
  """
19
- return "What magic will you build ?"
20
-
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def my_custom_tool(stock_symbol:str, current_time: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
14
+ """A tool that searches for the latest price of a stock symbol given the symbol ticker name.
15
  Args:
16
+ stock_symbol: A string representing a stock symbol (e.g., 'AAPL')
17
+ current_time: A strin representing the time at the current timezone
18
  """
19
+ try:
20
+ stock_price = DuckDuckGoSearchTool(f"Whats the current price for {stock_symbol} as of {current_time}")
21
+ return f"The current price for {stock_symbol} is {stock_price}"
22
+ except error:
23
+ return f"Error getting the price for {stock_symbol}"
24
  @tool
25
  def get_current_time_in_timezone(timezone: str) -> str:
26
  """A tool that fetches the current local time in a specified timezone.