Microsoft Azure AI Engineer Associate AI-102 Practice Question
You are integrating an Azure OpenAI GPT-4 deployment into an Azure AI Foundry project by using the official OpenAI Python SDK. The following code is executed in a prompt flow but returns HTTP 404 "The deployment was not found":
The Azure OpenAI resource contains a deployment named gpt4-prod, and the key and endpoint values are correct. Which change will allow the call to succeed when the code runs in Foundry?
Set the environment variable OPENAI_API_TYPE to "azure" and replace the model parameter with deployment_id="gpt4-prod" in the ChatCompletion call.
Replace the model parameter with engine="gpt4-prod" and set the environment variable OPENAI_API_VERSION to "latest".
Append "?api-version=2024-02-15-preview" to the endpoint URL while leaving the model parameter unchanged.
Import the azure.ai.generative.openai package instead of openai and keep model="gpt-4" without any other changes.
When you call the OpenAI Python SDK against an Azure OpenAI endpoint you must let the library know that it is talking to Azure and reference the model by its deployment name, not by the base model name. Setting the environment variable OPENAI_API_TYPE=azure switches the SDK into Azure mode, and replacing the model parameter with deployment_id="gpt4-prod" points the request to the existing GPT-4 deployment. The other options either omit the required API type setting, rely on a deprecated parameter, or use a different client library that would still require the same Azure-specific configuration.
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.
Why do you need to set OPENAI_API_TYPE to 'azure'?
Open an interactive chat with Bash
What is the difference between the model parameter and the deployment_id parameter?
Open an interactive chat with Bash
What is the purpose of appending the API version to the endpoint URL?
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 .