AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap
1.0.0-preview-5
See the version list below for details.
dotnet add package AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap --version 1.0.0-preview-5
NuGet\Install-Package AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap -Version 1.0.0-preview-5
<PackageReference Include="AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap" Version="1.0.0-preview-5" />
paket add AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap --version 1.0.0-preview-5
#r "nuget: AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap, 1.0.0-preview-5"
// Install AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap as a Cake Addin #addin nuget:?package=AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap&version=1.0.0-preview-5&prerelease // Install AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap as a Cake Tool #tool nuget:?package=AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap&version=1.0.0-preview-5&prerelease
SuggestionAddressPlugin
The AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap
This component offers a streamlined solution for discovering based on suggestions such as hotels, coffee shops, restaurants, and petrol stations.
Building a SuggestionAddressPlugin
We'll take you through the steps of constructing a plugin for location-based search suggestions.
Prerequisites
Install AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Web.BingMap package from nuget server
Before you begin building the plugin, make sure you have the following prerequisites in place:
Azure Bing Maps API Key: Obtain an API key from Azure Bing Maps to gain access to location data.
Create an Instance of SuggestionAddressPlugin
Here's an example code snippet:
var suggestionAddressPlugin = new SuggestionAddressPlugin("Bing Map-Key");
IncludeCoordinates
SuggestionAddressPlugin is its optional parameter, includeCoordinates. When set to true, this parameter enables the plugin to provide not only address suggestions but also corresponding geographic coordinates.
Here's an example code snippet:
var suggestionAddressPlugin = new SuggestionAddressPlugin("Bing Map-Key",true);
Method Signature
public async Task<string> SearchSuggestionAsync([Description("suggestion")] string suggestion, [Description("city name")] string city)
Parameters
suggestion: A string parameter that is meant to receive input related to address suggestions.
city: A string parameter that is intended for specifying the city associated with the search.
Return Value
The method returns a Task<string>, indicating that the operation is asynchronous and will result in a string being returned. The returned string is expected to represent a JSON collection containing address-related information. Within this JSON collection, you can find details such as Longitude, Latitude, and Location information associated with the suggested addresses
Example Usage
//Add the location search plugin
var location = new SuggestionAddressPlugin("Bing map key",true);
builder.Plugins.AddFromObject(location);
//Create kernel function
var suggestionKernelFunction =
kernel.Plugins.GetFunction(nameof(SuggestionAddressPlugin), "SearchSuggestion");
//Trigger invoke function
var result1 = await kernel.InvokeAsync(suggestionKernelFunction, new KernelArguments
{
{ "suggestion", "restaurants" },
{ "city", "Thanjavur" }
});
Console.WriteLine(result1.GetValue<string>());
Output
JSON Response
[
{
"Longitude": 79.134483,
"Latitude": 10.784559,
"Location": "Big Temple Road, Near Brihadeeeswara Temple, Pudupattinam Thanjavur, Thanjavur Railway Station Area, Thanjavur 613001, Tamil Nadu"
},
{
"Longitude": 79.134005,
"Latitude": 10.784972,
"Location": "Thiruvalluvar Salai, Thanjavur Railway Station Area, Thanjavur 613001, Tamil Nadu"
},
{
"Longitude": 79.133303,
"Latitude": 10.781487,
"Location": "Big Temple Road, Near Swetha Complex, Membalam Thanjavur, Membalam, Thanjavur 613007, Tamil Nadu"
},
{
"Longitude": 79.133807,
"Latitude": 10.786525,
"Location": "Thanjavur Palace Area, Thanjavur 613001, Tamil Nadu"
},
{
"Longitude": 79.133546,
"Latitude": 10.78647,
"Location": "South Rampart Road, Thanjavur Palace Area, Thanjavur 613001, Tamil Nadu"
},
{
"Longitude": 79.133366,
"Latitude": 10.780889,
"Location": "Big Temple Road, Near Taluka Office, Pudupattinam Thanjavur, Thanjavur Railway Station Area, Thanjavur 613001, Tamil Nadu"
},
{
"Longitude": 79.134151,
"Latitude": 10.786354,
"Location": "S Rampart Road, Thanjavur Palace Area, Thanjavur 613001, Tamil Nadu"
},
{
"Longitude": 79.132854,
"Latitude": 10.780708,
"Location": "Big Temple Road, Near Taluka Office, Pudupattinam Thanjavur, Thanjavur Railway Station Area, Thanjavur 613001, Tamil Nadu"
},
{
"Longitude": 79.133112,
"Latitude": 10.780386,
"Location": "Medical College Road, South Rampart, Thanjavur Railway Station Area, Thanjavur 613001, Tamil Nadu"
},
{
"Longitude": 79.134941,
"Latitude": 10.786219,
"Location": "Thiruvalluvar Theatre Lane, Near Hotel Pla Inn, Thanjavur Palace Area, Thanjavur 613001, Tamil Nadu"
}
]
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Azure.Maps.Search (>= 1.0.0-beta.4)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.SemanticKernel (>= 1.0.1)
- Microsoft.SemanticKernel.Plugins.Web (>= 1.0.1-alpha)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.0.0-preview-6 | 103 | 1/22/2024 | |
1.0.0-preview-5 | 226 | 1/3/2024 | |
1.0.0-preview-4 | 64 | 1/3/2024 | |
1.0.0-preview-3 | 67 | 1/3/2024 | |
1.0.0-preview-2 | 62 | 1/3/2024 | |
1.0.0-preview-1 | 86 | 1/3/2024 |