Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,15 +21,10 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 21 |
return "What magic will you build ?"
|
| 22 |
|
| 23 |
@tool
|
| 24 |
-
def get_sp500_price(date_str)-> str:
|
| 25 |
-
"""
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
Parameters:
|
| 29 |
-
date_str (str): The date in 'YYYY-MM-DD' format.
|
| 30 |
-
|
| 31 |
-
Returns:
|
| 32 |
-
float: The closing price of the S&P 500 on the given date.
|
| 33 |
"""
|
| 34 |
try:
|
| 35 |
# Convert the input string to a datetime object
|
|
@@ -44,7 +39,7 @@ def get_sp500_price(date_str)-> str:
|
|
| 44 |
# Check if data is available
|
| 45 |
if not data.empty:
|
| 46 |
# Return the closing price
|
| 47 |
-
return data['Close'].iloc[0]
|
| 48 |
else:
|
| 49 |
return None
|
| 50 |
except Exception as e:
|
|
|
|
| 21 |
return "What magic will you build ?"
|
| 22 |
|
| 23 |
@tool
|
| 24 |
+
def get_sp500_price(date_str: str)-> str:
|
| 25 |
+
"""A tool that fetches the S&P 500 price for a given date and returns it as a float in USD terms
|
| 26 |
+
Args:
|
| 27 |
+
date_str: The date in 'YYYY-MM-DD' format.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
"""
|
| 29 |
try:
|
| 30 |
# Convert the input string to a datetime object
|
|
|
|
| 39 |
# Check if data is available
|
| 40 |
if not data.empty:
|
| 41 |
# Return the closing price
|
| 42 |
+
return str(data['Close'].iloc[0])
|
| 43 |
else:
|
| 44 |
return None
|
| 45 |
except Exception as e:
|