Spaces:
Runtime error
Runtime error
Added Catering Service and SuperheropartyThemeTool
Browse files
app.py
CHANGED
@@ -58,6 +58,52 @@ def suggest_menu(occasion: str) -> str:
|
|
58 |
return "Custom menu for the butler."
|
59 |
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
final_answer = FinalAnswerTool()
|
63 |
|
@@ -80,7 +126,15 @@ with open("prompts.yaml", 'r') as stream:
|
|
80 |
|
81 |
agent = CodeAgent(
|
82 |
model=model,
|
83 |
-
tools=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
max_steps=6,
|
85 |
verbosity_level=1,
|
86 |
grammar=None,
|
|
|
58 |
return "Custom menu for the butler."
|
59 |
|
60 |
|
61 |
+
@tool
|
62 |
+
def catering_service_tool(query: str) -> str:
|
63 |
+
"""
|
64 |
+
This tool returns the highest-rated catering service in Gotham City.
|
65 |
+
|
66 |
+
Args:
|
67 |
+
query: A search term for finding catering services.
|
68 |
+
"""
|
69 |
+
# Example list of catering services and their ratings
|
70 |
+
services = {
|
71 |
+
"Gotham Catering Co.": 4.9,
|
72 |
+
"Wayne Manor Catering": 4.8,
|
73 |
+
"Gotham City Events": 4.7,
|
74 |
+
}
|
75 |
+
|
76 |
+
# Find the highest rated catering service (simulating search query filtering)
|
77 |
+
best_service = max(services, key=services.get)
|
78 |
+
|
79 |
+
return best_service
|
80 |
+
|
81 |
+
class SuperheroPartyThemeTool(Tool):
|
82 |
+
name = "superhero_party_theme_generator"
|
83 |
+
description = """
|
84 |
+
This tool suggests creative superhero-themed party ideas based on a category.
|
85 |
+
It returns a unique party theme idea."""
|
86 |
+
|
87 |
+
inputs = {
|
88 |
+
"category": {
|
89 |
+
"type": "string",
|
90 |
+
"description": "The type of superhero party (e.g., 'classic heroes', 'villain masquerade', 'futuristic Gotham').",
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
output_type = "string"
|
95 |
+
|
96 |
+
def forward(self, category: str):
|
97 |
+
themes = {
|
98 |
+
"classic heroes": "Justice League Gala: Guests come dressed as their favorite DC heroes with themed cocktails like 'The Kryptonite Punch'.",
|
99 |
+
"villain masquerade": "Gotham Rogues' Ball: A mysterious masquerade where guests dress as classic Batman villains.",
|
100 |
+
"futuristic Gotham": "Neo-Gotham Night: A cyberpunk-style party inspired by Batman Beyond, with neon decorations and futuristic gadgets."
|
101 |
+
}
|
102 |
+
|
103 |
+
return themes.get(category.lower(), "Themed party idea not found. Try 'classic heroes', 'villain masquerade', or 'futuristic Gotham'.")
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
|
108 |
final_answer = FinalAnswerTool()
|
109 |
|
|
|
126 |
|
127 |
agent = CodeAgent(
|
128 |
model=model,
|
129 |
+
tools=[
|
130 |
+
final_answer,
|
131 |
+
get_current_time_in_timezone,
|
132 |
+
image_generation_tool,
|
133 |
+
suggest_menu,
|
134 |
+
DuckDuckGoSearchTool(),
|
135 |
+
catering_service_tool,
|
136 |
+
SuperheroPartyThemeTool()
|
137 |
+
], ## add your tools here (don't remove final answer)
|
138 |
max_steps=6,
|
139 |
verbosity_level=1,
|
140 |
grammar=None,
|