Skip to content

Commit 488ed37

Browse files
committed
Edits based on MattG updates
1 parent fca7072 commit 488ed37

File tree

2 files changed

+53
-41
lines changed

2 files changed

+53
-41
lines changed

articles/search/includes/quickstarts/agentic-retrieval-python.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ ms.date: 05/12/2025
99

1010
[!INCLUDE [Feature preview](../previews/preview-generic.md)]
1111

12-
In this quickstart, you use [agentic retrieval](../../search-agentic-retrieval-concept.md) to create a conversational search experience powered by large language models (LLMs) and your proprietary data. Agentic retrieval breaks down complex user queries into subqueries, runs the subqueries in parallel, and extracts grounding data from documents indexed in Azure AI Search. The output is intended for integration with custom chat solutions.
12+
In this quickstart, you use [agentic retrieval](../../search-agentic-retrieval-concept.md) to create a conversational search experience powered by large language models (LLMs) and your proprietary data. Agentic retrieval breaks down complex user queries into subqueries, runs the subqueries in parallel, and extracts grounding data from documents indexed in Azure AI Search. The output is intended for integration with agent and custom chat solutions.
1313

1414
Although you can provide your own data, this quickstart uses [sample JSON documents](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/nasa-e-book/earth-at-night-json) from NASA's Earth at Night e-book. The documents describe general science topics and images of Earth at night as observed from space.
1515

