Plugin sample built using Semantic Kernel that summarises a given text from Bing Web Search. Tested with Semantic Kernel beta8!
This sample plugin uses the Bing Web Search API to search for a given text and summarise the results. It is adapted from the Bing Web Search sample plugin included in the Chat Copilot sample repository. It accomplishes this by using native and semantic functions to perform the following tasks:
- Search for a given text using the Bing Web Search API.
- Extract the top 'X' results from the search.
- Summarise the results and present back to the end user.
- Visual Studio or Visual Studio Code
- .NET 6
- Azure Functions Core Tools
- Install the recommended extensions
- Open
appsettings.json
and configure thekernel
andaiPlugin
objects.
Configure an OpenAI endpoint
- Copy settings.json.openai-example to
./appsettings.json
- Edit the
kernel
object to add your OpenAI endpoint configuration - Edit the
aiPlugin
object to define the properties that get exposed in the ai-plugin.json file
'OR'
Configure an Azure OpenAI endpoint
- Copy settings.json.azure-example to
./appsettings.json
- Edit the
kernel
object to add your Azure OpenAI endpoint configuration - Edit the
aiPlugin
object to define the properties that get exposed in the ai-plugin.json file
- Copy local.settings.json.example to
./azure-function/local.settings.json
- Edit the
Values
object to add your OpenAI endpoint configuration in theapiKey
andBingApiKey
properties
To run the Azure Functions application just hit F5
from Visual Studio or Visual Studio Code.
To build and run the Azure Functions application from a terminal use the following commands:
cd azure-function
dotnet build
cd bin/Debug/net6.0
func host start
Swagger is automatically included in the Azure Functions application. To access the Swagger UI, navigate to http://localhost:7071/swagger
in your browser.
- Select the
WebSearch
function and clickTry it out
- Enter a search term and click
Execute
The results will be displayed in theResponse body
section - Copy and paste the results and run it against the
BingSummariser
function and clickTry it out
- The results will be displayed in the
Response body
section
Run the Chat Copilot application. Click the Plugins
link (top right corner) and enter the following details:
- Select
Custom Plugin
- Select
Add
- Enter your website domain:
http://localhost:7071/TextSummarize
and selectFind manifest file
- In the Verify Plugin prompt, select
Add Plugin
- The plugin will now be available in the
Plugins
list - Enable the plugin by selecting the
Enable
button
Once the plugin is added and enabled:
- Ask the following prompt to the chat window
What is the latest sports news?
- The planner should show two steps, one for the
Search
step to search Bing and twoTextSummarize
step to summarize the results - Select
Yes
to run the planner - The results should be displayed in the chat window