mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
#3169 Use `new KernelBuilder()` instead of `Kernel.Builder` --------- Co-authored-by: Dmytro Struk <[email protected]> Co-authored-by: Roger Barreto <[email protected]>
Graph API Plugin Example
Important
This sample will be removed in a future release. If you are looking for samples that demonstrate how to use Semantic Kernel, please refer to the sample folders in the root python and dotnet folders.
This example program demonstrates how to use the Microsoft Graph API plugins with the Semantic Kernel.
Setup
- Create an
appsettings.Development.jsonfile next toappsettings.json.- The
appsettings.Development.jsonfile should be ignored by git and will not be checked in by default.
- The
- Set your API Keys
- This example can use either Azure OpenAI or OpenAI models for summarization.
- In your
appsettings.Development.jsonfill out theOpenAIand/orAzureOpenAIsections with a unique service id and your API key (you can use any service id, it's only a string that allows to distinguish multiple services).
- If you have not already, register an application with the Microsoft identity platform.
- Select
Mobile and desktop applicationsas platform type, and the Redirect URI will behttp://localhost - It is recommended you use the
Personal Microsoft accountsaccount type for this sample. - Make sure the API permissions include the scopes outines in your
appsettings.json(e.g. Mail.Send, ...).
- Select
- Update the
MsGraphsections in yourappsettings.jsonwith your application registrations IDs and parameters. - Update the
OneDrivePathToFileto point to a text file that exists in your OneDrive.- This file will be used as content to summarize in the example.
Example appsettings.Development.json:
{
"MsGraph": {
"ClientId": "YOUR_APPLICATION_CLIENTID",
"RedirectUri": "http://localhost"
},
"OneDrivePathToFile": "Documents/MyFile.txt",
"OpenAI": {
"ServiceId": "gpt-3.5-turbo",
"ApiKey": "YOUR_OPENAPI_KEY"
},
"AzureOpenAI": {
"ServiceId": "gpt-35-turbo",
"DeploymentName": "gpt-35-turbo",
"Endpoint": "YOUR_AZURE_OPENAI_ENDPOINT (e.g. https://contoso.openai.azure.com/",
"ApiKey": "YOUR_AZURE_OPENAPI_KEY"
}
}