Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Build a lightweight application that includes vision capabilities

A worked example

Single answer

You are building a Python app that identifies animals in safari photos. In a Microsoft Foundry resource named contoso-ai, you deployed the gpt-4.1-mini model and gave the deployment the name wildlife-deploy. The app uses the OpenAI Python SDK and the code in the exhibit.

client = OpenAI( api_key=os.getenv("FOUNDRY_KEY"), base_url="https://contoso-ai.openai.azure.com/openai/v1/", )

response = client.responses.create( model="<value>", input=[{"role": "user", "content": [ {"type": "input_text", "text": "Which animal is in this photo?"}, {"type": "input_image", "image_url": image_url}]}], )

Which value should replace <value> in the exhibit?

Choose one answer
Why

When you deploy a model in Foundry, it keeps its base name and also gets the deployment name you choose. The client is created with the key and the endpoint, and each request passes the deployment name as the model. Here the deployment is named wildlife-deploy, so that value goes in the model parameter.

  • Correct: wildlife-deploy. The client is pointed at the endpoint, and the model parameter takes the deployment name that you gave the model when you deployed it.
  • Not correct: https://contoso-ai.openai.azure.com/openai/v1/. The endpoint is already supplied to the client as base_url. The model parameter identifies the deployment, not the endpoint.
  • Not correct: gpt-4.1-mini. gpt-4.1-mini is the base model name. The code must pass the deployment name, which is different here.
  • Not correct: contoso-ai. contoso-ai is the Foundry resource name, which forms part of the endpoint. It does not identify the model deployment.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free