Spaces:
Sleeping
Sleeping
Update app.py
Browse filesUpdated dummy tool to a stock ticker search
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(
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
-
"""A tool that
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
| 18 |
"""
|
| 19 |
-
|
| 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.
|