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

  1. Sign in to Azure AI Studio.

  2. Go to your project or create a new project in Azure AI Studio.

  3. From the collapsible menu on the left, select Indexes under Components.

    Screenshot of Project Left Menu.

  4. Select + New index

  5. 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.

    Screenshot of select source data.

  6. Select Next after choosing source data

  7. Choose the Index Storage - the location where you want your index to be stored

  8. If you already have a connection created for an Azure AI Search service, you can choose that from the dropdown.

    Screenshot of select index store.

    1. If you don't have an existing connection, choose Connect other Azure AI Search service
    2. Select the subscription and the service you wish to use.

    Screenshot of Select index store details.

  9. Select Next after choosing index storage

  10. Configure your Search Settings

    1. 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.
    2. For the hybrid option to work, you need an embedding model. Choose the Azure OpenAI resource, which has the embedding model
    3. Select the acknowledgment to deploy an embedding model if it doesn't already exist in your resource

    Screenshot of configure search settings.

  11. Use the prefilled name or type your own name for New Vector index name

  12. Select Next after configuring search settings

  13. In the Index settings

    1. Enter a name for your index or use the autopopulated name
    2. 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

    Screenshot of configure index settings.

  14. Select Next after configuring index settings

  15. 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.

  16. 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 hub resource

If the Azure AI hub resource the project uses was created through Azure AI Studio:

  1. Sign in to Azure AI Studio and select your project via Build > Projects.

  2. Select AI project settings from the collapsible left menu.

  3. From the Resource Configuration section, select the link for your resource group name that takes you to the Azure portal.

  4. In the Azure portal under Overview > Resources select the Azure AI service type. It's named similar to "YourAzureAIResourceName-aiservices."

    Screenshot of Azure AI service in a resource group.

  5. Select Access control (IAM) > + Add to add a role assignment.

  6. Add the Cognitive Services OpenAI User role to the user who wants to make an index. Cognitive Services OpenAI Contributor and Cognitive Services Contributor also 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 hub resource the project uses was created through Azure portal:

  1. Sign in to Azure AI Studio and select your project via Build > Projects.
  2. Select AI project settings from the collapsible left menu.
  3. From the Resource Configuration section, select the link for your resource group name that takes you to the Azure portal.
  4. Select Access control (IAM) > + Add to add a role assignment.
  5. Add the Cognitive Services OpenAI User role to the user who wants to make an index. Cognitive Services OpenAI Contributor and Cognitive Services Contributor also work, but they assign more permissions than needed for creating an index in Azure AI Studio.

Use an index in prompt flow

  1. Sign in to Azure AI Studio and select your project from the Build page.

  2. From the collapsible left menu, select Prompt flow.

  3. Open an existing prompt flow or select + Create to create a new flow.

  4. On the top menu of the flow designer, select More tools, and then select Index Lookup.

    Screenshot of Vector index Lookup from More Tools.

  5. Provide a name for your Index Lookup Tool and select Add.

  6. Select the mlindex_content value box, and select your index. After completing this step, enter the queries and query_types to be performed against the index.

    Screenshot of Configure Index Lookup.

Next steps