Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,24 +23,6 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 23 |
"""
|
| 24 |
return "What magic will you build ?"
|
| 25 |
|
| 26 |
-
@tool
|
| 27 |
-
def get_stock_price(ticker: str) -> Optional[str]:
|
| 28 |
-
"""
|
| 29 |
-
Fetches the current stock price for the given ticker symbol.
|
| 30 |
-
|
| 31 |
-
Args:
|
| 32 |
-
ticker (str): The stock ticker symbol (e.g., 'AAPL' for Apple Inc.).
|
| 33 |
-
|
| 34 |
-
Returns:
|
| 35 |
-
Optional[str]: A string displaying the current stock price, or an error message if an exception occurs.
|
| 36 |
-
"""
|
| 37 |
-
try:
|
| 38 |
-
stock = yf.Ticker(ticker)
|
| 39 |
-
price = stock.history(period='1d')['Close'].iloc[-1]
|
| 40 |
-
return f"Current stock price of {ticker.upper()}: ${price:.2f}"
|
| 41 |
-
except Exception as e:
|
| 42 |
-
return f"Error fetching stock price: {str(e)}"
|
| 43 |
-
|
| 44 |
@tool
|
| 45 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 46 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 23 |
"""
|
| 24 |
return "What magic will you build ?"
|
| 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.
|