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.
Note
Foundry IQ (Azure AI Search) provides direct indexing and query APIs alongside higher-level knowledge source and knowledge base APIs for managed retrieval. Use the Azure portal, REST APIs, or Azure SDKs to configure these capabilities, or connect agents to knowledge bases in the Microsoft Foundry portal.
Learn about Python code samples that demonstrate the functionality and workflow of a Foundry IQ (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 Foundry IQ 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-Agentic-Retrieval | Quickstart: Agentic retrieval | Integrate semantic ranking with LLM-powered query planning and answer generation. |
| Quickstart-Keyword-Search | Quickstart: Full-text search | Create, load, and query a search index using sample data. |
| Quickstart-Semantic-Ranking | 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. |
| agentic-retrieval-pipeline-example | Tutorial: Build an end-to-end agentic retrieval solution | Unlike Quickstart-Agentic-Retrieval, this sample incorporates Foundry Agent Service for request orchestration. |
| embedding-model-migration | Migrate embedding models | Back up eligible indexed content, regenerate a selected vector field, and restore to a new index. |
| image-serving-example | Surface document-embedded images in agentic retrieval (preview) | Use managed ingestion to extract images, serve them during answer synthesis, and independently query and download an indexed image reference from Azure Blob Storage. |
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 Foundry IQ 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 Foundry IQ 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 Foundry IQ 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 Foundry IQ team but aren't referenced in documentation. Associated README files provide usage instructions.
| Sample | Description |
|---|---|
| azure-search-classic-rag | Single-shot RAG using the classic search engine as grounding data from Foundry IQ, with a chat completion model from Azure OpenAI. |
| Quickstart-Document-Permissions-Pull-API | Using an indexer "pull API" approach, flow access control lists from a data source to search results and apply permission filters that restrict access to authorized content. |
| Quickstart-Document-Permissions-Push-API | Using the push APIs for indexing a JSON payload, flow embedded permission metadata to indexed documents and search results that are filtered based on user access to authorized content. |
| azure-function-search | Use an Azure function to send queries to a Foundry IQ 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.