AI-102 Implement generative AI solutions Practice Question
You are building a generative AI solution with Azure OpenAI Service that uses the GPT-4 model. The solution must process user requests and call external APIs to retrieve real-time data. You need to ensure the model can invoke the correct API based on user intent and return the results in a structured format. Which feature should you implement?
⚠ Common exam trap
Many exam-takers confuse function calling with code interpreter or fine-tuning, which do not provide dynamic, structured API invocation.
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
✓
Function calling with the 'tools' parameter in the Chat Completions API.
Function calling is the native feature in Azure OpenAI that allows the model to request invocation of external functions with structured arguments. By defining tools, the model can determine when to call an API and with what parameters. This provides reliable integration with external systems and returns structured responses, fulfilling the requirement.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Prompt engineering with few-shot examples of API calls.
Why it's wrong here
Few-shot examples can guide the model to mimic API call formats, but they do not provide a reliable mechanism for the model to invoke functions. The output may not be consistently structured, and parsing it is error-prone. This approach lacks the robustness and validation of native function calling.
- ✗
Using the Assistants API with code interpreter enabled.
Why it's wrong here
The Code Interpreter is designed for executing Python code in a sandbox, not for calling external APIs. It cannot directly invoke your APIs or return structured data from them. While the Assistants API supports function calling, the Code Interpreter tool itself is not the right feature for this scenario.
- ✗
Fine-tuning the model on a dataset of API calls and responses.
Why it's wrong here
Fine-tuning can teach the model patterns, but it does not provide a dynamic way to call APIs at runtime. It also requires a large, high-quality dataset and retraining when APIs change. It does not guarantee structured output for function invocation, making it less suitable than function calling.
- ✓
Function calling with the 'tools' parameter in the Chat Completions API.
Why this is correct
Function calling allows the model to output a JSON object specifying which function to call and with what arguments. You define functions in the 'tools' parameter, and the model decides when to invoke them. This enables integration with external APIs and structured data retrieval, directly meeting the requirement.
Go deeper
Related to this question
About these practice questions
One of 761 original AI-102 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.