| from langchain.tools import tool |
|
|
| @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" |
| } |
| |
| 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) |