Spaces:
Runtime error
Runtime error
Upload 4 files
Browse files- tools/__init__.py +0 -0
- tools/catering_service_tool.py +27 -0
- tools/suggest_menu.py +23 -0
- tools/superhero_party_theme_generator.py +22 -0
tools/__init__.py
ADDED
|
File without changes
|
tools/catering_service_tool.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import Tool
|
| 2 |
+
from typing import Any, Optional
|
| 3 |
+
|
| 4 |
+
class SimpleTool(Tool):
|
| 5 |
+
name = "catering_service_tool"
|
| 6 |
+
description = "This tool returns the highest-rated catering service in Gotham City."
|
| 7 |
+
inputs = {"query":{"type":"string","description":"A search term for finding catering services."}}
|
| 8 |
+
output_type = "string"
|
| 9 |
+
|
| 10 |
+
def forward(self, query: str) -> str:
|
| 11 |
+
"""
|
| 12 |
+
This tool returns the highest-rated catering service in Gotham City.
|
| 13 |
+
|
| 14 |
+
Args:
|
| 15 |
+
query: A search term for finding catering services.
|
| 16 |
+
"""
|
| 17 |
+
# Example list of catering services and their ratings
|
| 18 |
+
services = {
|
| 19 |
+
"Gotham Catering Co.": 4.9,
|
| 20 |
+
"Wayne Manor Catering": 4.8,
|
| 21 |
+
"Gotham City Events": 4.7,
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
# Find the highest rated catering service (simulating search query filtering)
|
| 25 |
+
best_service = max(services, key=services.get)
|
| 26 |
+
|
| 27 |
+
return best_service
|
tools/suggest_menu.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import Tool
|
| 2 |
+
from typing import Any, Optional
|
| 3 |
+
|
| 4 |
+
class SimpleTool(Tool):
|
| 5 |
+
name = "suggest_menu"
|
| 6 |
+
description = "Suggests a menu based on the occasion."
|
| 7 |
+
inputs = {"occasion":{"type":"string","description":"The type of occasion for the party."}}
|
| 8 |
+
output_type = "string"
|
| 9 |
+
|
| 10 |
+
def forward(self, occasion: str) -> str:
|
| 11 |
+
"""
|
| 12 |
+
Suggests a menu based on the occasion.
|
| 13 |
+
Args:
|
| 14 |
+
occasion: The type of occasion for the party.
|
| 15 |
+
"""
|
| 16 |
+
if occasion == "casual":
|
| 17 |
+
return "Pizza, snacks, and drinks."
|
| 18 |
+
elif occasion == "formal":
|
| 19 |
+
return "3-course dinner with wine and dessert."
|
| 20 |
+
elif occasion == "superhero":
|
| 21 |
+
return "Buffet with high-energy and healthy food."
|
| 22 |
+
else:
|
| 23 |
+
return "Custom menu for the butler."
|
tools/superhero_party_theme_generator.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Optional
|
| 2 |
+
from smolagents.tools import Tool
|
| 3 |
+
|
| 4 |
+
class SuperheroPartyThemeTool(Tool):
|
| 5 |
+
name = "superhero_party_theme_generator"
|
| 6 |
+
description = """
|
| 7 |
+
This tool suggests creative superhero-themed party ideas based on a category.
|
| 8 |
+
It returns a unique party theme idea."""
|
| 9 |
+
inputs = {'category': {'type': 'string', 'description': "The type of superhero party (e.g., 'classic heroes', 'villain masquerade', 'futuristic Gotham')."}}
|
| 10 |
+
output_type = "string"
|
| 11 |
+
|
| 12 |
+
def forward(self, category: str):
|
| 13 |
+
themes = {
|
| 14 |
+
"classic heroes": "Justice League Gala: Guests come dressed as their favorite DC heroes with themed cocktails like 'The Kryptonite Punch'.",
|
| 15 |
+
"villain masquerade": "Gotham Rogues' Ball: A mysterious masquerade where guests dress as classic Batman villains.",
|
| 16 |
+
"futuristic Gotham": "Neo-Gotham Night: A cyberpunk-style party inspired by Batman Beyond, with neon decorations and futuristic gadgets."
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
return themes.get(category.lower(), "Themed party idea not found. Try 'classic heroes', 'villain masquerade', or 'futuristic Gotham'.")
|
| 20 |
+
|
| 21 |
+
def __init__(self, *args, **kwargs):
|
| 22 |
+
self.is_initialized = False
|