Implement information extraction solutions 5.1 Build retrieval and grounding pipelines
You build an Azure Function that serves as a Custom Web API skill in an Azure AI Search…
Study guide skill: Implement enrichment by using custom or built-in skills for text, images, and layout
Question B3-027
You build an Azure Function that serves as a Custom Web API skill in an Azure AI Search skillset. What must the function return for each batch of records that it receives?
Select one answer.
Answer: B
The response must have a top-level values array with the same number of objects as the request, and each object needs a recordId, a data object with the enrichments, and errors and warnings properties (which can be null). Order isn't important, because the indexer correlates records by recordId, and records with unknown IDs are discarded. A merged single object or missing errors and warnings properties breaks this contract.
Deep dive
How it works
A Custom Web API skill is a contract between the indexer and your endpoint. The indexer sends a JSON body with a values array of up to batchSize records (the default is 1,000). Each record has a recordId, a unique string, and a data object whose fields match the skill's input names.
Your function's response must follow these rules:
- Return only a JSON payload. The indexer checks the Content-Type header.
- Include a top-level values array with the same number of objects as the request.
- Give each object a recordId, a data object whose fields match the skill's output names, an errors array and a warnings array. errors and warnings are required but can be null. Their contents are added to the indexer's execution history.
The order of objects doesn't matter, in the request or the response. The indexer correlates records by recordId, and any record whose recordId wasn't in the original request is discarded. So your function can process records in parallel and return them in any order, as long as each one keeps its ID.
Two more details help in practice. If the response has a success status code but isn't application/json, it's treated as invalid. And degreeOfParallelism controls how many calls the indexer makes in parallel, so you can lower it if your function struggles under load.
The other options, and when you'd use them
- Values in the same order, without recordId: recordId is how the indexer matches enrichments to documents, and order isn't important. Leaving out IDs breaks the matching.
- Leave out errors and warnings unless a record fails: Both properties are required on every object. When there's nothing to report, set them to null.
- A single merged JSON object: The response must be a values array with one object per input record, not one combined result.
Exam tip
Remember the response shape: values[] with recordId + data + errors + warnings on each record, the same count as the request, in any order.
References
Last reviewed: