Bing Entity Search sample skill for cognitive search

This custom skill finds rich and structured information about public figures, locations, or organizations.

Requirements

In addition to the common requirements described in the root README.md file, this function requires access to an Azure Bing Entity Search service.

Settings

This function requires a BING_API_KEY setting set to a valid Azure Bing Entity Search API key. If running locally, this can be set in your project's debug environment variables (go to project properties, in the debug tab). This ensures your key won't be accidentally checked in with your code. If running in an Azure function, this can be set in the application settings.

Deployment

Deploy to Azure

Sample Input:

{
    "values": [
        {
            "recordId": "foobar2",
            "data":
            {
                "name":  "Pablo Picasso"
            }
        },
        {
            "recordId": "foo1",
            "data":
            {
                "name":  "Microsoft"
            }
        }
    ]
}

Sample Output:

{
    "values": [
        {
            "recordId": "foobar2",
            "data": {
                "name": "Pablo Picasso",
                "description": "Pablo Ruiz Picasso was a Spanish painter, sculptor, [...]",
                "imageUrl": "https://www.bing.com/th?id=AMMS_e8c719d1c081e929c60a2f112d659d96&w=110&h=110&c=12&rs=1&qlt=80&cdv=1&pid=16.2",
                "url": "http://en.wikipedia.org/wiki/Pablo_Picasso",
                "licenseAttribution": "Text under CC-BY-SA license",
                "entities": "{...}"
            }
        },
        "..."
    ]
}

Sample Skillset Integration

In order to use this skill in a cognitive search pipeline, you'll need to add a skill definition to your skillset. Here's a sample skill definition for this example (inputs and outputs should be updated to reflect your particular scenario and skillset environment):

{
    "@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
    "description": "Our new Bing entity search custom skill",
    "context": "/document/merged_content/organizations/*",
    "uri": "[AzureFunctionEndpointUrl]/api/entity-search?code=[AzureFunctionDefaultHostKey]",
    "batchSize": 1,
    "inputs": [
        {
            "name": "name",
            "source": "/document/merged_content/organizations/*",
            "sourceContext": null,
            "inputs": []
        }
    ],
    "outputs": [
        {
            "name": "description",
            "targetName": "description"
        }
    ],
    "httpHeaders": {}
}