Azure Cognitive Search Enrichment with Custom Code

Enriching Azure Cognitive Search with Custom Code

Question

You have a set of documents.

You want to enrich the information in these documents before using this information in your searchable index.

You use enrichment pipelines in Azure for this purpose.

You review the built-in skills in Azure, like sentiment analysis and key-phrase extraction.

However, you realize that your specific needs cannot be addressed using the built-in skills in Azure.

Hence, you decide to call your own code through a web API, as part of the enrichment process in Azure cognitive search.

Review the JSON code given below and complete it by choosing the parameters and values from the answer choices given below.

[select three choices]

{ "@odata.type": "............................................................",  "description": "Call a custom code to identify all image files in the data source", "uri": "https://indexer-e2e-webskill.azurewebsites.net/api/InvokeTextAnalyticsV3?code=tstskill", "httpHeaders": { "Ocp-Apim-Subscription-Key": "key1" }, "context": "/document/store/*", "............................................................": [ { "name": "query", "source": "/document/store/*" } ], "............................................................": [ { "name": "filetype", "targetName": "filextension" } ] } 

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Correct Answers: A, B and E

Here is the completed JSON response.

<pre>{

"@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",

"description": "Call a custom code to identify all image files in the data source",

"uri": "https://indexer-e2e-webskill.azurewebsites.net/api/InvokeTextAnalyticsV3?code=tstskill",

"httpHeaders": {

"Ocp-Apim-Subscription-Key": "key1"

},

"context": "/document/store/*",

"inputs": [

{

"name": "query",

"source": "/document/store/*"

}

],

"outputs": [

{

"name": "filetype",

"targetName": "filextension"

}

]

}

</pre>Option A is correct because, as per the given scenario, a custom skill would call the custom code through a WebApiSkill (#Microsoft.Skills.Custom.WebApiSkill) referencing the url.

Option B is correct because the “inputs” parameter will source documents to the Web API call for the custom skill.

In this case, the input source is /document/store.

Option C is incorrect because the requirement here is to use a custom skill.

However, #Microsoft.Skills.Text.EntityRecognitionSkill is a built-in skill.

Option D is incorrect because the datastore is not a correct parameter for the custom skill.

Option E is correct because “outputs” define the target where the custom skill output is written.

In this case, it is written to a file.

Reference:

To learn more about how to add a custom skill to the cognitive search enrichment pipeline, use the link given below:

The JSON code is defining a skillset that will be used to enrich a set of documents in Azure cognitive search. The skillset includes multiple skills that can be executed in sequence. The JSON code provided is incomplete and requires the user to fill in the missing parameters.

The following are the missing parameters and their values that need to be selected from the answer choices:

  1. "@odata.type": "A. #Microsoft.Skills.Custom.WebApiSkill" This parameter specifies the type of skill that is being used. In this case, the user wants to call a custom code through a web API, so they need to select the value "A. #Microsoft.Skills.Custom.WebApiSkill".

  2. "inputs": [ { "name": "query", "source": "/document/store/" }] This parameter specifies the input to the custom code that is being called through the web API. In this case, the user wants to pass a query parameter to the custom code, so they need to select the value "B. inputs" and then specify the parameter name as "query" and the source as "/document/store/".

  3. "outputs": [ { "name": "filetype", "targetName": "filextension" }] This parameter specifies the output of the custom code that is being called through the web API. In this case, the user wants to extract the file type of the image files in the data source, so they need to select the value "E. outputs" and then specify the output name as "filetype" and the target name as "filextension".

The remaining parameters in the JSON code are already filled in:

  • "description": "Call a custom code to identify all image files in the data source" - This parameter provides a description of what the skillset does.
  • "uri": "https://indexer-e2e-webskill.azurewebsites.net/api/InvokeTextAnalyticsV3?code=tstskill" - This parameter specifies the URI of the web API that the custom code is calling.
  • "httpHeaders": {"Ocp-Apim-Subscription-Key": "key1"} - This parameter specifies the subscription key for the API Management service.
  • "context": "/document/store/" - This parameter specifies the location of the documents that are being enriched. In this case, the documents are in a data store. The source path "/document/store/" indicates that all documents in the data store will be processed.