You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/search-agentic-retrieval-how-to-retrieve.md
+49-51Lines changed: 49 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,29 +62,25 @@ POST https://{{search-url}}/agents/{{agent-name}}/retrieve?api-version=2025-05-0
62
62
{
63
63
"role" : "assistant",
64
64
"content" : [
65
-
{ "type" : "text", "text" : "You are a helpful assistant for Contoso Human Resources. You have access to a search index containing guidelines about health care coverage for Washington state. If you can't find the answer in the search, say you don't know." }
65
+
{ "type" : "text", "text" : "You can answer questions about the Earth at night.
66
+
Sources have a JSON format with a ref_id that must be cited in the answer.
67
+
If you do not have the answer, respond with "I don't know"." }
66
68
]
67
69
},
68
70
{
69
71
"role" : "user",
70
72
"content" : [
71
-
{ "type" : "text", "text" : "What are my options for health care coverage" }
72
-
]
73
-
},
74
-
{
75
-
"role" : "user",
76
-
"content" : [
77
-
{ "type" : "text", "text" : "Which one has vision benefits" }
73
+
{ "type" : "text", "text" : "Why is the Phoenix nighttime street grid is so sharply visible from space, whereas large stretches of the interstate between midwestern cities remain comparatively dim?" }
78
74
]
79
75
}
80
76
],
81
77
"targetIndexParams" : [
82
78
{
83
79
"indexName" : "{{index-name}}",
84
-
"filterAddOn" : "State eq 'WA'",
80
+
"filterAddOn" : "page_number eq 105'",
85
81
"IncludeReferenceSourceData": true,
86
82
"rerankerThreshold" : 2.5,
87
-
"maxDocsForReranker": 250
83
+
"maxDocsForReranker": 50
88
84
}
89
85
]
90
86
}
@@ -102,7 +98,7 @@ POST https://{{search-url}}/agents/{{agent-name}}/retrieve?api-version=2025-05-0
102
98
103
99
+`filterAddOn` lets you set an [OData filter expression](search-filters.md) for keyword or hybrid search.
104
100
105
-
+`IncludeReferenceSourceData` is initially set in the knowledge agent definition. You can override that setting in the retrieve action to return grounding data in the [references section](#review-the-references-array) of the response.
101
+
+`IncludeReferenceSourceData`tells the retrieval engine to return the source content in the response. This value is initially set in the knowledge agent definition. You can override that setting in the retrieve action to return original source content in the [references section](#review-the-references-array) of the response.
106
102
107
103
+`rerankerThreshold` and `maxDocsForReranker` are also initially set in the knowledge agent definition as defaults. You can override them in the retrieve action to configure [semantic reranker](semantic-how-to-configure.md), setting minimum thresholds and the maximum number of inputs sent to the reranker.
108
104
@@ -125,18 +121,21 @@ The body of the response is also structured in the chat message style format. Cu
"text": "[{\"ref_id\":0,\"title\":\"Urban Structure\",\"terms\":\"Location of Phoenix, Grid of City Blocks, Phoenix Metropolitan Area at Night\",\"content\":\"<content chunk redacted>\"}]"
129
125
}
130
126
]
131
127
}
132
128
]
133
129
```
134
130
135
-
`content` is a JSON array. It's a single string composed of the most relevant documents (or chunks) found in the search index, given the query and chat history inputs. This array is your grounding data that a conversational language model uses to formulate a response to the user's question.
131
+
**Key points**:
132
+
133
+
+`content` is a JSON array. It's a single string composed of the most relevant documents (or chunks) found in the search index, given the query and chat history inputs. This array is your grounding data that a conversational language model uses to formulate a response to the user's question.
136
134
137
-
The `maxOutputSize` property on the knowledge agent determines the length of the string. We recommend 5,000 tokens.
135
+
+ text is the only valid value for type, and the text consists of the reference ID of the chunk (used for citation purposes), and any fields specified in the semantic configuration of the target index. In this example, you should assume the semantic configuration in the target index has a "title" field, a "terms" field, and a "content" filed.
138
136
139
-
Fields in the content `text` response string include the ref_id and semantic configuration fields: `title`, `terms`, `content`.
137
+
> [!NOTE]
138
+
> The `maxOutputSize` property on the [knowledge agent](search-agentic-retrieval-how-to-create.md) determines the length of the string. We recommend 5,000 tokens.
140
139
141
140
## Review the activity array
142
141
@@ -154,36 +153,53 @@ Output includes:
154
153
Here's an example of an activity array.
155
154
156
155
```json
157
-
"activity": [
156
+
"activity": [
158
157
{
159
158
"type": "ModelQueryPlanning",
160
159
"id": 0,
161
-
"inputTokens": 1270,
162
-
"outputTokens": 221
160
+
"inputTokens": 1261,
161
+
"outputTokens": 270
163
162
},
164
163
{
165
164
"type": "AzureSearchQuery",
166
165
"id": 1,
167
-
"targetIndex": "myindex",
166
+
"targetIndex": "earth_at_night",
168
167
"query": {
169
-
"search": "impact of prior authorization process on out-of-pocket costs",
168
+
"search": "suburban belts December brightening urban cores comparison",
170
169
"filter": null
171
170
},
172
-
"queryTime": "2025-04-25T16:40:08.811Z",
173
-
"count": 27,
174
-
"elapsedMs": 623
171
+
"queryTime": "2025-05-30T21:23:25.944Z",
172
+
"count": 0,
173
+
"elapsedMs": 600
175
174
},
176
175
{
177
176
"type": "AzureSearchQuery",
178
177
"id": 2,
179
-
"targetIndex": "myindex",
178
+
"targetIndex": "earth_at_night",
180
179
"query": {
181
-
"search": "copayment expectations for in-network services",
180
+
"search": "Phoenix nighttime street grid visibility from space",
182
181
"filter": null
183
182
},
184
-
"queryTime": "2025-04-25T16:40:08.955Z",
185
-
"count": 22,
186
-
"elapsedMs": 556
183
+
"queryTime": "2025-05-30T21:23:26.128Z",
184
+
"count": 2,
185
+
"elapsedMs": 161
186
+
},
187
+
{
188
+
"type": "AzureSearchQuery",
189
+
"id": 3,
190
+
"targetIndex": "earth_at_night",
191
+
"query": {
192
+
"search": "interstate visibility from space midwestern cities",
193
+
"filter": null
194
+
},
195
+
"queryTime": "2025-05-30T21:23:26.277Z",
196
+
"count": 0,
197
+
"elapsedMs": 147
198
+
},
199
+
{
200
+
"type": "AzureSearchSemanticRanker",
201
+
"id": 4,
202
+
"inputTokens": 2622
187
203
}
188
204
],
189
205
```
@@ -204,39 +220,21 @@ Here's an example of the references array.
0 commit comments