Spaces:
No application file
No application file
Upload 5 files
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ from smolagents import GradioUI, CodeAgent, HfApiModel
|
|
| 4 |
|
| 5 |
# Import our custom tools from their modules
|
| 6 |
from tools import DuckDuckGoSearchTool, CurrencyConverterTool
|
|
|
|
| 7 |
|
| 8 |
# Initialize the Hugging Face model
|
| 9 |
model = HfApiModel()
|
|
@@ -15,6 +16,9 @@ search_tool = DuckDuckGoSearchTool()
|
|
| 15 |
currency_converter_tool = CurrencyConverterTool()
|
| 16 |
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
# Create Alfred with all the tools
|
| 19 |
alfred = CodeAgent(
|
| 20 |
tools=[currency_converter_tool, search_tool],
|
|
|
|
| 4 |
|
| 5 |
# Import our custom tools from their modules
|
| 6 |
from tools import DuckDuckGoSearchTool, CurrencyConverterTool
|
| 7 |
+
from retriever import load_guest_dataset
|
| 8 |
|
| 9 |
# Initialize the Hugging Face model
|
| 10 |
model = HfApiModel()
|
|
|
|
| 16 |
currency_converter_tool = CurrencyConverterTool()
|
| 17 |
|
| 18 |
|
| 19 |
+
# Load the guest dataset and initialize the guest info tool
|
| 20 |
+
guest_info_tool = load_guest_dataset()
|
| 21 |
+
|
| 22 |
# Create Alfred with all the tools
|
| 23 |
alfred = CodeAgent(
|
| 24 |
tools=[currency_converter_tool, search_tool],
|
tools.py
CHANGED
|
@@ -1,17 +1,19 @@
|
|
| 1 |
from smolagents import DuckDuckGoSearchTool
|
| 2 |
from smolagents import Tool
|
| 3 |
-
import random
|
| 4 |
|
| 5 |
|
| 6 |
# Initialize the DuckDuckGo search tool
|
| 7 |
search_tool = DuckDuckGoSearchTool()
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
class CurrencyConverterTool(Tool):
|
| 10 |
name = "currency_converter"
|
| 11 |
description = "Converts amounts between different currencies using dummy exchange rates."
|
| 12 |
inputs = {
|
| 13 |
"amount": {
|
| 14 |
-
"type": "
|
| 15 |
"description": "The amount to convert."
|
| 16 |
},
|
| 17 |
"from_currency": {
|
|
@@ -57,3 +59,4 @@ class CurrencyConverterTool(Tool):
|
|
| 57 |
converted_amount *= (1 + variation)
|
| 58 |
|
| 59 |
return f"{amount:.2f} {from_currency} = {converted_amount:.2f} {to_currency} (tasa simulada)"
|
|
|
|
|
|
| 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": {
|
|
|
|
| 59 |
converted_amount *= (1 + variation)
|
| 60 |
|
| 61 |
return f"{amount:.2f} {from_currency} = {converted_amount:.2f} {to_currency} (tasa simulada)"
|
| 62 |
+
|