Spaces:
Running
Running
# vegetable_classifier_tool.py | |
from langchain.tools import tool | |
def vegetable_classifier_2022(question: str) -> str: | |
""" | |
Classifies common grocery items from a 2022 Wikipedia-based classification. | |
Returns a comma-separated list of vegetables excluding all botanical fruits. | |
""" | |
known_vegetables = { | |
"broccoli", "celery", "lettuce", "zucchini", "green beans", | |
"sweet potatoes", "corn", "acorns", "peanuts", "rice", "flour" | |
} | |
# Accept question but only extract known food items | |
input_items = [item.strip().lower() for item in question.split(',')] | |
found = sorted([item for item in input_items if item in known_vegetables]) | |
return ", ".join(found) |