Get Your CertMicrosoft Applied Skills: Develop a Generative AI Chat App Using the Microsoft Foundry SDKPlayCompete
‹ All Microsoft Applied Skills: Develop a Generative AI Chat App Using the Microsoft Foundry SDK questions

Microsoft Foundry Generative AI Chat App Practice Question 9: Multi Turn Conversation State

Microsoft Applied Skills: Develop a Generative AI Chat App Using the Microsoft Foundry SDK · Test 1 · question 9 of 10

Implement chat historymedium

Testers report a bug in a Foundry chat app built on the Responses API. Asking "What is the size of France in square miles?" returns a correct answer, but the follow-up "And what is the capital city?" comes back with a request for clarification about which country is meant. Each turn calls responses.create() with only the new user message. What is the most direct fix?

Select one answer
Show answer and explanation

Answer:

  • D. Pass the previous response's ID in previous_response_id so the turns are chained

Each responses.create() call is independent unless you tell the service how the turns relate. The documented pattern is to "chain turns by passing the previous response ID to previous_response_id," which carries the conversation forward without your code reassembling the history. The alternative, if you want to manage state yourself, is stateless input-array chaining: append the assistant's response.output to your input list and send the whole list on the next turn. Either way, the second call has to carry the first turn; sending only the new message is why the model can't tell which country is meant.

- A is wrong because max_output_tokens caps how long the reply can be. A longer reply to a question the model can't resolve is still a request for clarification. - B is wrong because streaming only changes how the response is delivered, token by token instead of all at once. It has no effect on what context the request carries. - C is wrong because temperature controls sampling randomness. The model is not discarding context; the context was never sent, so no sampling setting can recover it.

Reference: Use the Azure OpenAI Responses API

Practice Test 1 ›