Course menuAI-901

Exams / AI-901 / Chat client apps with the Foundry SDK / Question 2

AI-901 practice question: Chat client apps with the Foundry SDK (2 of 4)

Implement AI solutions by using Microsoft Foundry A free question from our original AI-901 practice exam. Try it, then open the answer to see why each option is right or wrong.

Last verified against current Microsoft Learn ·How we write our questions

A retail analytics team has started a Python chat app that signs in to its Foundry project with Microsoft Entra ID. The next line should create an OpenAI-style client for sending prompts to a model deployment.

from azure.identity import DefaultAzureCredential from azure.ai.projects import AIProjectClient project = AIProjectClient(endpoint=ENDPOINT, credential=DefaultAzureCredential()) openai_client = project.________()

Which method name fills the blank?

Choose one answer.

  1. A. the agents.create_version method
  2. B. the responses.create method
  3. C. the get_openai_client method
  4. D. the create_thread_and_run method
Show the answer and explanation

Answer: C

  • A. Wrong: agents.create_version creates a versioned agent definition in the project. It does not return a client for sending chat prompts to a model deployment.
  • B. Wrong: responses.create sends a prompt, but it is a method on the OpenAI-style client, which the blank has to create first.
  • C. Right: Correct. get_openai_client returns an OpenAI-style client from the project, and that client then calls responses.create for each prompt. Learn more: Get started with code in Microsoft Foundry (opens in a new tab)
  • D. Wrong: create_thread_and_run belongs to the older threads-and-runs pattern, not to the current project client used for chat prompts.

Explanation

The project client gives an OpenAI-style client through get_openai_client, and that client sends prompts with responses.create. Agent definitions and thread-based calls are separate tasks.

Study

Keep practicing

Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.

Want more on Chat client apps with the Foundry SDK? The 5 full-length practice sets have 20 more Chat client apps with the Foundry SDK questions, 225 in all, none of them in the free exam. One payment of $9.99 $6.99, no subscription. Get the practice sets

Every exam starts with free questions. No account needed.