Validate Your Setup¶
SETUP IS COMPLETE: Let's Review where we are right now
We just completed the PROVISION and SETUP stages of the end-to-end workflow.
- We launched GitHub Codespaces and forked the sample repo
- We have provisioned infrastructure resources on Azure
- We authenticated with Azure and refreshed our local env vars
- We completed post-provisioning tasks to populate data
In this section, we'll validate our setup quickly, and organize our development environment into browser tabs before we move to the IDEATE phase of development.
3.1 Azure Portal Tab¶
The Azure Portal helps us view the resources provisioned on Azure and check that they are setup correctly
Here's a reminder of the Azure Application Architecture - let's check our provisioned Resource Group to make sure these resources were created.
-
Open a new browser tab and navigate to the link below. You may be prompted to login.
1
https://portal.azure.com/#browse/resourcegroups
-
Sign in → If prompted, use the
Username
andPassword
from the "Azure Credentials" section in your Skillable Lab instructions panel. - You may be presented with a "Welcome to Microsoft Azure" screen. Click Cancel (to dismiss it) or click Get Started (to take an introductory tour of the Azure Portal).
- You should be taken directly to the Resource Groups page for your subscription.
- You should see an
rg-AITOUR
resource. This was created for you and contains all the resources needed to build and deploy your RAG-based copilot.
- You should see an
- Click
rg-AITOUR
to visit the Resource Group overview page.- Check: Deployments (look under "Essentials") - You should see: 35 succeeded.
- Check: Resources (in Overview) - You should see: 15 resources.
Leave the Azure Portal open on this tab. We'll revisit it later.
3.2 Azure AI Studio¶
The Azure AI Studio portal lets us view and manage the Azure AI project for our app.
-
Open a new browser tab and navigate to this page:
1
https://ai.azure.com
-
Click
Sign in
→ you will auto-login with the Azure credentials used to sign into the portal.- Check: You should see a Hub resource (with a name like ai-hub-XXXXXXXX)
-
Check: You should see a Project resource (with a name like ai-project-XXXXXXXX)
The Azure AI hub collects AI resources that can be shared between AI projects. The Azure AI project helps you organize your work when building applications.
-
Click the Project link. You will be taken to a Project details page.
- Click "Connected Resources" in the left pane,
- Check: You should see Hub connections to OpenAI endpoints, Azure AI Search & Storage.
- Click "Models + endpoints" in the left pane.
-
Check: You should see deployed models for this project.
For this application, we will use the chat completion models
gpt-4
andgpt-35-turbo
, and the embedding modeltext-embedding-ada-002
.
3.3 Azure Container App Tab¶
The Azure Container App provides the hosting environment for our copilot (API endpoint)
Azure Container Apps will host the endpoint used to serve the Contoso Chat application on the Contoso Outdoors website. The Azure provisioning should have deployed a default Azure Container App to this endpoint.
- Return to the Azure Portal tab
- Visit the
rg-AITOUR
Resource group page - Click the
Container App
resource to display the Overview page - Look for
Application Url
(at top right), and click it to launch in new tab - You should see: A
Hello World
message on the screen (confirming app was deployed)
Azure Container Apps (ACA) is used to host our chat AI application. The application server is implemented using FastAPI and exposes a /create_request
API endpoint to make requests to our copilot.
3.4. Check Azure Cosmos DB¶
The Azure CosmosDB resource holds the customer data for our application. It is a noSQL database that contains JSON data for each customer, and the prior purchases they made.
- Switch to the Azure Portal tab and display the
rg-AITOUR
resource group Overview - Click the
Azure Cosmos DB account
resource name to visit its details page - Click
Data Explorer
in the top-nav menu- dismiss the popup dialog to skip the movie
- see:
contoso-outdoor
container withcustomers
database - click
customers
, then selectItems
- you should see: 12 data items in database
3.5. Check Azure AI Search¶
The Azure AI Search resources contains the product index for our retailer's product catalog. It is the information retrieval service for RAG solutions, using sentence similarity and semantic ranking to return the most relevant results for a given customer query.
- Switch to the Azure Portal tab and display the
rg-AITOUR
resource group Overview - Click the
Search service
resource name to visit its details page - Click
Search Explorer
in the top-nav menu- see Search explorer with default index
contoso-products
- click "Search" with no other input
- you will see: Results dialog filled with index data for the entire product database.
- see Search explorer with default index
- Enter
sleeping bag
in the text box, and click Search- Verify that the first result returned relates to a sleeping bag from the catalog
Check the 'value' section of the response for semantically-ranked results.
- Enter
something to make food with
in the text box, and click Search- Verify that the first result returned relates to a camping stove
3.6. Check Azure Container App¶
How The Custom Copilot Experience Works
Our chat application works by sending chat messages to a custom endpoint hosted as an Azure Container App.
- The inputs to the endpoint are
- question → the customer's chat message),
- customer_id → the logged-in customer's ID number)
- chat_history → the prior conversation, for context.
- The response from the endpoint is the response returned by the chatbot.
When iterating on a prototype application, we start with manual testing, using a single "test prompt" to validate our scenario. We then move to automated evaluations with larger test datasets.
The FastAPI server exposes a Swagger API
endpoint that we can use for manual testing in both local (Codespaces) and cloud (Container Apps). Let's try it out now!
- Return to your deployed Azure Container App tab
- Add a
/docs
suffix to the URL and browse to that path - you will see: FastAPI page - Expand the
POST
section by clicking the arrow- click
Try it out
to make inputs editable - enter
Tell me about your tents
for question - enter
2
for customer_id - enter
[]
for chat_history - enter Execute to run the endpoint with the provided parameters.
- click
You will get a response body with question
, answer
and context
components.
- Check
question
- is the customer's question the same as that typed in the chat window on the Contoso Outdoor website - Check
answer
- is the chatbot's response to the customer'squestion
, as generated by this RAG application - Check
context
- is the additional information provided to the Generative AI model being used by it used to ground its answer.- In this app, that includes information about products relevant to the customer question.
- The products selected may depend on
customer_id
and the associated order history. - The web app provides
chat_history
from the chat window - which can serve as additional context that the model can use to ground the response.
Exercise → Repeat exercise with a different customer ID (between 1 and 12). How did the response change?
3.7. Let's Connect The Dots 💡¶
Recall that the Retrieval Augmented Generation works by retrieving relevant knowledge from your data stores, and augmenting the user query with it to create an enhanced prompt - which generates the final response.
To implement this RAG pattern, we need to execute three steps:
- Setup data sources and populate them with our data (product catalog, customer orders)
- Create indexes for efficient information retrieval by LLMs (e.g., find matching products)
- Connect our Azure AI project to access data/indexes code-first, for use in processing steps.
In the previous section we setup the data sources (provisioning infra) and populated them with data (post-provisioning scripts) as follows:
- Azure CosmosDB - loaded 12 records from
data/customer_info
, got customers database. - Azure AI Search - loaded 20 records from
data/product_info
, got contoso-products index.
This checks off the first two idents from our RAG checklist above. Now, let's see how we can achieve the thirst ep with a code-first approach that makes use of the Azure AI Search, Azure CosmosDB and Azure OpenAI services through their Azure SDKs.
CONGRATULATIONS. You validated your setup! It's time to IDEATE!