Spaces:
Sleeping
Sleeping
Update tool.py
Browse files
tool.py
CHANGED
@@ -24,9 +24,9 @@ class SimpleTool(Tool):
|
|
24 |
"description": "A comma-separated string of available ingredients."
|
25 |
},
|
26 |
"diet": {
|
27 |
-
"type": "
|
28 |
-
"enum": Diet,
|
29 |
-
"default": Diet.NONE,
|
30 |
"nullable": True,
|
31 |
"description": "Select dietary restriction from the available options."
|
32 |
},
|
@@ -38,7 +38,7 @@ class SimpleTool(Tool):
|
|
38 |
}
|
39 |
output_type = "string"
|
40 |
|
41 |
-
def forward(self, ingredients: str, diet: Optional[
|
42 |
"""
|
43 |
Gets a recipe suggestion based on provided ingredients, dietary preference,
|
44 |
and your laziness level (1=active chef, 10=super lazy). After finding a recipe, it
|
@@ -71,8 +71,8 @@ class SimpleTool(Tool):
|
|
71 |
}
|
72 |
|
73 |
# Add diet if provided and not "none"
|
74 |
-
if diet and diet != Diet.NONE:
|
75 |
-
params["diet"] = diet
|
76 |
|
77 |
# Incorporate the laziness factor: filter by maxReadyTime if needed.
|
78 |
try:
|
|
|
24 |
"description": "A comma-separated string of available ingredients."
|
25 |
},
|
26 |
"diet": {
|
27 |
+
"type": "string",
|
28 |
+
"enum": [e.value for e in Diet], # Use enum values as string options
|
29 |
+
"default": Diet.NONE.value,
|
30 |
"nullable": True,
|
31 |
"description": "Select dietary restriction from the available options."
|
32 |
},
|
|
|
38 |
}
|
39 |
output_type = "string"
|
40 |
|
41 |
+
def forward(self, ingredients: str, diet: Optional[str] = Diet.NONE.value, laziness: Optional[int] = 5) -> str:
|
42 |
"""
|
43 |
Gets a recipe suggestion based on provided ingredients, dietary preference,
|
44 |
and your laziness level (1=active chef, 10=super lazy). After finding a recipe, it
|
|
|
71 |
}
|
72 |
|
73 |
# Add diet if provided and not "none"
|
74 |
+
if diet and diet != Diet.NONE.value:
|
75 |
+
params["diet"] = diet
|
76 |
|
77 |
# Incorporate the laziness factor: filter by maxReadyTime if needed.
|
78 |
try:
|