Microsoft Azure AI Engineer Associate AI-102 Practice Question
You deploy an Azure OpenAI GPT-4 model inside an Azure AI Foundry project to extract information from customer comments. The model must return only valid JSON containing the keys "sentiment" and "keyPhrases", yet it occasionally adds a prose explanation before the JSON. Without adding any client-side post-processing, which prompt engineering change should you try first to make the output consistently valid?
Set the temperature parameter to 0 to make the model deterministic.
Increase the max_tokens value so the response never gets truncated.
Add a system message that declares the assistant is a JSON-only API and must output exactly the required object without extra text.
Provide additional few-shot examples that contrast correct and incorrect outputs.
Placing an explicit system message at the start of a chat prompt is the most reliable prompt-engineering technique for enforcing response format. The system message sets the model's role and constraints (for example, "You are a JSON-only API. Respond with an object that contains sentiment and keyPhrases and nothing else"). Because the system message is given highest priority in the chat hierarchy, the instruction is far more effective than lowering temperature, adding few-shot examples, or increasing the token limit. Temperature and max_tokens are generation parameters, not prompt techniques, and additional examples may still be ignored unless the overarching rule is clear and authoritative.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a system message in Azure OpenAI?
Open an interactive chat with Bash
Why does setting the temperature to 0 not ensure valid JSON-only responses?
Open an interactive chat with Bash
How do system messages differ from few-shot examples in prompting?
Open an interactive chat with Bash
Microsoft Azure AI Engineer Associate AI-102
Implement generative AI solutions
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .