Asking a language model to pick a category usually ends with code that parses its prose, hopes the label is spelled the way you expected and breaks the day the model adds a polite sentence before the answer. When I built Linkmortem , I solved that by asking Gemma 4 for a single JSON object with a fixed list of page kinds and validating it in code. Microsoft Foundry now offers a more direct route for this kind of question, the Azure OpenAI Decisions API, which returns typed answers instead of generated text.
This post is for Python developers who classify, filter or route text on Azure and want to know whether the Decisions API fits their case. You'll need basic Python, an Azure subscription and a Foundry resource where you can deploy a model. I cover what the API is, how its three question types work, what it costs, its limits, the mistakes that are easy to make and a minimal example. I don't cover the JavaScript SDK, image inputs in depth or how to tune thresholds with labeled data.…