Forcing Foundry model output to match a JSON Schema

AI-901 Implement AI solutions by using Microsoft Foundry Medium Question 23 of 50

You are developing an information extraction application in Microsoft Foundry. The application must guarantee that model completions strictly adhere to a predefined JSON Schema containing specific required keys such as name, date, and guests, without omitting fields or altering property names.

Which configuration should you use to enforce the required response schema?

Show answer and explanation

AStructured outputs with a strict JSON Schema format

Structured outputs make a model follow a JSON Schema definition provided directly in the inference request, guaranteeing that the model adheres strictly to the required keys and types without drifting or omitting properties. Standard JSON object mode guarantees that the model outputs syntactically valid JSON, but it cannot enforce specific required keys or prevent property drift even when instructions are provided in the system message. Client-side schema validation detects malformed responses only after generation occurs rather than constraining model output generation. Function tool calling with strict parameters constrains the arguments passed to external tools rather than enforcing the schema of the assistant conversational response.

Source: learn.microsoft.com/en-us/azure/foundry/openai/how-to/struc…

Anonymous, no account needed. Your tally stays in this browser.

Next question Start 5 timed questions Browse all 50 original AI-901 practice questions