AI-102 Implement generative AI solutions Practice Question
You are building an application that uses the Azure OpenAI Assistants API. The assistant must maintain conversational context across multiple user turns and use a code interpreter to analyze uploaded CSV files. Which two actions should you perform? (Choose two.)
⚠ Common exam trap
The trap here is treating streaming or per-turn assistant creation as a way to keep context, when conversation state is actually held in threads and tools must be explicitly enabled and given file access.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Create a thread and add user messages to it, then create a run that references the assistant and the thread.
The Assistants API stores multi-turn context in threads, so messages are appended to a thread and runs execute against the assistant and thread. Code interpreter must be enabled as a tool, and CSV files must be uploaded and attached so the tool can read them during the run. Together these actions satisfy both the context and analysis requirements.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Create a new assistant for each user turn to avoid context conflicts.
Why it's wrong here
Creating a new assistant per turn discards configuration continuity and does not preserve conversation history, since history lives in threads. This approach would require resending all prior messages manually and would not use the Assistants API's state management, failing the multi-turn context requirement.
- ✓
Create a thread and add user messages to it, then create a run that references the assistant and the thread.
Why this is correct
The Assistants API persists conversation state in a thread. Adding messages to the thread and running the assistant against both the assistant ID and thread ID gives the model access to prior turns, satisfying the multi-turn context requirement without manually resending history in each call.
- ✗
Set the 'stream' parameter to true on every run to preserve conversation state between turns.
Why it's wrong here
Streaming controls how run output is delivered to the client; it does not persist conversation state. Threads store messages and context regardless of streaming. Enabling stream may improve responsiveness but does not fulfill the requirement to maintain context across turns.
- ✗
Use the completions endpoint with a manually maintained message array instead of the Assistants API.
Why it's wrong here
The scenario specifies using the Assistants API. Switching to the completions endpoint with a manual message array abandons threads and built-in tool orchestration, so code interpreter execution and automatic context management would not be available. It does not meet the stated design.
- ✓
Enable the code_interpreter tool on the assistant and upload the CSV files as files that the run can access.
Why this is correct
The code_interpreter tool allows the assistant to write and execute Python in a sandboxed environment, which is needed to analyze CSV data. Uploading files and attaching them to the assistant or thread makes them available to the tool during the run, enabling the required analysis.
Go deeper
Related to this question
About these practice questions
Courseiva writes every AI-102 question from scratch — 761 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Microsoft exam blueprint
This AI-102 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AI-102 exam.