16+
This quickstart is based on the [Quickstart-Agentic-Retrieval](https://github.com/Azure-Samples/azure-search-python-samples/tree/main/Quickstart-Agentic-Retrieval) Jupyter notebook on GitHub.
17+
1618
## Prerequisites
1719

1820
+ An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
@@ -66,7 +68,7 @@ To configure the recommended role-based access:
6668

6769
1. On your Azure AI Search service, [assign the following roles](../../search-security-rbac.md#how-to-assign-roles-in-the-azure-portal) to yourself.
6870

69-
+ **Owner/Contributor** or **Search Service Contributor**
71+
+ **Search Service Contributor**
7072

7173
+ **Search Index Data Contributor**
7274

articles/search/search-agentic-retrieval-how-to-pipeline.md

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ author: HeidiSteen
88
ms.author: heidist
99
ms.service: azure-ai-search
1010
ms.topic: how-to
11-
ms.date: 05/10/2025
11+
ms.date: 05/20/2025
1212
---
1313

1414
# Build an agent-to-agent retrieval solution using Azure AI Search
@@ -31,7 +31,9 @@ The following resources are required for this design pattern:
3131

3232
+ Azure OpenAI, and you should have an **Azure AI Developer** role assignment to create a Foundry project.
3333

34-
+ A project in Azure AI Foundry, with a deployment of a supported large language model and an Azure AI Agent in a basic setup. To meet this requirement, follow the steps in [Quickstart: Create a new agent (Preview)](/azure/ai-services/agents/quickstart?pivots=ai-foundry-portal). We recommend 100,000 token capacity for your model. You can find capacity and the rate limit in the model deployments list in the Azure AI Foundry portal.
34+
+ A project in Azure AI Foundry, with a deployment of a supported large language model and an Azure AI Agent in a Basic setup.
35+
36+
Follow the steps in [Create a project for Azure AI Foundry](/azure/ai-foundry/how-to/create-project). Deploy one of the chat completion models listed below. We recommend a minimum of 100,000 token capacity for your model. You can find capacity and the rate limit in the model deployments list in the Azure AI Foundry portal.
3537

3638
### Supported large language models
3739

@@ -61,19 +63,7 @@ Your custom application makes API calls to Azure AI Search and an Azure SDK.
6163
+ Azure SDK with a Foundry project, providing programmatic access to chat and chat history
6264
+ Azure AI Agent, with an agent for handling the conversation, and a tool for orchestration
6365

64-
## How to customize grounding data
65-
66-
Search results are consolidating into a large unified string that you can pass to a conversational language model for a grounded answer. The following indexing and relevance tuning features in Azure AI Search are available to help you generate high quality results:
67-
68-
+ Scoring profiles (added to your search index) provide built-in boosting criteria. Your index must specify a default scoring profile, and that's the one used by the retrieval engine when queries include fields associated with that profile.
69-
70-
+ Semantic configuration is required, but you determine which fields are prioritized and used for ranking.
71-
72-
+ For plain text content, you can use analyzers to control tokenization during indexing.
73-
74-
+ For multimodal or image content, you can use image verbalization for LLM-generated descriptions of your images, or classic OCR and image analysis via skillsets during indexing.
75-
76-
## Create the project
66+
## Set up your environment
7767

7868
The canonical use case for agentic retrieval is through the Azure AI Agent service. We recommend it because it's the easiest way to create a chatbot.
7969

@@ -87,27 +77,52 @@ You need endpoints for:
8777

8878
You can find endpoints for Azure AI Search and Azure OpenAI in the [Azure portal](https://portal.azure.com).
8979

90-
You can find the project connection string in the Azure AI Foundry portal:
80+
You can find the project endpoint in the Azure AI Foundry portal:
9181

9282
1. Sign in to the [Azure AI Foundry portal](https://ai.azure.com) and open your project.
9383

94-
1. In the **Project details** tile, find and copy the **Project connection string**.
95-
96-
A hypothetical connection string might look like this: `eastus2.api.azureml.ms;00000000-0000-0000-0000-0000000000;rg-my-resource-group-name;my-foundry-project-name`
84+
1. In the **Overview** tile, find and copy the Azure AI Foundry project endpoint.
9785

98-
1. Check the authentication type for your Azure OpenAI resource and make sure it uses an API key shared to all projects. Still in **Project details**, expand the **Connected resources** tile to view the authentication type for your Azure OpenAI resource.
86+
A hypothetical endpoint might look like this: https://your-foundry-resource.services.ai.azure.com/api/projects/your-foundry-project
9987

10088
If you don't have an Azure OpenAI resource in your Foundry project, revisit the model deployment prerequisite. A connection to the resource is created when you deploy a model.
10189

90+
### Set up an AI project client and create an agent
91+
92+
Use [AIProjectClient](/python/api/azure-ai-projects/azure.ai.projects.aiprojectclient?view=azure-python-preview&preserve-view=true) to create your AI agent.
93+
94+
```python
95+
from azure.ai.projects import AIProjectClient
96+
97+
project_client = AIProjectClient(endpoint=project_endpoint, credential=credential)
98+
99+
list(project_client.agents.list_agents())
100+
```
101+
102+
Your agent is backed by a supported language model and instructions inform the agent of its scope.
103+
104+
```python
105+
instructions = """
106+
A Q&A agent that can answer questions about the Earth at night.
107+
Sources have a JSON format with a ref_id that must be cited in the answer using the format [ref_id].
108+
If you do not have the answer, respond with "I don't know".
109+
"""
110+
agent = project_client.agents.create_agent(
111+
model=agent_model,
112+
name=agent_name,
113+
instructions=instructions
114+
)
115+
116+
print(f"AI agent '{agent_name}' created or updated successfully")
117+
```
118+
102119
### Add an agentic retrieval tool to AI Agent
103120

104121
An end-to-end pipeline needs an orchestration mechanism for coordinating calls to the retriever and knowledge agent. You can use a [tool](/azure/ai-services/agents/how-to/tools/function-calling) for this task. The tool calls the Azure AI Search knowledge retrieval client and the Azure AI agent, and it drives the conversations with the user.
105122

106-
## How to design a prompt
107-
108-
The prompt sent to the LLM includes instructions for working with the grounding data, which is passed as a large single string with no serialization or structure.
123+
## How to structure messages
109124

110-
The tool or function that you use to drive the pipeline provides the instructions to the LLM for the conversation.
125+
The prompt sent to the LLM includes instructions for including chat history and results obtained during retrieval on Azure AI Search. The response is passed as a large single string with no serialization or structure.
111126

112127
```python
113128
def agentic_retrieval() -> str:
@@ -135,22 +150,17 @@ def agentic_retrieval() -> str:
135150
return retrieval_result.response[0].content[0].text
136151
```
137152

138-
To provide instructions used for building the query plan and the subqueries used to get the grounding data, set the message in the knowledge agent:
153+
## How to improve data quality
139154

140-
```python
141-
project_client = AIProjectClient.from_connection_string(project_conn_str, credential=credential)
155+
Search results are consolidating into a large unified string that you can pass to a conversational language model for a grounded answer. The following indexing and relevance tuning features in Azure AI Search are available to help you generate high quality results. You can implement these features in the search index, and the improvements in search relevance are evident in the quality of the response returned during retrieval.
142156

143-
instructions = """
144-
An Q&A agent that can answer questions about the Earth at night.
145-
Sources have a JSON format with a ref_id that must be cited in the answer.
146-
If you do not have the answer, respond with "I don't know".
147-
"""
148-
agent = project_client.agents.create_agent(
149-
model=agent_model,
150-
name=agent_name,
151-
instructions=instructions
152-
)
153-
```
157+
+ [Scoring profiles](index-add-scoring-profiles.md) (added to your search index) provide built-in boosting criteria. Your index must specify a default scoring profile, and that's the one used by the retrieval engine when queries include fields associated with that profile.
158+
159+
+ [Semantic configuration](semantic-how-to-configure.md) is required, but you determine which fields are prioritized and used for ranking.
160+
161+
+ For plain text content, you can use [analyzers](index-add-custom-analyzers.md) to control tokenization during indexing.
162+
163+
+ For [multimodal or image content](multimodal-search-overview.md), you can use image verbalization for LLM-generated descriptions of your images, or classic OCR and image analysis via skillsets during indexing.
154164

155165
## Control the number of subqueries
156166

@@ -178,7 +188,7 @@ Look at output tokens in the [activity array](search-agentic-retrieval-how-to-re
178188

179189
+ Summarize message threads.
180190

181-
+ Use `gpt mini`.
191+
+ Use `gpt mini` or a smaller model that performs faster.
182192

183193
+ Set `maxOutputSize` in the [knowledge agent](search-agentic-retrieval-how-to-create.md) to govern the size of the response, or `maxRuntimeInSeconds` for time-bound processing.
184194

0 commit comments

Comments
 (0)