Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Learn about Python code samples that demonstrate the functionality and workflow of an Azure AI Search solution. These samples use the Azure AI Search client library for the Azure SDK for Python, which you can explore through the following links.
Target | Link |
---|---|
Package download | pypi.org/project/azure-search-documents/ |
API reference | azure-search-documents |
API test cases | github.com/Azure/azure-sdk-for-python/tree/main/sdk/search/azure-search-documents/tests |
Source code | github.com/Azure/azure-sdk-for-python/tree/main/sdk/search/azure-search-documents |
Change log | github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/CHANGELOG.md |
SDK samples
Code samples from the Azure SDK development team demonstrate API usage. You can find these samples in Azure/azure-sdk-for-python/tree/main/sdk/search/azure-search-documents/samples on GitHub.
Doc samples
Code samples from the Azure AI Search team demonstrate features and workflows. The following samples are referenced in tutorials, quickstarts, and how-to articles. You can find these samples in Azure-Samples/azure-search-python-samples on GitHub.
Sample | Article | Description |
---|---|---|
Quickstart | Quickstart: Full-text search | Create, load, and query a search index using sample data. |
Quickstart-Agentic-Retrieval | Quickstart: Agentic retrieval | Integrate semantic ranking with LLM-powered query planning and answer generation. |
Quickstart-RAG | Quickstart: Generative search (RAG) | Use grounding data from Azure AI Search with a chat completion model from Azure OpenAI. |
Quickstart-Semantic-Search | Quickstart: Semantic ranking | Add semantic ranking to an index schema and run semantic queries. |
Quickstart-Vector-Search | Quickstart: Vector search | Index and query vector content. |
Tutorial-RAG | Build a RAG solution using Azure AI Search | Create an indexing pipeline that loads, chunks, embeds, and ingests searchable content for RAG. |
agentic-retrieval-pipeline-example | Build an agent-to-agent retrieval solution using Azure AI Search | Unlike Quickstart-Agentic-Retrieval, this sample incorporates Azure AI Agent for request orchestration. |
Accelerators
An accelerator is an end-to-end solution that includes code and documentation you can adapt for your own implementation of a specific scenario.
Sample | Description |
---|---|
rag-experiment-accelerator | Conduct experiments and evaluations using Azure AI Search and the RAG pattern. This sample has code for loading multiple data sources, using various models, and creating various search indexes and queries. |
Demos
A demo repo provides proof-of-concept source code for examples or scenarios shown in demonstrations. Unlike accelerators, demo solutions aren't designed for adaptation.
Sample | Description |
---|---|
azure-search-vector-samples | Comprehensive collection of samples for vector search scenarios, organized by scenario or technology. |
azure-search-openai-demo | ChatGPT-like experience over enterprise data with Azure OpenAI Python code showing how to use Azure AI Search with large language models in Azure OpenAI. For background, see this blog post. |
aisearch-openai-rag-audio | "Voice to RAG." This sample demonstrates a simple architecture for voice-based generative AI applications that enables Azure AI Search RAG on top of the real-time audio API with full-duplex audio streaming from client devices. It also securely handles access to both the model and the retrieval system. Backend code is written in Python, while frontend code is written in JavaScript. For an introduction, watch this video. |
Other samples
The following samples are also published by the Azure AI Search team but aren't referenced in documentation. Associated README files provide usage instructions.
Sample | Description |
---|---|
azure-function-search | Use an Azure function to send queries to a search service. You can substitute this Python version for the api code used in Add search to web sites with .NET. |
bulk-insert | Use the push APIs to upload and index documents. |
index-backup-and-restore.ipynb | Make a local copy of retrievable fields in an index and push those fields to a new index. |
resumable-index-backup-restore | Back up and restore larger indexes that exceed 100,000 documents. |
Tip
Use the samples browser to search for Microsoft code samples on GitHub. You can filter your search by product, service, and language.