Skip to content

Latest commit

 

History

History
44 lines (24 loc) · 2.65 KB

File metadata and controls

44 lines (24 loc) · 2.65 KB

Vector search in Python (Azure AI Search)

This repository contains multiple notebooks that demonstrate how to use Azure AI Search for vector and non-vector content in RAG patterns and in traditional search solutions.

See What's new in Azure AI Search for feature announcements by month and version.

Prerequisites

To run the Python samples in this folder, you should have:

  • An Azure subscription, with access to Azure OpenAI or other third-party models.
  • Azure AI Search, any tier, but choose a service that can handle the workload. We recommend Basic or higher.
  • Azure OpenAI is used in most samples. A deployment of the text-embedding-ada-002 is a common requirement.
  • Python (these instructions were tested with version 3.11.x)

You can use Visual Studio Code with the Python extension as your Python IDE.

Set up your environment

  1. Clone this repository.

  2. Create a .env based on the code/.env-sample file. Copy your new .env file to the folder containing your notebook and update the variables.

  3. If you're using Visual Studio Code with the Python extension, make sure you also have the Jupyter extension.

Run the code

  1. Open the code folder and sample subfolder. Open a ipynb file in Visual Studio Code.

  2. Optionally, create a virtual environment so that you can control which package versions are used. Use Ctrl+shift+P to open a command palette. Search for Python: Create environment. Select Venv to create an environment within the current workspace.

  3. Copy the .env file to the subfolder containing the notebook.

  4. Execute the cells one by one, or select Run or Shift+Enter.

Troubleshoot errors

If you get error 429 from Azure OpenAI, it means the resource is over capacity:

  • Check the Activity Log of the Azure OpenAI service to see what else might be running.

  • Check the Tokens Per Minute (TPM) on the deployed model. On a system that isn't running other jobs, a TPM of 33K or higher should be sufficient to generate vectors for the sample data. You can try a model with more capacity if 429 errors persist.

  • Review these articles for information on rate limits: Understanding rate limits and A Guide to Azure OpenAI Service's Rate Limits and Monitoring.