page_type | languages | products | name | description | azureDeploy | ||||
---|---|---|---|---|---|---|---|---|---|
sample |
|
|
Get geo-point from name sample skill for AI Search |
This custom skill takes a string input that represents a location (city, country, address or point of interest) and returns a geo-point. |
This custom skill takes a string input that represents a location (city, country, address or point of interest) and returns a geo-point with the coordinates for that location.
In addition to the common requirements described in the root README.md
file, this function requires access to an Azure Maps service.
This function requires a AZUREMAPS_APP_KEY
setting set to a valid Azure Maps 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.
{
"values":
[
{
"recordId": "foo1",
"data": { "address": "Guatemala City"}
},
{
"recordId": "bar2",
"data": { "address": "20019 8th Dr SE, Bothell WA, 98012"}
}
]
}
{
"values":
[
{
"recordId": "foo1",
"data": {
"mainGeoPoint": {
"type": "Point",
"coordinates": [
-90.51557,
14.60043
]
},
"results": [
{
"type": "POI",
"score": "4.203",
"position": {
"lat": "14.60043",
"lon": "-90.51557"
}
},
{
"type": "POI",
"score": "4.048",
"position": {
"lat": "10.3132",
"lon": "-85.7697"
}
},
"..."
]
},
"errors": [],
"warnings": []
},
"..."
]
}
In order to use this skill in a AI 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": "Geo point from name",
"context": "/document/merged_content/locations/*",
"uri": "[AzureFunctionEndpointUrl]/api/geo-point-from-name?code=[AzureFunctionDefaultHostKey]",
"batchSize": 1,
"inputs": [
{
"name": "address",
"source": "/document/merged_content/locations/*"
}
],
"outputs": [
{
"name": "mainGeoPoint",
"targetName": "geopoint"
}
],
"httpHeaders": {}
}