Skip to content

Commit 9bbb423

Browse files
committed
Update docs and make mypy happy
1 parent 3de71da commit 9bbb423

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

app/backend/approaches/approach.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ async def run_agentic_retrieval(
322322

323323
# Create documents from reference source data
324324
for ref in refs:
325-
if ref.source_data:
325+
if ref.source_data and ref.doc_key:
326+
# Note that ref.doc_key is the same as source_data["id"]
326327
documents.append(
327328
Document(
328329
id=ref.source_data.get("id"),
@@ -337,7 +338,7 @@ async def run_agentic_retrieval(
337338
search_agent_query=activity_mapping[ref.activity_source],
338339
)
339340
)
340-
doc_to_ref_id[ref.source_data.get("id")] = ref.id
341+
doc_to_ref_id[ref.doc_key] = ref.id
341342
if top and len(documents) >= top:
342343
break
343344

docs/agentic_retrieval.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
11
# RAG chat: Using agentic retrieval
22

3-
This repository includes an optional feature that uses agentic retrieval to find the most relevant content given a user's conversation history.
3+
This repository includes an optional feature that uses [agentic retrieval from Azure AI Search](https://learn.microsoft.com/azure/search/search-agentic-retrieval-concept) to find the most relevant content given a user's conversation history. The agentic retrieval feature uses a LLM to analyze the conversation and generate multiple search queries to find relevant content. This can improve the quality of the responses, especially for complex or multi-faceted questions.
44

5-
## Using the feature
6-
7-
### Supported Models
8-
9-
See the agentic retrieval documentation.
10-
11-
### Prerequisites
12-
13-
* A deployment of any of the supported agentic retrieval models in the [supported regions](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability). If you're not sure, try to create a gpt-4.1-mini deployment from your Azure OpenAI deployments page.
14-
15-
### Deployment
5+
## Deployment
166

177
1. **Enable agentic retrieval:**
188

19-
Set the environment variables for your Azure OpenAI GPT deployments to your reasoning model
9+
Set the azd environment variable to enable the agentic retrieval feature:
2010

2111
```shell
2212
azd env set USE_AGENTIC_RETRIEVAL true
2313
```
2414

25-
2. **(Optional) Set the agentic retrieval model**
15+
2. **(Optional) Customize the agentic retrieval model**
2616

2717
You can configure which model agentic retrieval uses. By default, gpt-4.1-mini is used.
2818

@@ -34,17 +24,19 @@ See the agentic retrieval documentation.
3424
azd env set AZURE_OPENAI_SEARCHAGENT_MODEL_VERSION 2025-04-14
3525
```
3626

27+
You can only change it to one of the [supported models](https://learn.microsoft.com/azure/search/search-agentic-retrieval-how-to-create#supported-models).
28+
3729
3. **Update the infrastructure and application:**
3830

39-
Execute `azd up` to provision the infrastructure changes (only the new model, if you ran `up` previously) and deploy the application code with the updated environment variables.
31+
Execute `azd up` to provision the infrastructure changes (only the new model, if you ran `up` previously) and deploy the application code with the updated environment variables. The post-provision script will configure Azure AI Search with a Knowledge agent pointing at the search index.
4032

4133
4. **Try out the feature:**
4234

4335
Open the web app and start a new chat. Agentic retrieval will be used to find all sources.
4436

4537
5. **Review the query plan**
4638

47-
Agentic retrieval use additional billed tokens behind the scenes for the planning process.
39+
Agentic retrieval uses additional billed tokens behind the scenes for the planning process.
4840
To see the token usage, select the lightbulb icon on a chat answer. This will open the "Thought process" tab, which shows the amount of tokens used by and the queries produced by the planning process
4941

5042
![Thought process token usage](./images/query-plan.png)

0 commit comments

Comments
 (0)