Spaces:
No application file
No application file
Update tools.py
Browse files
tools.py
CHANGED
@@ -1,19 +1,18 @@
|
|
1 |
from smolagents import DuckDuckGoSearchTool
|
2 |
from smolagents import Tool
|
3 |
-
|
4 |
|
5 |
# Initialize the DuckDuckGo search tool
|
6 |
search_tool = DuckDuckGoSearchTool()
|
7 |
|
8 |
|
9 |
-
import random
|
10 |
|
11 |
class CurrencyConverterTool(Tool):
|
12 |
name = "currency_converter"
|
13 |
description = "Converts amounts between different currencies using dummy exchange rates."
|
14 |
inputs = {
|
15 |
"amount": {
|
16 |
-
"type": "float"
|
17 |
"description": "The amount to convert."
|
18 |
},
|
19 |
"from_currency": {
|
@@ -58,5 +57,4 @@ class CurrencyConverterTool(Tool):
|
|
58 |
variation = random.uniform(-0.02, 0.02)
|
59 |
converted_amount *= (1 + variation)
|
60 |
|
61 |
-
return f"{amount:.2f} {from_currency} = {converted_amount:.2f} {to_currency} (tasa simulada)"
|
62 |
-
|
|
|
1 |
from smolagents import DuckDuckGoSearchTool
|
2 |
from smolagents import Tool
|
3 |
+
import random
|
4 |
|
5 |
# Initialize the DuckDuckGo search tool
|
6 |
search_tool = DuckDuckGoSearchTool()
|
7 |
|
8 |
|
|
|
9 |
|
10 |
class CurrencyConverterTool(Tool):
|
11 |
name = "currency_converter"
|
12 |
description = "Converts amounts between different currencies using dummy exchange rates."
|
13 |
inputs = {
|
14 |
"amount": {
|
15 |
+
"type": "number", # Cambiado de "float" a "number"
|
16 |
"description": "The amount to convert."
|
17 |
},
|
18 |
"from_currency": {
|
|
|
57 |
variation = random.uniform(-0.02, 0.02)
|
58 |
converted_amount *= (1 + variation)
|
59 |
|
60 |
+
return f"{amount:.2f} {from_currency} = {converted_amount:.2f} {to_currency} (tasa simulada)"
|
|