Using LLMs to classify products, search queries, etc is by now boring. Yet it can still be difficult to constrains the LLM’s output to the legal vocabulary of brands, colors, categories, etc your system allows. In the Wayfair WANDS e-commerce dataset, for example, you want to classify a query like “wood coffee table” into its most appropriate category. Of which there are hundreds: Furniture / Office Furniture / Desks Furniture / Living Room Furniture / Coffee Tables & End Tables / Coffee Tables Furniture / Living Room Furniture / Coffee Tables & End Tables / End & Side Tables Décor & Pillows / Decorative Pillows & Blankets / Throw Pillows Furniture / Bedroom Furniture / Dressers & Chests The classic way to implement this would be with structured outputs. You tell your provide it must constrain its outputs to a list of legal values.…