An extraction prompt returns JSON that sometimes misses fields or varies in wording between runs. Which two changes make the output reliably consistent? (Select TWO.)
- Exam domain
- Implement generative AI and agentic solutions30–35% of the exam
- Difficulty
- Medium
- In this mock
- 20 questions on this domainPractise this domain
Why the exam asks this
Implement generative AI and agentic solutions: Optimize and operationalize generative AI systems.
Objective in the exam guide: Tune generation behavior, such as prompt engineering and adjusting model parameters.
Downstream code breaks when output shape changes. The exam checks both the parameter and the API feature that fix it.
Why A and B are the answers
A multiple-response question. Choose two. There is no credit for picking only some of them.
Use structured outputs with a strict JSON Schema
Lower the temperature
Structured outputs make the reply follow your schema, and a lower temperature reduces run-to-run variation.
Remember: Format: structured outputs. Consistency: lower temperature.
How it works
Structured outputs make the model follow a JSON Schema you send with the request, unlike older JSON mode, which only promised valid JSON.
Temperature controls randomness; lower values make repeated runs more alike.
Together they fix both shape and wording drift.
Clues in the question
The words that point to the answer, and what each one tells you.
- Misses fields
- Shape problem: schema.
- Varies between runs
- Randomness: temperature.
- Select TWO
- One fix for each problem.
In detail
- Structured outputs need every field marked required and additionalProperties set to false.
- JSON mode only guarantees valid JSON, not your schema.
Side by side with look-alikes
| Change | Effect |
|---|---|
| Strict JSON Schema | Every field present, right types |
| Lower temperature | Less variation between runs |
| Higher temperature | More variation |
| JSON mode | Valid JSON, schema not enforced |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Use structured outputs with a strict JSON SchemaRight
Structured outputs make the reply follow your schema, and a lower temperature reduces run-to-run variation.
B. Lower the temperatureRight
Structured outputs make the reply follow your schema, and a lower temperature reduces run-to-run variation.
C. Raise the temperatureWrongMost tempting
Higher temperature increases variation.
Why it tempts: It is a familiar parameter, so it is easy to pick the wrong direction. Higher temperature makes runs differ more.
D. Remove the system messageWrong
Removing instructions makes output less predictable.
E. Ask the model to "try harder" in the promptWrong
Vague encouragement does not change the format.
In practice
- Keep the schema small: up to five levels of nesting and 100 properties are supported.
Use case
An illustrative scenario, not a real incident.
An invoice extractor moves from JSON mode to a strict schema and temperature 0.2; missing-field errors stop.
See how it works
flowchart LR P["Inconsistent JSON"] --> S["Missing fields"] P --> V["Wording varies"] S --> F1["Strict JSON Schema"] V --> F2["Lower temperature"]
How to read this chart
- "Inconsistent JSON" leads to "Missing fields" and "Wording varies".
- "Missing fields" leads to "Strict JSON Schema".
- "Wording varies" leads to "Lower temperature".