Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,6 +62,28 @@ def internet_search(query: str) -> str:
|
|
| 62 |
results = seach.forward(query)
|
| 63 |
return results if results else "No results found."
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
final_answer = FinalAnswerTool()
|
| 66 |
|
| 67 |
# 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:
|
|
|
|
| 62 |
results = seach.forward(query)
|
| 63 |
return results if results else "No results found."
|
| 64 |
|
| 65 |
+
@tool
|
| 66 |
+
def get_dollar_quote() -> str:
|
| 67 |
+
"""
|
| 68 |
+
A tool that fetches the current USD/BRL exchange rate using yfinance.
|
| 69 |
+
|
| 70 |
+
Returns:
|
| 71 |
+
A message with the current USD/BRL exchange rate.
|
| 72 |
+
"""
|
| 73 |
+
import yfinance as yf
|
| 74 |
+
try:
|
| 75 |
+
ticker = yf.Ticker("USDBRL=X")
|
| 76 |
+
data = ticker.history(period="1d")
|
| 77 |
+
if not data.empty:
|
| 78 |
+
# Obtém o último valor de fechamento
|
| 79 |
+
quote = data["Close"].iloc[-1]
|
| 80 |
+
return f"The current USD/BRL exchange rate is {quote:.2f} BRL."
|
| 81 |
+
else:
|
| 82 |
+
return "No data found for USD/BRL exchange rate."
|
| 83 |
+
except Exception as e:
|
| 84 |
+
return f"Error fetching USD/BRL quote: {str(e)}"
|
| 85 |
+
|
| 86 |
+
|
| 87 |
final_answer = FinalAnswerTool()
|
| 88 |
|
| 89 |
# 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:
|