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.
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-002is 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.
-
Clone this repository.
-
Create a
.envbased on thecode/.env-samplefile. Copy your new .env file to the folder containing your notebook and update the variables. -
If you're using Visual Studio Code with the Python extension, make sure you also have the Jupyter extension.
-
Open the
codefolder and sample subfolder. Open aipynbfile in Visual Studio Code. -
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. SelectVenvto create an environment within the current workspace. -
Copy the
.envfile to the subfolder containing the notebook. -
Execute the cells one by one, or select Run or Shift+Enter.
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.