Implement Generative AI and Agentic Solutions · Topic 1 of 3
Building Generative Applications with Foundry
AI-103 generative apps: connecting to a Foundry project with the SDK, consuming model deployments, retrieval-augmented generation and evaluating apps.
- 4 min
- Includes a diagram
- AIProjectClient needs the project endpoint and a credential.
- Code calls a deployment name; messages have system, user and assistant roles.
- Structured outputs force JSON that matches a schema.
What it is
A generative application sends prompts to a deployed model and uses the response, for example to answer questions, summarize or draft content. Most real apps add retrieval-augmented generation (RAG): they fetch relevant company content first and give it to the model so the answer is grounded in facts.
How it works
Connecting an app to a Foundry project
With the Foundry SDK for Python (the azure-ai-projects package), an app creates an AIProjectClient. It needs two things:
- the project endpoint of the Foundry project, and
- a credential, typically
DefaultAzureCredentialfromazure-identity, which signs in with Microsoft Entra ID (a managed identity in Azure, or the developer's sign-in locally).
From the project client, the app can get an authenticated OpenAI client (get_openai_client()) for model calls, work with agents, run evaluations and use connections.
Consuming models
- Code calls the deployment name, not the raw model name. This is the same for LLMs, small language models, code models and multimodal models.
- A chat request sends messages with roles: a system (or developer) message with instructions, user messages, and assistant messages for earlier replies.
- Multimodal models accept images or audio alongside text.
- Structured outputs constrain the response to a JSON schema, so code can parse it reliably.
- Streaming returns tokens as they are generated, improving perceived speed.
Retrieval-augmented generation

| Step | What happens |
|---|---|
| Ingest | Documents are split into chunks, embedded and indexed, for example in Azure AI Search |
| Retrieve | The question is searched (hybrid or vector) to find the most relevant chunks |
| Augment | Retrieved chunks are added to the prompt as sources |
| Generate | The model answers using the sources and cites them |
RAG keeps answers current without retraining, reduces fabrication and lets you show citations. Instructions such as "answer only from the sources; say you don't know otherwise" improve grounding.
Workflows and multistep reasoning
Some tasks need several steps: classify a request, retrieve data, call a tool, then write the answer. These can be built as workflows that chain model calls and tools, or handed to an agent that decides the steps itself. Fixed workflows are more predictable; agents are more flexible.
Evaluating models and apps
| Evaluator | Measures |
|---|---|
| Groundedness | Whether the answer is supported by the provided sources (detects fabrication) |
| Relevance | Whether the answer addresses the question |
| Coherence and fluency | Whether the answer reads logically and well |
| Retrieval quality | Whether the right documents were retrieved |
| Safety | Harmful content, jailbreak susceptibility |
Evaluations run on a test dataset of questions, and optionally expected answers, and are compared across model or prompt versions.
A model making up facts that are not in the retrieved documents is a groundedness problem. Measure it with a groundedness evaluator and fix it with better retrieval and stricter instructions.
How the exam asks about this
- "Which two values does code need to create an AIProjectClient?" The project endpoint and a credential such as DefaultAzureCredential.
- "Answers must use only the company handbook and cite it." Implement RAG over an index of the handbook.
- "Which evaluator detects answers not supported by the sources?" Groundedness.
What to remember for the exam
- AIProjectClient needs the project endpoint and a credential.
- Code calls a deployment name; messages have system, user and assistant roles.
- Structured outputs force JSON that matches a schema.
- RAG: ingest, retrieve, augment, generate; it grounds answers without retraining.
- Evaluate groundedness, relevance, coherence, fluency, retrieval and safety.
Fine-tuning is not the first answer for "use our latest documents". Fine-tuning changes style and behavior; RAG brings in current facts.
Common mistakes
Calling the model name instead of the deployment name. Requests target the deployment.
Choosing fine-tuning for fresh knowledge. Use RAG.
Skipping evaluation after a prompt change. Small prompt changes can lower quality.
Check yourself
What does an app need to create an AIProjectClient?
The Foundry project endpoint and a credential, typically DefaultAzureCredential.
What are the four steps of RAG?
Ingest, retrieve, augment the prompt with sources, and generate the answer.
Which feature makes a model return JSON that matches a schema?
Structured outputs.
Topic 1 of 3 in Implement Generative AI and Agentic Solutions
Test yourself on Implement Generative AI and Agentic Solutions
The full Microsoft AI-103 question bank has 648 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Microsoft. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.