How to create a vector index
Note
Azure AI Studio is currently in public preview. This preview is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
In this article, you learn how to create and use a vector index for performing Retrieval Augmented Generation (RAG).
Prerequisites
You must have:
- An Azure AI project
- An Azure AI Search resource
Create an index
Sign in to Azure AI Studio and open the Azure AI project in which you want to create the index.
From the collapsible menu on the left, select Indexes under Components.
Select + New index
Choose your Source data. You can choose source data from a list of your recent data sources, a storage URL on the cloud or even upload files and folders from the local machine. You can also add a connection to another data source such as Azure Blob Storage.
Select Next after choosing source data
Choose the Index Storage - the location where you want your index to be stored
If you already have a connection created for an Azure AI Search service, you can choose that from the dropdown.
- If you don't have an existing connection, choose Connect other Azure AI Search service
- Select the subscription and the service you wish to use.
Select Next after choosing index storage
Configure your Search Settings
- The search type defaults to Hybrid + Semantic, which is a combination of keyword search, vector search and semantic search to give the best possible search results.
- For the hybrid option to work, you need an embedding model. Choose the Azure OpenAI resource, which has the embedding model
- Select the acknowledgment to deploy an embedding model if it doesn't already exist in your resource
Use the prefilled name or type your own name for New Vector index name
Select Next after configuring search settings
In the Index settings
- Enter a name for your index or use the autopopulated name
- Choose the compute where you want to run the jobs to create the index. You can
- Auto select to allow Azure AI to choose an appropriate VM size that is available
- Choose a VM size from a list of recommended options
- Choose a VM size from a list of all possible options
Select Next after configuring index settings
Review the details you entered and select Create
Note
If you see a DeploymentNotFound error, you need to assign more permissions. See mitigate DeploymentNotFound error for more details.
You're taken to the index details page where you can see the status of your index creation.
Mitigate DeploymentNotFound error
When you try to create a vector index, you might see the following error at the Review + Finish step:
Failed to create vector index. DeploymentNotFound: A valid deployment for the model=text-embedding-ada-002 was not found in the workspace connection=Default_AzureOpenAI provided.
This can happen if you are trying to create an index using an Owner, Contributor, or Azure AI Developer role at the project level. To mitigate this error, you might need to assign more permissions using either of the following methods.
Note
You need to be assigned the Owner role of the resource group or higher scope (like Subscription) to perform the operation in the next steps. This is because only the Owner role can assign roles to others. See details here.
Method 1: Assign more permissions to the user on the Azure AI resource
If the Azure AI resource the project uses was created through Azure AI Studio:
Sign in to Azure AI Studio and select your project via Build > Projects.
Select Settings from the collapsible left menu.
From the Resource Configuration section, select the link for your resource group name that takes you to the Azure portal.
In the Azure portal under Overview > Resources select the Azure AI service type. It's named similar to "YourAzureAIResourceName-aiservices."
Select Access control (IAM) > + Add to add a role assignment.
Add the Cognitive Services OpenAI User role to the user who wants to make an index.
Cognitive Services OpenAI ContributorandCognitive Services Contributoralso work, but they assign more permissions than needed for creating an index in Azure AI Studio.
Note
You can also opt to assign more permissions on the resource group. However, that method assigns more permissions than needed to mitigate the DeploymentNotFound error.
Method 2: Assign more permissions on the resource group
If the Azure AI resource the project uses was created through Azure portal:
- Sign in to Azure AI Studio and select your project via Build > Projects.
- Select Settings from the collapsible left menu.
- From the Resource Configuration section, select the link for your resource group name that takes you to the Azure portal.
- Select Access control (IAM) > + Add to add a role assignment.
- Add the Cognitive Services OpenAI User role to the user who wants to make an index.
Cognitive Services OpenAI ContributorandCognitive Services Contributoralso work, but they assign more permissions than needed for creating an index in Azure AI Studio.
Use an index in prompt flow
Open your AI Studio project
In Flows, create a new Flow or open an existing flow
On the top menu of the flow designer, select More tools, and then select Vector Index Lookup
Provide a name for your step and select Add.
The Vector Index Lookup tool is added to the canvas. If you don't see the tool immediately, scroll to the bottom of the canvas
Enter the path to your vector index, along with the query that you want to perform against the index.
Next steps
Feedback
Submit and view feedback for