From 5b1f9a81d50d4adc31f23b43f383f95bfa258069 Mon Sep 17 00:00:00 2001 From: "newton.mallick" Date: Thu, 22 Jun 2023 15:04:25 +0530 Subject: [PATCH 1/9] Updated the SK nuget package to latest version in the notebook samples for dotnet. --- samples/notebooks/dotnet/00-getting-started.ipynb | 2 +- .../dotnet/01-basic-loading-the-kernel.ipynb | 2 +- .../dotnet/02-running-prompts-from-file.ipynb | 2 +- .../dotnet/03-semantic-function-inline.ipynb | 11 ++++++++++- .../notebooks/dotnet/04-context-variables-chat.ipynb | 3 +-- samples/notebooks/dotnet/05-using-the-planner.ipynb | 2 +- .../notebooks/dotnet/06-memory-and-embeddings.ipynb | 2 +- samples/notebooks/dotnet/07-DALL-E-2.ipynb | 2 +- .../notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb | 3 ++- 9 files changed, 19 insertions(+), 10 deletions(-) diff --git a/samples/notebooks/dotnet/00-getting-started.ipynb b/samples/notebooks/dotnet/00-getting-started.ipynb index 9dd2bd42024d..14e791a1309f 100644 --- a/samples/notebooks/dotnet/00-getting-started.ipynb +++ b/samples/notebooks/dotnet/00-getting-started.ipynb @@ -61,7 +61,7 @@ "outputs": [], "source": [ "// Import Semantic Kernel\n", - "#r \"nuget: Microsoft.SemanticKernel, 0.15.230531.5-preview\"" + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"" ] }, { diff --git a/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb b/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb index 3ec75aaf7f81..e5d2c14b935a 100644 --- a/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb +++ b/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb @@ -32,7 +32,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.15.230531.5-preview\"" + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"" ] }, { diff --git a/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb b/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb index 5517066f4cc6..0ec4ecb70583 100644 --- a/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb +++ b/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb @@ -90,7 +90,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.15.230531.5-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "\n", diff --git a/samples/notebooks/dotnet/03-semantic-function-inline.ipynb b/samples/notebooks/dotnet/03-semantic-function-inline.ipynb index 07f856b685db..48ed64b3ceac 100644 --- a/samples/notebooks/dotnet/03-semantic-function-inline.ipynb +++ b/samples/notebooks/dotnet/03-semantic-function-inline.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -30,6 +31,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -49,7 +51,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.15.230531.5-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "\n", @@ -69,6 +71,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -96,6 +99,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -127,6 +131,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -155,6 +160,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -180,6 +186,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -213,6 +220,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -273,6 +281,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/samples/notebooks/dotnet/04-context-variables-chat.ipynb b/samples/notebooks/dotnet/04-context-variables-chat.ipynb index ca4120ad5c80..f2a678f989ed 100644 --- a/samples/notebooks/dotnet/04-context-variables-chat.ipynb +++ b/samples/notebooks/dotnet/04-context-variables-chat.ipynb @@ -34,8 +34,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.15.230531.5-preview\"\n", - "\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", "#!import config/Settings.cs\n", "\n", "using Microsoft.SemanticKernel;\n", diff --git a/samples/notebooks/dotnet/05-using-the-planner.ipynb b/samples/notebooks/dotnet/05-using-the-planner.ipynb index 5461a35faf74..ca651183b29d 100644 --- a/samples/notebooks/dotnet/05-using-the-planner.ipynb +++ b/samples/notebooks/dotnet/05-using-the-planner.ipynb @@ -25,7 +25,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.15.230531.5-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "#!import config/Utils.cs\n", diff --git a/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb b/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb index 0f06ceba9b70..8a2390a741f0 100644 --- a/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb +++ b/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.15.230531.5-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "\n", diff --git a/samples/notebooks/dotnet/07-DALL-E-2.ipynb b/samples/notebooks/dotnet/07-DALL-E-2.ipynb index c645706de47b..c45130662f6d 100644 --- a/samples/notebooks/dotnet/07-DALL-E-2.ipynb +++ b/samples/notebooks/dotnet/07-DALL-E-2.ipynb @@ -33,7 +33,7 @@ "source": [ "// Usual setup: importing Semantic Kernel SDK and SkiaSharp, used to display images inline.\n", "\n", - "#r \"nuget: Microsoft.SemanticKernel, 0.15.230531.5-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", "#r \"nuget: SkiaSharp, 2.88.3\"\n", "\n", "#!import config/Settings.cs\n", diff --git a/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb b/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb index 7f30f82cd0b6..fccb86e6a548 100644 --- a/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb +++ b/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb @@ -28,6 +28,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -55,7 +56,7 @@ "source": [ "// Usual setup: importing Semantic Kernel SDK and SkiaSharp, used to display images inline.\n", "\n", - "#r \"nuget: Microsoft.SemanticKernel, 0.15.230531.5-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", "#r \"nuget: SkiaSharp, 2.88.3\"\n", "\n", "#!import config/Settings.cs\n", From cf3ac2f2d6a253a526fa8e706ccc337daff5ccff Mon Sep 17 00:00:00 2001 From: "newton.mallick" Date: Mon, 26 Jun 2023 10:59:47 +0530 Subject: [PATCH 2/9] Added bing seach notebook --- .gitignore | 3 +- .../dotnet/09-BingSearch-using-kernel.ipynb | 320 ++++++++++++++++++ 2 files changed, 322 insertions(+), 1 deletion(-) create mode 100644 samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb diff --git a/.gitignore b/.gitignore index 431046016861..530b14105f74 100644 --- a/.gitignore +++ b/.gitignore @@ -476,4 +476,5 @@ playwright-report/ # Static Web App deployment config swa-cli.config.json -**/copilot-chat-app/webapp/build \ No newline at end of file +**/copilot-chat-app/webapp/build +**/copilot-chat-app/webapp/node_modules \ No newline at end of file diff --git a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb new file mode 100644 index 000000000000..c0c91bbd6d84 --- /dev/null +++ b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb @@ -0,0 +1,320 @@ +{ + "cells": [ + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# BingSearch using Kernel \n", + "\n", + "This notebook explains how to integragte BingSearch feature in your Semantic Kernel to get latest information from the internet.\n", + "\n", + "To using BingSeach you simply need *Bing Search Api Key* . You can get the api by creating [Bing Search resource](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource) in Azure . \n", + "\n", + "In free Instance you will get *1000* transactions per month and only 3 Transactions per second valid .\n", + "\n", + "Check other pricing from [here](https://www.microsoft.com/en-us/bing/apis/pricing).\n", + "\n", + "To learn more read the follwing [documenation](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/overview)\n" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Prepare a semantic kernel instance first, loading also the AI backend settings defined in the [Setup notebook](0-AI-settings.ipynb):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, + "outputs": [], + "source": [ + "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel.Skills.Web, 0.16.230615.1-preview\"\n", + "\n", + "#!import config/Settings.cs\n", + "#!import config/Utils.cs\n", + "\n", + "using Microsoft.SemanticKernel;\n", + "using Microsoft.SemanticKernel.CoreSkills;\n", + "using Microsoft.SemanticKernel.SkillDefinition;\n", + "using Microsoft.SemanticKernel.Orchestration;\n", + "using Microsoft.SemanticKernel.Planning;\n", + "using Microsoft.SemanticKernel.Planning.Sequential;\n", + "using Microsoft.SemanticKernel.TemplateEngine;\n", + "var builder = new KernelBuilder();\n", + "\n", + "// Configure AI backend used by the kernel\n", + "var (useAzureOpenAI, model, azureEndpoint, apiKey, orgId) = Settings.LoadFromFile();\n", + "\n", + "if (useAzureOpenAI)\n", + " builder.WithAzureTextCompletionService(model, azureEndpoint, apiKey);\n", + "else\n", + " builder.WithOpenAITextCompletionService(model, apiKey, orgId);\n", + "\n", + "var kernel = builder.Build();" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You requried the following namespaces to use bing search ." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, + "outputs": [], + "source": [ + "using Microsoft.SemanticKernel.Skills.Web;\n", + "using Microsoft.SemanticKernel.Skills.Web.Bing;" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, + "outputs": [], + "source": [ + "// Load Bing skill\n", + "//Uncomment the Example \n", + "using (var bingConnector = new BingConnector(\"17172014d4754369bc9a422b9bae1345\"))\n", + "{\n", + "kernel.ImportSkill(new WebSearchEngineSkill(bingConnector), \"bing\");\n", + "//await Example1Async(kernel);\n", + "//await Example2Async(kernel);\n", + "//await Example3Async(kernel);\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, + "outputs": [], + "source": [ + "private static async Task Example1Async(IKernel kernel)\n", + "{\n", + " Console.WriteLine(\"======== Bing Search Skill ========\");\n", + "\n", + " // Run\n", + " var question = \"What's the largest building in the world?\";\n", + " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", + " // var googleResult = await kernel.Func(\"google\", \"search\").InvokeAsync(question);\n", + "\n", + " Console.WriteLine(question);\n", + " Console.WriteLine(\"----\");\n", + " Console.WriteLine(bingResult);\n", + " Console.WriteLine();\n", + "\n", + " /* OUTPUT:\n", + "\n", + " What's the largest building in the world?\n", + " ----\n", + " The Aerium near Berlin, Germany is the largest uninterrupted volume in the world, while Boeing's\n", + " factory in Everett, Washington, United States is the world's largest building by volume. The AvtoVAZ\n", + " main assembly building in Tolyatti, Russia is the largest building in area footprint.\n", + " ----\n", + " The Aerium near Berlin, Germany is the largest uninterrupted volume in the world, while Boeing's\n", + " factory in Everett, Washington, United States is the world's ...\n", + " */\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, + "outputs": [], + "source": [ + "private static async Task Example2Async(IKernel kernel)\n", + "{\n", + "\n", + " //Use the following function in VS only\n", + " string question = await InteractiveKernel.GetInputAsync(\"Please aSk your question\"); \n", + " //Console.ReadLine();\n", + " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", + " \n", + "\n", + " Console.WriteLine(bingResult);\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, + "outputs": [], + "source": [ + "\n", + "private static async Task Example3Async(IKernel kernel)\n", + "{\n", + "\n", + "Console.WriteLine(\"======== Use Search Skill to answer user questions ========\");\n", + "\n", + "const string SemanticFunction = @\"Answer questions only when you know the facts or the information is provided.\n", + "When you don't have sufficient information you reply with a list of commands to find the information needed.\n", + "When answering multiple questions, use a bullet point list.\n", + "Note: make sure single and double quotes are escaped using a backslash char.\n", + "\n", + "[COMMANDS AVAILABLE]\n", + "- bing.search\n", + "\n", + "[INFORMATION PROVIDED]\n", + "{{ $externalInformation }}\n", + "\n", + "[EXAMPLE 1]\n", + "Question: what's the biggest lake in Italy?\n", + "Answer: Lake Garda, also known as Lago di Garda.\n", + "\n", + "[EXAMPLE 2]\n", + "Question: what's the biggest lake in Italy? What's the smallest positive number?\n", + "Answer:\n", + "* Lake Garda, also known as Lago di Garda.\n", + "* The smallest positive number is 1.\n", + "\n", + "[EXAMPLE 3]\n", + "Question: what's Ferrari stock price ? Who is the current number one female tennis player in the world?\n", + "Answer:\n", + "{{ '{{' }} bing.search \"\"what\\\\'s Ferrari stock price?\"\" {{ '}}' }}.\n", + "{{ '{{' }} bing.search \"\"Who is the current number one female tennis player in the world?\"\" {{ '}}' }}.\n", + "\n", + "[END OF EXAMPLES]\n", + "\n", + "[TASK]\n", + "Question: {{ $input }}.\n", + "Answer: \";\n", + "\n", + "var questions = \"Who is the most followed person on TikTok right now? What's the exchange rate EUR:USD?\";\n", + "Console.WriteLine(questions);\n", + "\n", + "var oracle = kernel.CreateSemanticFunction(SemanticFunction, maxTokens: 200, temperature: 0, topP: 1);\n", + "var context = kernel.CreateNewContext();\n", + "context[\"externalInformation\"] = \"\";\n", + "var answer = await oracle.InvokeAsync(questions, context);\n", + "\n", + "// If the answer contains commands, execute them using the prompt renderer.\n", + "if (answer.Result.Contains(\"bing.search\", StringComparison.OrdinalIgnoreCase))\n", + " {\n", + " var promptRenderer = new PromptTemplateEngine();\n", + "\n", + " Console.WriteLine(\"---- Fetching information from Bing...\");\n", + " var information = await promptRenderer.RenderAsync(answer.Result, context);\n", + "\n", + " Console.WriteLine(\"Information found:\");\n", + " Console.WriteLine(information);\n", + "\n", + " // The rendered prompt contains the information retrieved from search engines\n", + " context[\"externalInformation\"] = information;\n", + "\n", + " // Run the semantic function again, now including information from Bing\n", + " answer = await oracle.InvokeAsync(questions, context);\n", + " }\n", + " else\n", + " {\n", + " Console.WriteLine(\"AI had all the information, no need to query Bing.\");\n", + " }\n", + "\n", + "Console.WriteLine(\"---- ANSWER:\");\n", + "Console.WriteLine(answer);\n", + "\n", + " /* OUTPUT:\n", + "\n", + " Who is the most followed person on TikTok right now? What's the exchange rate EUR:USD?\n", + " ---- Fetching information from Bing...\n", + " Information found:\n", + "\n", + " Khaby Lame is the most-followed user on TikTok. This list contains the top 50 accounts by number\n", + " of followers on the Chinese social media platform TikTok, which was merged with musical.ly in 2018.\n", + " [1] The most-followed individual on the platform is Khaby Lame, with over 153 million followers..\n", + " EUR – Euro To USD – US Dollar 1.00 Euro = 1.10 37097 US Dollars 1 USD = 0.906035 EUR We use the\n", + " mid-market rate for our Converter. This is for informational purposes only. You won’t receive this\n", + " rate when sending money. Check send rates Convert Euro to US Dollar Convert US Dollar to Euro..\n", + " ---- ANSWER:\n", + "\n", + " * The most followed person on TikTok right now is Khaby Lame, with over 153 million followers.\n", + " * The exchange rate for EUR to USD is 1.1037097 US Dollars for 1 Euro.\n", + " */\n", + "}" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (C#)", + "language": "C#", + "name": ".net-csharp" + }, + "language_info": { + "name": "polyglot-notebook" + }, + "orig_nbformat": 4, + "polyglot_notebook": { + "kernelInfo": { + "defaultKernelName": "csharp", + "items": [ + { + "aliases": [], + "name": "csharp" + } + ] + } + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} From 5423e5f0451453c46d84114128fe3fc31c9816c6 Mon Sep 17 00:00:00 2001 From: "newton.mallick" Date: Thu, 29 Jun 2023 12:33:17 +0530 Subject: [PATCH 3/9] Update sk package to 0.17.230626.1-preview --- .../notebooks/dotnet/00-getting-started.ipynb | 2 +- .../dotnet/01-basic-loading-the-kernel.ipynb | 2 +- .../dotnet/02-running-prompts-from-file.ipynb | 2 +- .../dotnet/03-semantic-function-inline.ipynb | 2 +- .../dotnet/04-context-variables-chat.ipynb | 2 +- .../dotnet/05-using-the-planner.ipynb | 2 +- .../dotnet/06-memory-and-embeddings.ipynb | 2 +- samples/notebooks/dotnet/07-DALL-E-2.ipynb | 2 +- .../dotnet/08-chatGPT-with-DALL-E-2.ipynb | 2 +- .../09-BingSearch-using-kernel-prince.ipynb | 320 ------------------ .../dotnet/09-BingSearch-using-kernel.ipynb | 4 +- 11 files changed, 11 insertions(+), 331 deletions(-) delete mode 100644 samples/notebooks/dotnet/09-BingSearch-using-kernel-prince.ipynb diff --git a/samples/notebooks/dotnet/00-getting-started.ipynb b/samples/notebooks/dotnet/00-getting-started.ipynb index 14e791a1309f..e7aafd66d1fe 100644 --- a/samples/notebooks/dotnet/00-getting-started.ipynb +++ b/samples/notebooks/dotnet/00-getting-started.ipynb @@ -61,7 +61,7 @@ "outputs": [], "source": [ "// Import Semantic Kernel\n", - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"" + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"" ] }, { diff --git a/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb b/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb index e5d2c14b935a..0fa6310aa649 100644 --- a/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb +++ b/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb @@ -32,7 +32,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"" + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"" ] }, { diff --git a/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb b/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb index 0ec4ecb70583..a3d141291375 100644 --- a/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb +++ b/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb @@ -90,7 +90,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "\n", diff --git a/samples/notebooks/dotnet/03-semantic-function-inline.ipynb b/samples/notebooks/dotnet/03-semantic-function-inline.ipynb index 48ed64b3ceac..b3e949fdc3dd 100644 --- a/samples/notebooks/dotnet/03-semantic-function-inline.ipynb +++ b/samples/notebooks/dotnet/03-semantic-function-inline.ipynb @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "\n", diff --git a/samples/notebooks/dotnet/04-context-variables-chat.ipynb b/samples/notebooks/dotnet/04-context-variables-chat.ipynb index f2a678f989ed..32a61bb71a2c 100644 --- a/samples/notebooks/dotnet/04-context-variables-chat.ipynb +++ b/samples/notebooks/dotnet/04-context-variables-chat.ipynb @@ -34,7 +34,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "#!import config/Settings.cs\n", "\n", "using Microsoft.SemanticKernel;\n", diff --git a/samples/notebooks/dotnet/05-using-the-planner.ipynb b/samples/notebooks/dotnet/05-using-the-planner.ipynb index ca651183b29d..32ea7aecf07f 100644 --- a/samples/notebooks/dotnet/05-using-the-planner.ipynb +++ b/samples/notebooks/dotnet/05-using-the-planner.ipynb @@ -25,7 +25,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "#!import config/Utils.cs\n", diff --git a/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb b/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb index 8a2390a741f0..05c25337a714 100644 --- a/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb +++ b/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "\n", diff --git a/samples/notebooks/dotnet/07-DALL-E-2.ipynb b/samples/notebooks/dotnet/07-DALL-E-2.ipynb index c45130662f6d..9254acaf6260 100644 --- a/samples/notebooks/dotnet/07-DALL-E-2.ipynb +++ b/samples/notebooks/dotnet/07-DALL-E-2.ipynb @@ -33,7 +33,7 @@ "source": [ "// Usual setup: importing Semantic Kernel SDK and SkiaSharp, used to display images inline.\n", "\n", - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "#r \"nuget: SkiaSharp, 2.88.3\"\n", "\n", "#!import config/Settings.cs\n", diff --git a/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb b/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb index fccb86e6a548..85d875738009 100644 --- a/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb +++ b/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb @@ -56,7 +56,7 @@ "source": [ "// Usual setup: importing Semantic Kernel SDK and SkiaSharp, used to display images inline.\n", "\n", - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "#r \"nuget: SkiaSharp, 2.88.3\"\n", "\n", "#!import config/Settings.cs\n", diff --git a/samples/notebooks/dotnet/09-BingSearch-using-kernel-prince.ipynb b/samples/notebooks/dotnet/09-BingSearch-using-kernel-prince.ipynb deleted file mode 100644 index c0c91bbd6d84..000000000000 --- a/samples/notebooks/dotnet/09-BingSearch-using-kernel-prince.ipynb +++ /dev/null @@ -1,320 +0,0 @@ -{ - "cells": [ - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# BingSearch using Kernel \n", - "\n", - "This notebook explains how to integragte BingSearch feature in your Semantic Kernel to get latest information from the internet.\n", - "\n", - "To using BingSeach you simply need *Bing Search Api Key* . You can get the api by creating [Bing Search resource](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource) in Azure . \n", - "\n", - "In free Instance you will get *1000* transactions per month and only 3 Transactions per second valid .\n", - "\n", - "Check other pricing from [here](https://www.microsoft.com/en-us/bing/apis/pricing).\n", - "\n", - "To learn more read the follwing [documenation](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/overview)\n" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Prepare a semantic kernel instance first, loading also the AI backend settings defined in the [Setup notebook](0-AI-settings.ipynb):" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", - "#r \"nuget: Microsoft.SemanticKernel.Skills.Web, 0.16.230615.1-preview\"\n", - "\n", - "#!import config/Settings.cs\n", - "#!import config/Utils.cs\n", - "\n", - "using Microsoft.SemanticKernel;\n", - "using Microsoft.SemanticKernel.CoreSkills;\n", - "using Microsoft.SemanticKernel.SkillDefinition;\n", - "using Microsoft.SemanticKernel.Orchestration;\n", - "using Microsoft.SemanticKernel.Planning;\n", - "using Microsoft.SemanticKernel.Planning.Sequential;\n", - "using Microsoft.SemanticKernel.TemplateEngine;\n", - "var builder = new KernelBuilder();\n", - "\n", - "// Configure AI backend used by the kernel\n", - "var (useAzureOpenAI, model, azureEndpoint, apiKey, orgId) = Settings.LoadFromFile();\n", - "\n", - "if (useAzureOpenAI)\n", - " builder.WithAzureTextCompletionService(model, azureEndpoint, apiKey);\n", - "else\n", - " builder.WithOpenAITextCompletionService(model, apiKey, orgId);\n", - "\n", - "var kernel = builder.Build();" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "You requried the following namespaces to use bing search ." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "using Microsoft.SemanticKernel.Skills.Web;\n", - "using Microsoft.SemanticKernel.Skills.Web.Bing;" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "// Load Bing skill\n", - "//Uncomment the Example \n", - "using (var bingConnector = new BingConnector(\"17172014d4754369bc9a422b9bae1345\"))\n", - "{\n", - "kernel.ImportSkill(new WebSearchEngineSkill(bingConnector), \"bing\");\n", - "//await Example1Async(kernel);\n", - "//await Example2Async(kernel);\n", - "//await Example3Async(kernel);\n", - "}" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "private static async Task Example1Async(IKernel kernel)\n", - "{\n", - " Console.WriteLine(\"======== Bing Search Skill ========\");\n", - "\n", - " // Run\n", - " var question = \"What's the largest building in the world?\";\n", - " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", - " // var googleResult = await kernel.Func(\"google\", \"search\").InvokeAsync(question);\n", - "\n", - " Console.WriteLine(question);\n", - " Console.WriteLine(\"----\");\n", - " Console.WriteLine(bingResult);\n", - " Console.WriteLine();\n", - "\n", - " /* OUTPUT:\n", - "\n", - " What's the largest building in the world?\n", - " ----\n", - " The Aerium near Berlin, Germany is the largest uninterrupted volume in the world, while Boeing's\n", - " factory in Everett, Washington, United States is the world's largest building by volume. The AvtoVAZ\n", - " main assembly building in Tolyatti, Russia is the largest building in area footprint.\n", - " ----\n", - " The Aerium near Berlin, Germany is the largest uninterrupted volume in the world, while Boeing's\n", - " factory in Everett, Washington, United States is the world's ...\n", - " */\n", - "}" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "private static async Task Example2Async(IKernel kernel)\n", - "{\n", - "\n", - " //Use the following function in VS only\n", - " string question = await InteractiveKernel.GetInputAsync(\"Please aSk your question\"); \n", - " //Console.ReadLine();\n", - " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", - " \n", - "\n", - " Console.WriteLine(bingResult);\n", - "}" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "\n", - "private static async Task Example3Async(IKernel kernel)\n", - "{\n", - "\n", - "Console.WriteLine(\"======== Use Search Skill to answer user questions ========\");\n", - "\n", - "const string SemanticFunction = @\"Answer questions only when you know the facts or the information is provided.\n", - "When you don't have sufficient information you reply with a list of commands to find the information needed.\n", - "When answering multiple questions, use a bullet point list.\n", - "Note: make sure single and double quotes are escaped using a backslash char.\n", - "\n", - "[COMMANDS AVAILABLE]\n", - "- bing.search\n", - "\n", - "[INFORMATION PROVIDED]\n", - "{{ $externalInformation }}\n", - "\n", - "[EXAMPLE 1]\n", - "Question: what's the biggest lake in Italy?\n", - "Answer: Lake Garda, also known as Lago di Garda.\n", - "\n", - "[EXAMPLE 2]\n", - "Question: what's the biggest lake in Italy? What's the smallest positive number?\n", - "Answer:\n", - "* Lake Garda, also known as Lago di Garda.\n", - "* The smallest positive number is 1.\n", - "\n", - "[EXAMPLE 3]\n", - "Question: what's Ferrari stock price ? Who is the current number one female tennis player in the world?\n", - "Answer:\n", - "{{ '{{' }} bing.search \"\"what\\\\'s Ferrari stock price?\"\" {{ '}}' }}.\n", - "{{ '{{' }} bing.search \"\"Who is the current number one female tennis player in the world?\"\" {{ '}}' }}.\n", - "\n", - "[END OF EXAMPLES]\n", - "\n", - "[TASK]\n", - "Question: {{ $input }}.\n", - "Answer: \";\n", - "\n", - "var questions = \"Who is the most followed person on TikTok right now? What's the exchange rate EUR:USD?\";\n", - "Console.WriteLine(questions);\n", - "\n", - "var oracle = kernel.CreateSemanticFunction(SemanticFunction, maxTokens: 200, temperature: 0, topP: 1);\n", - "var context = kernel.CreateNewContext();\n", - "context[\"externalInformation\"] = \"\";\n", - "var answer = await oracle.InvokeAsync(questions, context);\n", - "\n", - "// If the answer contains commands, execute them using the prompt renderer.\n", - "if (answer.Result.Contains(\"bing.search\", StringComparison.OrdinalIgnoreCase))\n", - " {\n", - " var promptRenderer = new PromptTemplateEngine();\n", - "\n", - " Console.WriteLine(\"---- Fetching information from Bing...\");\n", - " var information = await promptRenderer.RenderAsync(answer.Result, context);\n", - "\n", - " Console.WriteLine(\"Information found:\");\n", - " Console.WriteLine(information);\n", - "\n", - " // The rendered prompt contains the information retrieved from search engines\n", - " context[\"externalInformation\"] = information;\n", - "\n", - " // Run the semantic function again, now including information from Bing\n", - " answer = await oracle.InvokeAsync(questions, context);\n", - " }\n", - " else\n", - " {\n", - " Console.WriteLine(\"AI had all the information, no need to query Bing.\");\n", - " }\n", - "\n", - "Console.WriteLine(\"---- ANSWER:\");\n", - "Console.WriteLine(answer);\n", - "\n", - " /* OUTPUT:\n", - "\n", - " Who is the most followed person on TikTok right now? What's the exchange rate EUR:USD?\n", - " ---- Fetching information from Bing...\n", - " Information found:\n", - "\n", - " Khaby Lame is the most-followed user on TikTok. This list contains the top 50 accounts by number\n", - " of followers on the Chinese social media platform TikTok, which was merged with musical.ly in 2018.\n", - " [1] The most-followed individual on the platform is Khaby Lame, with over 153 million followers..\n", - " EUR – Euro To USD – US Dollar 1.00 Euro = 1.10 37097 US Dollars 1 USD = 0.906035 EUR We use the\n", - " mid-market rate for our Converter. This is for informational purposes only. You won’t receive this\n", - " rate when sending money. Check send rates Convert Euro to US Dollar Convert US Dollar to Euro..\n", - " ---- ANSWER:\n", - "\n", - " * The most followed person on TikTok right now is Khaby Lame, with over 153 million followers.\n", - " * The exchange rate for EUR to USD is 1.1037097 US Dollars for 1 Euro.\n", - " */\n", - "}" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (C#)", - "language": "C#", - "name": ".net-csharp" - }, - "language_info": { - "name": "polyglot-notebook" - }, - "orig_nbformat": 4, - "polyglot_notebook": { - "kernelInfo": { - "defaultKernelName": "csharp", - "items": [ - { - "aliases": [], - "name": "csharp" - } - ] - } - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb index c0c91bbd6d84..fe11b9571860 100644 --- a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb +++ b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb @@ -39,8 +39,8 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", - "#r \"nuget: Microsoft.SemanticKernel.Skills.Web, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel.Skills.Web, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "#!import config/Utils.cs\n", From a53a81d50eccd966e0c4c75420a1fe772a32c501 Mon Sep 17 00:00:00 2001 From: "newton.mallick" Date: Thu, 29 Jun 2023 12:33:17 +0530 Subject: [PATCH 4/9] Updated SK packages in notebook sample --- .../notebooks/dotnet/00-getting-started.ipynb | 2 +- .../dotnet/01-basic-loading-the-kernel.ipynb | 2 +- .../dotnet/02-running-prompts-from-file.ipynb | 2 +- .../dotnet/03-semantic-function-inline.ipynb | 2 +- .../dotnet/04-context-variables-chat.ipynb | 2 +- .../dotnet/05-using-the-planner.ipynb | 2 +- .../dotnet/06-memory-and-embeddings.ipynb | 2 +- samples/notebooks/dotnet/07-DALL-E-2.ipynb | 2 +- .../dotnet/08-chatGPT-with-DALL-E-2.ipynb | 2 +- .../09-BingSearch-using-kernel-prince.ipynb | 320 ------------------ .../dotnet/09-BingSearch-using-kernel.ipynb | 4 +- .../notebooks/python/00-getting-started.ipynb | 6 +- .../python/01-basic-loading-the-kernel.ipynb | 8 +- .../python/02-running-prompts-from-file.ipynb | 12 +- .../python/03-semantic-function-inline.ipynb | 12 +- .../python/04-context-variables-chat.ipynb | 2 +- .../python/05-using-the-planner.ipynb | 2 +- .../python/06-memory-and-embeddings.ipynb | 14 +- .../python/07-hugging-face-for-skills.ipynb | 6 +- .../python/08-native-function-inline.ipynb | 15 +- 20 files changed, 78 insertions(+), 341 deletions(-) delete mode 100644 samples/notebooks/dotnet/09-BingSearch-using-kernel-prince.ipynb diff --git a/samples/notebooks/dotnet/00-getting-started.ipynb b/samples/notebooks/dotnet/00-getting-started.ipynb index 14e791a1309f..e7aafd66d1fe 100644 --- a/samples/notebooks/dotnet/00-getting-started.ipynb +++ b/samples/notebooks/dotnet/00-getting-started.ipynb @@ -61,7 +61,7 @@ "outputs": [], "source": [ "// Import Semantic Kernel\n", - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"" + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"" ] }, { diff --git a/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb b/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb index e5d2c14b935a..0fa6310aa649 100644 --- a/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb +++ b/samples/notebooks/dotnet/01-basic-loading-the-kernel.ipynb @@ -32,7 +32,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"" + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"" ] }, { diff --git a/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb b/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb index 0ec4ecb70583..a3d141291375 100644 --- a/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb +++ b/samples/notebooks/dotnet/02-running-prompts-from-file.ipynb @@ -90,7 +90,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "\n", diff --git a/samples/notebooks/dotnet/03-semantic-function-inline.ipynb b/samples/notebooks/dotnet/03-semantic-function-inline.ipynb index 48ed64b3ceac..b3e949fdc3dd 100644 --- a/samples/notebooks/dotnet/03-semantic-function-inline.ipynb +++ b/samples/notebooks/dotnet/03-semantic-function-inline.ipynb @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "\n", diff --git a/samples/notebooks/dotnet/04-context-variables-chat.ipynb b/samples/notebooks/dotnet/04-context-variables-chat.ipynb index f2a678f989ed..32a61bb71a2c 100644 --- a/samples/notebooks/dotnet/04-context-variables-chat.ipynb +++ b/samples/notebooks/dotnet/04-context-variables-chat.ipynb @@ -34,7 +34,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "#!import config/Settings.cs\n", "\n", "using Microsoft.SemanticKernel;\n", diff --git a/samples/notebooks/dotnet/05-using-the-planner.ipynb b/samples/notebooks/dotnet/05-using-the-planner.ipynb index ca651183b29d..32ea7aecf07f 100644 --- a/samples/notebooks/dotnet/05-using-the-planner.ipynb +++ b/samples/notebooks/dotnet/05-using-the-planner.ipynb @@ -25,7 +25,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "#!import config/Utils.cs\n", diff --git a/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb b/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb index 8a2390a741f0..05c25337a714 100644 --- a/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb +++ b/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "\n", diff --git a/samples/notebooks/dotnet/07-DALL-E-2.ipynb b/samples/notebooks/dotnet/07-DALL-E-2.ipynb index c45130662f6d..9254acaf6260 100644 --- a/samples/notebooks/dotnet/07-DALL-E-2.ipynb +++ b/samples/notebooks/dotnet/07-DALL-E-2.ipynb @@ -33,7 +33,7 @@ "source": [ "// Usual setup: importing Semantic Kernel SDK and SkiaSharp, used to display images inline.\n", "\n", - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "#r \"nuget: SkiaSharp, 2.88.3\"\n", "\n", "#!import config/Settings.cs\n", diff --git a/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb b/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb index fccb86e6a548..85d875738009 100644 --- a/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb +++ b/samples/notebooks/dotnet/08-chatGPT-with-DALL-E-2.ipynb @@ -56,7 +56,7 @@ "source": [ "// Usual setup: importing Semantic Kernel SDK and SkiaSharp, used to display images inline.\n", "\n", - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", "#r \"nuget: SkiaSharp, 2.88.3\"\n", "\n", "#!import config/Settings.cs\n", diff --git a/samples/notebooks/dotnet/09-BingSearch-using-kernel-prince.ipynb b/samples/notebooks/dotnet/09-BingSearch-using-kernel-prince.ipynb deleted file mode 100644 index c0c91bbd6d84..000000000000 --- a/samples/notebooks/dotnet/09-BingSearch-using-kernel-prince.ipynb +++ /dev/null @@ -1,320 +0,0 @@ -{ - "cells": [ - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# BingSearch using Kernel \n", - "\n", - "This notebook explains how to integragte BingSearch feature in your Semantic Kernel to get latest information from the internet.\n", - "\n", - "To using BingSeach you simply need *Bing Search Api Key* . You can get the api by creating [Bing Search resource](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource) in Azure . \n", - "\n", - "In free Instance you will get *1000* transactions per month and only 3 Transactions per second valid .\n", - "\n", - "Check other pricing from [here](https://www.microsoft.com/en-us/bing/apis/pricing).\n", - "\n", - "To learn more read the follwing [documenation](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/overview)\n" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Prepare a semantic kernel instance first, loading also the AI backend settings defined in the [Setup notebook](0-AI-settings.ipynb):" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", - "#r \"nuget: Microsoft.SemanticKernel.Skills.Web, 0.16.230615.1-preview\"\n", - "\n", - "#!import config/Settings.cs\n", - "#!import config/Utils.cs\n", - "\n", - "using Microsoft.SemanticKernel;\n", - "using Microsoft.SemanticKernel.CoreSkills;\n", - "using Microsoft.SemanticKernel.SkillDefinition;\n", - "using Microsoft.SemanticKernel.Orchestration;\n", - "using Microsoft.SemanticKernel.Planning;\n", - "using Microsoft.SemanticKernel.Planning.Sequential;\n", - "using Microsoft.SemanticKernel.TemplateEngine;\n", - "var builder = new KernelBuilder();\n", - "\n", - "// Configure AI backend used by the kernel\n", - "var (useAzureOpenAI, model, azureEndpoint, apiKey, orgId) = Settings.LoadFromFile();\n", - "\n", - "if (useAzureOpenAI)\n", - " builder.WithAzureTextCompletionService(model, azureEndpoint, apiKey);\n", - "else\n", - " builder.WithOpenAITextCompletionService(model, apiKey, orgId);\n", - "\n", - "var kernel = builder.Build();" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "You requried the following namespaces to use bing search ." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "using Microsoft.SemanticKernel.Skills.Web;\n", - "using Microsoft.SemanticKernel.Skills.Web.Bing;" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "// Load Bing skill\n", - "//Uncomment the Example \n", - "using (var bingConnector = new BingConnector(\"17172014d4754369bc9a422b9bae1345\"))\n", - "{\n", - "kernel.ImportSkill(new WebSearchEngineSkill(bingConnector), \"bing\");\n", - "//await Example1Async(kernel);\n", - "//await Example2Async(kernel);\n", - "//await Example3Async(kernel);\n", - "}" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "private static async Task Example1Async(IKernel kernel)\n", - "{\n", - " Console.WriteLine(\"======== Bing Search Skill ========\");\n", - "\n", - " // Run\n", - " var question = \"What's the largest building in the world?\";\n", - " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", - " // var googleResult = await kernel.Func(\"google\", \"search\").InvokeAsync(question);\n", - "\n", - " Console.WriteLine(question);\n", - " Console.WriteLine(\"----\");\n", - " Console.WriteLine(bingResult);\n", - " Console.WriteLine();\n", - "\n", - " /* OUTPUT:\n", - "\n", - " What's the largest building in the world?\n", - " ----\n", - " The Aerium near Berlin, Germany is the largest uninterrupted volume in the world, while Boeing's\n", - " factory in Everett, Washington, United States is the world's largest building by volume. The AvtoVAZ\n", - " main assembly building in Tolyatti, Russia is the largest building in area footprint.\n", - " ----\n", - " The Aerium near Berlin, Germany is the largest uninterrupted volume in the world, while Boeing's\n", - " factory in Everett, Washington, United States is the world's ...\n", - " */\n", - "}" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "private static async Task Example2Async(IKernel kernel)\n", - "{\n", - "\n", - " //Use the following function in VS only\n", - " string question = await InteractiveKernel.GetInputAsync(\"Please aSk your question\"); \n", - " //Console.ReadLine();\n", - " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", - " \n", - "\n", - " Console.WriteLine(bingResult);\n", - "}" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "\n", - "private static async Task Example3Async(IKernel kernel)\n", - "{\n", - "\n", - "Console.WriteLine(\"======== Use Search Skill to answer user questions ========\");\n", - "\n", - "const string SemanticFunction = @\"Answer questions only when you know the facts or the information is provided.\n", - "When you don't have sufficient information you reply with a list of commands to find the information needed.\n", - "When answering multiple questions, use a bullet point list.\n", - "Note: make sure single and double quotes are escaped using a backslash char.\n", - "\n", - "[COMMANDS AVAILABLE]\n", - "- bing.search\n", - "\n", - "[INFORMATION PROVIDED]\n", - "{{ $externalInformation }}\n", - "\n", - "[EXAMPLE 1]\n", - "Question: what's the biggest lake in Italy?\n", - "Answer: Lake Garda, also known as Lago di Garda.\n", - "\n", - "[EXAMPLE 2]\n", - "Question: what's the biggest lake in Italy? What's the smallest positive number?\n", - "Answer:\n", - "* Lake Garda, also known as Lago di Garda.\n", - "* The smallest positive number is 1.\n", - "\n", - "[EXAMPLE 3]\n", - "Question: what's Ferrari stock price ? Who is the current number one female tennis player in the world?\n", - "Answer:\n", - "{{ '{{' }} bing.search \"\"what\\\\'s Ferrari stock price?\"\" {{ '}}' }}.\n", - "{{ '{{' }} bing.search \"\"Who is the current number one female tennis player in the world?\"\" {{ '}}' }}.\n", - "\n", - "[END OF EXAMPLES]\n", - "\n", - "[TASK]\n", - "Question: {{ $input }}.\n", - "Answer: \";\n", - "\n", - "var questions = \"Who is the most followed person on TikTok right now? What's the exchange rate EUR:USD?\";\n", - "Console.WriteLine(questions);\n", - "\n", - "var oracle = kernel.CreateSemanticFunction(SemanticFunction, maxTokens: 200, temperature: 0, topP: 1);\n", - "var context = kernel.CreateNewContext();\n", - "context[\"externalInformation\"] = \"\";\n", - "var answer = await oracle.InvokeAsync(questions, context);\n", - "\n", - "// If the answer contains commands, execute them using the prompt renderer.\n", - "if (answer.Result.Contains(\"bing.search\", StringComparison.OrdinalIgnoreCase))\n", - " {\n", - " var promptRenderer = new PromptTemplateEngine();\n", - "\n", - " Console.WriteLine(\"---- Fetching information from Bing...\");\n", - " var information = await promptRenderer.RenderAsync(answer.Result, context);\n", - "\n", - " Console.WriteLine(\"Information found:\");\n", - " Console.WriteLine(information);\n", - "\n", - " // The rendered prompt contains the information retrieved from search engines\n", - " context[\"externalInformation\"] = information;\n", - "\n", - " // Run the semantic function again, now including information from Bing\n", - " answer = await oracle.InvokeAsync(questions, context);\n", - " }\n", - " else\n", - " {\n", - " Console.WriteLine(\"AI had all the information, no need to query Bing.\");\n", - " }\n", - "\n", - "Console.WriteLine(\"---- ANSWER:\");\n", - "Console.WriteLine(answer);\n", - "\n", - " /* OUTPUT:\n", - "\n", - " Who is the most followed person on TikTok right now? What's the exchange rate EUR:USD?\n", - " ---- Fetching information from Bing...\n", - " Information found:\n", - "\n", - " Khaby Lame is the most-followed user on TikTok. This list contains the top 50 accounts by number\n", - " of followers on the Chinese social media platform TikTok, which was merged with musical.ly in 2018.\n", - " [1] The most-followed individual on the platform is Khaby Lame, with over 153 million followers..\n", - " EUR – Euro To USD – US Dollar 1.00 Euro = 1.10 37097 US Dollars 1 USD = 0.906035 EUR We use the\n", - " mid-market rate for our Converter. This is for informational purposes only. You won’t receive this\n", - " rate when sending money. Check send rates Convert Euro to US Dollar Convert US Dollar to Euro..\n", - " ---- ANSWER:\n", - "\n", - " * The most followed person on TikTok right now is Khaby Lame, with over 153 million followers.\n", - " * The exchange rate for EUR to USD is 1.1037097 US Dollars for 1 Euro.\n", - " */\n", - "}" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": ".NET (C#)", - "language": "C#", - "name": ".net-csharp" - }, - "language_info": { - "name": "polyglot-notebook" - }, - "orig_nbformat": 4, - "polyglot_notebook": { - "kernelInfo": { - "defaultKernelName": "csharp", - "items": [ - { - "aliases": [], - "name": "csharp" - } - ] - } - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb index c0c91bbd6d84..fe11b9571860 100644 --- a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb +++ b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb @@ -39,8 +39,8 @@ }, "outputs": [], "source": [ - "#r \"nuget: Microsoft.SemanticKernel, 0.16.230615.1-preview\"\n", - "#r \"nuget: Microsoft.SemanticKernel.Skills.Web, 0.16.230615.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", + "#r \"nuget: Microsoft.SemanticKernel.Skills.Web, 0.17.230626.1-preview\"\n", "\n", "#!import config/Settings.cs\n", "#!import config/Utils.cs\n", diff --git a/samples/notebooks/python/00-getting-started.ipynb b/samples/notebooks/python/00-getting-started.ipynb index 6d1ac7e1ecf6..26b8a2e1d15f 100644 --- a/samples/notebooks/python/00-getting-started.ipynb +++ b/samples/notebooks/python/00-getting-started.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -15,7 +16,7 @@ "metadata": {}, "outputs": [], "source": [ - "!python -m pip install semantic-kernel==0.2.7.dev0" + "!python -m pip install semantic-kernel==0.3.1.dev0" ] }, { @@ -30,6 +31,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -59,6 +61,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -89,6 +92,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/samples/notebooks/python/01-basic-loading-the-kernel.ipynb b/samples/notebooks/python/01-basic-loading-the-kernel.ipynb index c8e542b4127f..9f8fc82cfb13 100644 --- a/samples/notebooks/python/01-basic-loading-the-kernel.ipynb +++ b/samples/notebooks/python/01-basic-loading-the-kernel.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -23,7 +25,7 @@ "metadata": {}, "outputs": [], "source": [ - "!python -m pip install semantic-kernel==0.2.7.dev0" + "!python -m pip install semantic-kernel==0.3.1.dev0" ] }, { @@ -37,6 +39,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -65,6 +68,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -103,6 +107,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -125,6 +130,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/samples/notebooks/python/02-running-prompts-from-file.ipynb b/samples/notebooks/python/02-running-prompts-from-file.ipynb index 1b7a7ac18e78..04a4ec1c1d23 100644 --- a/samples/notebooks/python/02-running-prompts-from-file.ipynb +++ b/samples/notebooks/python/02-running-prompts-from-file.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "692e361b", "metadata": {}, @@ -18,6 +19,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "f3ce1efe", "metadata": {}, @@ -36,6 +38,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "afdb96d6", "metadata": {}, @@ -46,6 +49,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c3bd5134", "metadata": {}, @@ -68,6 +72,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "384ff07f", "metadata": {}, @@ -84,7 +89,7 @@ "metadata": {}, "outputs": [], "source": [ - "!python -m pip install semantic-kernel==0.2.7.dev0" + "!python -m pip install semantic-kernel==0.3.1.dev0" ] }, { @@ -111,6 +116,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "fd5ff1f4", "metadata": {}, @@ -134,6 +140,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "edd99fa0", "metadata": {}, @@ -158,6 +165,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2281a1fc", "metadata": {}, @@ -187,4 +195,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/samples/notebooks/python/03-semantic-function-inline.ipynb b/samples/notebooks/python/03-semantic-function-inline.ipynb index f8cd881a27c7..c48b1d86a517 100644 --- a/samples/notebooks/python/03-semantic-function-inline.ipynb +++ b/samples/notebooks/python/03-semantic-function-inline.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "3c93ac5b", "metadata": {}, @@ -9,12 +10,14 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "ebcabb91", "metadata": {}, "source": [] }, { + "attachments": {}, "cell_type": "markdown", "id": "40201641", "metadata": {}, @@ -37,6 +40,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "d90b0c13", "metadata": {}, @@ -51,7 +55,7 @@ "metadata": {}, "outputs": [], "source": [ - "!python -m pip install semantic-kernel==0.2.7.dev0" + "!python -m pip install semantic-kernel==0.3.1.dev0" ] }, { @@ -78,6 +82,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "589733c5", "metadata": {}, @@ -102,6 +107,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "f26b90c4", "metadata": {}, @@ -130,6 +136,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "bf0f2330", "metadata": {}, @@ -151,6 +158,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "1c2c1262", "metadata": {}, @@ -159,6 +167,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "29b59b28", "metadata": {}, @@ -167,6 +176,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "4777f447", "metadata": {}, diff --git a/samples/notebooks/python/04-context-variables-chat.ipynb b/samples/notebooks/python/04-context-variables-chat.ipynb index 267551b278d4..de79d4b41a13 100644 --- a/samples/notebooks/python/04-context-variables-chat.ipynb +++ b/samples/notebooks/python/04-context-variables-chat.ipynb @@ -26,7 +26,7 @@ "metadata": {}, "outputs": [], "source": [ - "!python -m pip install semantic-kernel==0.2.7.dev0" + "!python -m pip install semantic-kernel==0.3.1.dev0" ] }, { diff --git a/samples/notebooks/python/05-using-the-planner.ipynb b/samples/notebooks/python/05-using-the-planner.ipynb index 1f379583363b..3827e69fed43 100644 --- a/samples/notebooks/python/05-using-the-planner.ipynb +++ b/samples/notebooks/python/05-using-the-planner.ipynb @@ -24,7 +24,7 @@ "metadata": {}, "outputs": [], "source": [ - "!python -m pip install semantic-kernel==0.2.7.dev0" + "!python -m pip install semantic-kernel==0.3.1.dev0" ] }, { diff --git a/samples/notebooks/python/06-memory-and-embeddings.ipynb b/samples/notebooks/python/06-memory-and-embeddings.ipynb index 65f1765948fa..6ea4e4416afe 100644 --- a/samples/notebooks/python/06-memory-and-embeddings.ipynb +++ b/samples/notebooks/python/06-memory-and-embeddings.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "68e1c158", "metadata": {}, @@ -27,7 +28,7 @@ "metadata": {}, "outputs": [], "source": [ - "!python -m pip install semantic-kernel==0.2.7.dev0" + "!python -m pip install semantic-kernel==0.3.1.dev0" ] }, { @@ -44,6 +45,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "d8ddffc1", "metadata": {}, @@ -81,6 +83,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "e7fefb6a", "metadata": {}, @@ -91,6 +94,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2a7e7ca4", "metadata": {}, @@ -126,6 +130,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2calf857", "metadata": {}, @@ -156,6 +161,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "e70c2b22", "metadata": {}, @@ -165,6 +171,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "1ed54a32", "metadata": {}, @@ -220,6 +227,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "1ac62457", "metadata": {}, @@ -228,6 +236,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "645b55a1", "metadata": {}, @@ -290,6 +299,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "0a51542b", "metadata": {}, @@ -326,6 +336,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "75f3ea5e", "metadata": {}, @@ -378,6 +389,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "59294dac", "metadata": {}, diff --git a/samples/notebooks/python/07-hugging-face-for-skills.ipynb b/samples/notebooks/python/07-hugging-face-for-skills.ipynb index da2201d8e067..91e7f7dbfe85 100644 --- a/samples/notebooks/python/07-hugging-face-for-skills.ipynb +++ b/samples/notebooks/python/07-hugging-face-for-skills.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "68e1c158", "metadata": {}, @@ -19,7 +20,7 @@ "metadata": {}, "outputs": [], "source": [ - "!python -m pip install semantic-kernel==0.2.7.dev0\n", + "!python -m pip install semantic-kernel==0.3.1.dev0\n", "\n", "# Note that additional dependencies are required for the Hugging Face connectors:\n", "!python -m pip install torch==2.0.0\n", @@ -39,6 +40,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "d8ddffc1", "metadata": {}, @@ -73,6 +75,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2a7e7ca4", "metadata": {}, @@ -115,6 +118,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2calf857", "metadata": {}, diff --git a/samples/notebooks/python/08-native-function-inline.ipynb b/samples/notebooks/python/08-native-function-inline.ipynb index a09ae177ac63..6772d11aefac 100644 --- a/samples/notebooks/python/08-native-function-inline.ipynb +++ b/samples/notebooks/python/08-native-function-inline.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "3c93ac5b", "metadata": {}, @@ -9,6 +10,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "40201641", "metadata": {}, @@ -29,6 +31,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "d90b0c13", "metadata": {}, @@ -43,7 +46,7 @@ "metadata": {}, "outputs": [], "source": [ - "!python -m pip install semantic-kernel==0.2.7.dev0" + "!python -m pip install semantic-kernel==0.3.1.dev0" ] }, { @@ -73,6 +76,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "186767f8", "metadata": {}, @@ -81,6 +85,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "589733c5", "metadata": {}, @@ -125,6 +130,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "f26b90c4", "metadata": {}, @@ -195,6 +201,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8ef29d16", "metadata": {}, @@ -235,6 +242,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "091f45e4", "metadata": {}, @@ -294,6 +302,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "6ad068d6", "metadata": {}, @@ -328,6 +337,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "fdce1872", "metadata": {}, @@ -350,6 +360,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c8778bad", "metadata": {}, @@ -394,6 +405,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "fb786c54", "metadata": {}, @@ -537,6 +549,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "42f0c472", "metadata": {}, From f33502b738932ab0cde7bcee826aee5bebba1d10 Mon Sep 17 00:00:00 2001 From: NEWTON MALLICK <38786893+N-E-W-T-O-N@users.noreply.github.com> Date: Thu, 29 Jun 2023 22:54:40 +0530 Subject: [PATCH 5/9] Minnor tweaks in 09-BingSearch-using-kernel.ipynb Fix minor mistakes in the notebook --- .../dotnet/09-BingSearch-using-kernel.ipynb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb index fe11b9571860..f730be370cbc 100644 --- a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb +++ b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb @@ -7,15 +7,11 @@ "source": [ "# BingSearch using Kernel \n", "\n", - "This notebook explains how to integragte BingSearch feature in your Semantic Kernel to get latest information from the internet.\n", + "This notebook explains how to integrate Bing Search with the Semantic Kernel to get the latest information from the internet.\n", "\n", - "To using BingSeach you simply need *Bing Search Api Key* . You can get the api by creating [Bing Search resource](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource) in Azure . \n", + "To use Bing Search you simply need a Bing Search API key. You can get the API key by creating a [Bing Search resource](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource) in Azure. \n", "\n", - "In free Instance you will get *1000* transactions per month and only 3 Transactions per second valid .\n", - "\n", - "Check other pricing from [here](https://www.microsoft.com/en-us/bing/apis/pricing).\n", - "\n", - "To learn more read the follwing [documenation](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/overview)\n" + "To learn more read the following [documenation](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/overview)\n" ] }, { @@ -70,7 +66,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "You requried the following namespaces to use bing search ." + "Add the following namespaces to use the Bing Search connector." ] }, { From d303c8cffee348295755b696b7793d82daffb668 Mon Sep 17 00:00:00 2001 From: "newton.mallick" Date: Mon, 3 Jul 2023 17:41:53 +0530 Subject: [PATCH 6/9] Updated BingSearch notebook with minor tweaks --- .../dotnet/09-BingSearch-using-kernel.ipynb | 162 ++++-------------- 1 file changed, 35 insertions(+), 127 deletions(-) diff --git a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb index f730be370cbc..763a7a350188 100644 --- a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb +++ b/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb @@ -42,7 +42,7 @@ "#!import config/Utils.cs\n", "\n", "using Microsoft.SemanticKernel;\n", - "using Microsoft.SemanticKernel.CoreSkills;\n", + "using Microsoft.SemanticKernel.Skills.Core;\n", "using Microsoft.SemanticKernel.SkillDefinition;\n", "using Microsoft.SemanticKernel.Orchestration;\n", "using Microsoft.SemanticKernel.Planning;\n", @@ -71,7 +71,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -90,11 +90,13 @@ "attachments": {}, "cell_type": "markdown", "metadata": {}, - "source": [] + "source": [ + "Below are some examples on how `WebSearchEngineSkill` can be use in SK . Just uncomment the example to use the ." + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -103,22 +105,36 @@ "kernelName": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1\n", + "What is quantum tunnelling\n", + "----\n", + "In physics, quantum tunnelling, barrier penetration, or simply tunnelling is a quantum mechanical phenomenon in which an object such as an electron or atom passes through a potential energy barrier that, according to classical mechanics, the object does not have sufficient energy to enter or surmount.\n", + "\n", + "Example 2\n", + "[1] Elon Musk (@elonmusk) is the owner of Twitter and is the most-followed person on Twitter, with over 144 million followers. Former U.S. President Barack Obama (@BarackObama) is the second most-followed person on Twitter, with over 132 million followers.\n" + ] + } + ], "source": [ "// Load Bing skill\n", "//Uncomment the Example \n", - "using (var bingConnector = new BingConnector(\"17172014d4754369bc9a422b9bae1345\"))\n", + "using (var bingConnector = new BingConnector(\"BING_KEY\")\n", "{\n", "kernel.ImportSkill(new WebSearchEngineSkill(bingConnector), \"bing\");\n", + "//First run the example sample given below and uncomment the await the following statements \n", "//await Example1Async(kernel);\n", "//await Example2Async(kernel);\n", - "//await Example3Async(kernel);\n", "}" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -131,12 +147,11 @@ "source": [ "private static async Task Example1Async(IKernel kernel)\n", "{\n", - " Console.WriteLine(\"======== Bing Search Skill ========\");\n", + " Console.WriteLine(\"Example 1\");\n", "\n", - " // Run\n", - " var question = \"What's the largest building in the world?\";\n", + " // Run \n", + " var question = \"What is quantum tunnelling\";\n", " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", - " // var googleResult = await kernel.Func(\"google\", \"search\").InvokeAsync(question);\n", "\n", " Console.WriteLine(question);\n", " Console.WriteLine(\"----\");\n", @@ -145,21 +160,20 @@ "\n", " /* OUTPUT:\n", "\n", - " What's the largest building in the world?\n", + " What is quantum tunnerling\n", " ----\n", - " The Aerium near Berlin, Germany is the largest uninterrupted volume in the world, while Boeing's\n", - " factory in Everett, Washington, United States is the world's largest building by volume. The AvtoVAZ\n", - " main assembly building in Tolyatti, Russia is the largest building in area footprint.\n", - " ----\n", - " The Aerium near Berlin, Germany is the largest uninterrupted volume in the world, while Boeing's\n", - " factory in Everett, Washington, United States is the world's ...\n", + " In physics, quantum tunnelling, barrier penetration, or simply tunnelling is a quantum mechanical\n", + " phenomenon in which an object such as an electron or atom passes through a potential energy \n", + " barrier that, according to classical mechanics, the object does not have sufficient energy to\n", + " enter or surmount.\n", + " \n", " */\n", "}" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -172,121 +186,15 @@ "source": [ "private static async Task Example2Async(IKernel kernel)\n", "{\n", - "\n", + " Console.WriteLine(\"Example 2\");\n", " //Use the following function in VS only\n", " string question = await InteractiveKernel.GetInputAsync(\"Please aSk your question\"); \n", " //Console.ReadLine();\n", " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", - " \n", "\n", " Console.WriteLine(bingResult);\n", "}" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "\n", - "private static async Task Example3Async(IKernel kernel)\n", - "{\n", - "\n", - "Console.WriteLine(\"======== Use Search Skill to answer user questions ========\");\n", - "\n", - "const string SemanticFunction = @\"Answer questions only when you know the facts or the information is provided.\n", - "When you don't have sufficient information you reply with a list of commands to find the information needed.\n", - "When answering multiple questions, use a bullet point list.\n", - "Note: make sure single and double quotes are escaped using a backslash char.\n", - "\n", - "[COMMANDS AVAILABLE]\n", - "- bing.search\n", - "\n", - "[INFORMATION PROVIDED]\n", - "{{ $externalInformation }}\n", - "\n", - "[EXAMPLE 1]\n", - "Question: what's the biggest lake in Italy?\n", - "Answer: Lake Garda, also known as Lago di Garda.\n", - "\n", - "[EXAMPLE 2]\n", - "Question: what's the biggest lake in Italy? What's the smallest positive number?\n", - "Answer:\n", - "* Lake Garda, also known as Lago di Garda.\n", - "* The smallest positive number is 1.\n", - "\n", - "[EXAMPLE 3]\n", - "Question: what's Ferrari stock price ? Who is the current number one female tennis player in the world?\n", - "Answer:\n", - "{{ '{{' }} bing.search \"\"what\\\\'s Ferrari stock price?\"\" {{ '}}' }}.\n", - "{{ '{{' }} bing.search \"\"Who is the current number one female tennis player in the world?\"\" {{ '}}' }}.\n", - "\n", - "[END OF EXAMPLES]\n", - "\n", - "[TASK]\n", - "Question: {{ $input }}.\n", - "Answer: \";\n", - "\n", - "var questions = \"Who is the most followed person on TikTok right now? What's the exchange rate EUR:USD?\";\n", - "Console.WriteLine(questions);\n", - "\n", - "var oracle = kernel.CreateSemanticFunction(SemanticFunction, maxTokens: 200, temperature: 0, topP: 1);\n", - "var context = kernel.CreateNewContext();\n", - "context[\"externalInformation\"] = \"\";\n", - "var answer = await oracle.InvokeAsync(questions, context);\n", - "\n", - "// If the answer contains commands, execute them using the prompt renderer.\n", - "if (answer.Result.Contains(\"bing.search\", StringComparison.OrdinalIgnoreCase))\n", - " {\n", - " var promptRenderer = new PromptTemplateEngine();\n", - "\n", - " Console.WriteLine(\"---- Fetching information from Bing...\");\n", - " var information = await promptRenderer.RenderAsync(answer.Result, context);\n", - "\n", - " Console.WriteLine(\"Information found:\");\n", - " Console.WriteLine(information);\n", - "\n", - " // The rendered prompt contains the information retrieved from search engines\n", - " context[\"externalInformation\"] = information;\n", - "\n", - " // Run the semantic function again, now including information from Bing\n", - " answer = await oracle.InvokeAsync(questions, context);\n", - " }\n", - " else\n", - " {\n", - " Console.WriteLine(\"AI had all the information, no need to query Bing.\");\n", - " }\n", - "\n", - "Console.WriteLine(\"---- ANSWER:\");\n", - "Console.WriteLine(answer);\n", - "\n", - " /* OUTPUT:\n", - "\n", - " Who is the most followed person on TikTok right now? What's the exchange rate EUR:USD?\n", - " ---- Fetching information from Bing...\n", - " Information found:\n", - "\n", - " Khaby Lame is the most-followed user on TikTok. This list contains the top 50 accounts by number\n", - " of followers on the Chinese social media platform TikTok, which was merged with musical.ly in 2018.\n", - " [1] The most-followed individual on the platform is Khaby Lame, with over 153 million followers..\n", - " EUR – Euro To USD – US Dollar 1.00 Euro = 1.10 37097 US Dollars 1 USD = 0.906035 EUR We use the\n", - " mid-market rate for our Converter. This is for informational purposes only. You won’t receive this\n", - " rate when sending money. Check send rates Convert Euro to US Dollar Convert US Dollar to Euro..\n", - " ---- ANSWER:\n", - "\n", - " * The most followed person on TikTok right now is Khaby Lame, with over 153 million followers.\n", - " * The exchange rate for EUR to USD is 1.1037097 US Dollars for 1 Euro.\n", - " */\n", - "}" - ] } ], "metadata": { From 205e3d55875bcb823c5091db3f3e9f869fcbaa1a Mon Sep 17 00:00:00 2001 From: NEWTON Date: Wed, 5 Jul 2023 00:21:59 +0530 Subject: [PATCH 7/9] Updated 10-BingSearch-using-kernel @gitri-ms --- ...ipynb => 10-BingSearch-using-kernel.ipynb} | 72 +++++++++++-------- 1 file changed, 44 insertions(+), 28 deletions(-) rename samples/notebooks/dotnet/{09-BingSearch-using-kernel.ipynb => 10-BingSearch-using-kernel.ipynb} (76%) diff --git a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb b/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb similarity index 76% rename from samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb rename to samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb index 763a7a350188..fab8f906abe6 100644 --- a/samples/notebooks/dotnet/09-BingSearch-using-kernel.ipynb +++ b/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb @@ -11,7 +11,7 @@ "\n", "To use Bing Search you simply need a Bing Search API key. You can get the API key by creating a [Bing Search resource](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource) in Azure. \n", "\n", - "To learn more read the following [documenation](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/overview)\n" + "To learn more read the following [documentation](https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/overview)\n" ] }, { @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Prepare a semantic kernel instance first, loading also the AI backend settings defined in the [Setup notebook](0-AI-settings.ipynb):" + "Prepare a Semantic Kernel instance first, loading also the AI backend settings defined in the [Setup notebook](0-AI-settings.ipynb):" ] }, { @@ -48,6 +48,7 @@ "using Microsoft.SemanticKernel.Planning;\n", "using Microsoft.SemanticKernel.Planning.Sequential;\n", "using Microsoft.SemanticKernel.TemplateEngine;\n", + "using InteractiveKernel = Microsoft.DotNet.Interactive.Kernel;\n", "var builder = new KernelBuilder();\n", "\n", "// Configure AI backend used by the kernel\n", @@ -71,7 +72,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -91,12 +92,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Below are some examples on how `WebSearchEngineSkill` can be use in SK . Just uncomment the example to use the ." + "Enter your Bing Search Key in BING_KEY using `InteractiveKernel` method as introduse in [`.NET Interactive`](https://github.com/dotnet/interactive/blob/main/docs/kernels-overview.md)" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 7, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -105,36 +106,50 @@ "kernelName": "csharp" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1\n", - "What is quantum tunnelling\n", - "----\n", - "In physics, quantum tunnelling, barrier penetration, or simply tunnelling is a quantum mechanical phenomenon in which an object such as an electron or atom passes through a potential energy barrier that, according to classical mechanics, the object does not have sufficient energy to enter or surmount.\n", - "\n", - "Example 2\n", - "[1] Elon Musk (@elonmusk) is the owner of Twitter and is the most-followed person on Twitter, with over 144 million followers. Former U.S. President Barack Obama (@BarackObama) is the second most-followed person on Twitter, with over 132 million followers.\n" - ] + "outputs": [], + "source": [ + "using InteractiveKernel = Microsoft.DotNet.Interactive.Kernel;\n", + "\n", + "string BING_KEY = await InteractiveKernel.GetPasswordAsync(\"Please enter your Bing Search Key\");" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Below are some examples on how [`WebSearchEngineSkill`](../../../dotnet/src/Skills/Skills.Web/WebSearchEngineSkill.cs) can be use in SK . Just uncomment the example to use them ." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" } - ], + }, + "outputs": [], "source": [ "// Load Bing skill\n", "//Uncomment the Example \n", - "using (var bingConnector = new BingConnector(\"BING_KEY\")\n", + "using (var bingConnector = new BingConnector(BING_KEY))\n", "{\n", "kernel.ImportSkill(new WebSearchEngineSkill(bingConnector), \"bing\");\n", "//First run the example sample given below and uncomment the await the following statements \n", - "//await Example1Async(kernel);\n", + "\n", + "await Example1Async(kernel);\n", + "\n", "//await Example2Async(kernel);\n", "}" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 10, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -160,7 +175,7 @@ "\n", " /* OUTPUT:\n", "\n", - " What is quantum tunnerling\n", + " What is quantum tunnelling\n", " ----\n", " In physics, quantum tunnelling, barrier penetration, or simply tunnelling is a quantum mechanical\n", " phenomenon in which an object such as an electron or atom passes through a potential energy \n", @@ -173,7 +188,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 11, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -187,12 +202,13 @@ "private static async Task Example2Async(IKernel kernel)\n", "{\n", " Console.WriteLine(\"Example 2\");\n", - " //Use the following function in VS only\n", - " string question = await InteractiveKernel.GetInputAsync(\"Please aSk your question\"); \n", - " //Console.ReadLine();\n", + "\n", + " //Use the following function in only work in Notebooks\n", + " string question = await InteractiveKernel.GetInputAsync(\"Please ask your question\"); \n", + "\n", " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", "\n", - " Console.WriteLine(bingResult);\n", + " Console.WriteLine(bingResult);\n", "}" ] } From e34c95734f1489570b664b459c11c3dfef28154b Mon Sep 17 00:00:00 2001 From: NEWTON Date: Wed, 5 Jul 2023 00:40:03 +0530 Subject: [PATCH 8/9] Minor Fix --- .../dotnet/10-BingSearch-using-kernel.ipynb | 62 +++++++++++-------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb b/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb index fab8f906abe6..dd9426550055 100644 --- a/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb +++ b/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb @@ -118,33 +118,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Below are some examples on how [`WebSearchEngineSkill`](../../../dotnet/src/Skills/Skills.Web/WebSearchEngineSkill.cs) can be use in SK . Just uncomment the example to use them ." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, - "outputs": [], - "source": [ - "// Load Bing skill\n", - "//Uncomment the Example \n", - "using (var bingConnector = new BingConnector(BING_KEY))\n", - "{\n", - "kernel.ImportSkill(new WebSearchEngineSkill(bingConnector), \"bing\");\n", - "//First run the example sample given below and uncomment the await the following statements \n", - "\n", - "await Example1Async(kernel);\n", - "\n", - "//await Example2Async(kernel);\n", - "}" + "Below are some examples on how [`WebSearchEngineSkill`](../../../dotnet/src/Skills/Skills.Web/WebSearchEngineSkill.cs) can be use in SK . " ] }, { @@ -211,6 +185,40 @@ " Console.WriteLine(bingResult);\n", "}" ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Just uncomment the Example2Async method and run the following code ." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, + "outputs": [], + "source": [ + "// Load Bing skill\n", + "//Uncomment the Example \n", + "using (var bingConnector = new BingConnector(BING_KEY))\n", + "{\n", + "kernel.ImportSkill(new WebSearchEngineSkill(bingConnector), \"bing\");\n", + "//First run the example sample given below and uncomment the await the following statements \n", + "\n", + "await Example1Async(kernel);\n", + "\n", + "//await Example2Async(kernel);\n", + "}" + ] } ], "metadata": { From fee97c444229fdb1126b87e48d53ddfac94a6669 Mon Sep 17 00:00:00 2001 From: Gina Triolo <51341242+gitri-ms@users.noreply.github.com> Date: Wed, 5 Jul 2023 11:21:20 -0700 Subject: [PATCH 9/9] Fixes in other notebooks from upgrade; cleanup formatting and spelling --- .../dotnet/05-using-the-planner.ipynb | 6 ++--- .../dotnet/06-memory-and-embeddings.ipynb | 1 + .../dotnet/10-BingSearch-using-kernel.ipynb | 25 ++++++++----------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/samples/notebooks/dotnet/05-using-the-planner.ipynb b/samples/notebooks/dotnet/05-using-the-planner.ipynb index 32ea7aecf07f..183df27e4d59 100644 --- a/samples/notebooks/dotnet/05-using-the-planner.ipynb +++ b/samples/notebooks/dotnet/05-using-the-planner.ipynb @@ -31,7 +31,7 @@ "#!import config/Utils.cs\n", "\n", "using Microsoft.SemanticKernel;\n", - "using Microsoft.SemanticKernel.CoreSkills;\n", + "using Microsoft.SemanticKernel.Skills.Core;\n", "using Microsoft.SemanticKernel.Orchestration;\n", "using Microsoft.SemanticKernel.Planning;\n", "using Microsoft.SemanticKernel.Planning.Sequential;\n", @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "var ask = \"Tomorrow is Valentine's day. I need to come up with a few date ideas and e-mail them to my significant other.\";\n", + "var ask = \"Tomorrow is Valentine's day. I need to come up with a few date ideas. My significant other likes poems so write them in the form of a poem.\";\n", "var originalPlan = await planner.CreatePlanAsync(ask);\n", "\n", "Console.WriteLine(\"Original plan:\\n\");\n", @@ -194,7 +194,7 @@ "outputs": [], "source": [ "var ask = @\"Tomorrow is Valentine's day. I need to come up with a few date ideas.\n", - "She likes Shakespeare so write using his style. E-mail these ideas to my significant other\";\n", + "She likes Shakespeare so write using his style. Write them in the form of a poem.\";\n", "\n", "var newPlan = await planner.CreatePlanAsync(ask);\n", "\n", diff --git a/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb b/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb index 05c25337a714..e123e9010010 100644 --- a/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb +++ b/samples/notebooks/dotnet/06-memory-and-embeddings.ipynb @@ -34,6 +34,7 @@ "outputs": [], "source": [ "#r \"nuget: Microsoft.SemanticKernel, 0.17.230626.1-preview\"\n", + "#r \"nuget: System.Linq.Async, 6.0.1\"\n", "\n", "#!import config/Settings.cs\n", "\n", diff --git a/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb b/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb index dd9426550055..1d9108a51edf 100644 --- a/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb +++ b/samples/notebooks/dotnet/10-BingSearch-using-kernel.ipynb @@ -72,7 +72,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -92,12 +92,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Enter your Bing Search Key in BING_KEY using `InteractiveKernel` method as introduse in [`.NET Interactive`](https://github.com/dotnet/interactive/blob/main/docs/kernels-overview.md)" + "Enter your Bing Search Key in BING_KEY using `InteractiveKernel` method as introduced in [`.NET Interactive`](https://github.com/dotnet/interactive/blob/main/docs/kernels-overview.md)" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -118,12 +118,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Below are some examples on how [`WebSearchEngineSkill`](../../../dotnet/src/Skills/Skills.Web/WebSearchEngineSkill.cs) can be use in SK . " + "Below are some examples on how [`WebSearchEngineSkill`](../../../dotnet/src/Skills/Skills.Web/WebSearchEngineSkill.cs) can be used in SK. " ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -162,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -177,7 +177,7 @@ "{\n", " Console.WriteLine(\"Example 2\");\n", "\n", - " //Use the following function in only work in Notebooks\n", + " //The following function only works in interactive notebooks\n", " string question = await InteractiveKernel.GetInputAsync(\"Please ask your question\"); \n", "\n", " var bingResult = await kernel.Func(\"bing\", \"search\").InvokeAsync(question);\n", @@ -191,7 +191,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Just uncomment the Example2Async method and run the following code ." + "Just uncomment the examples to run them in the following code:" ] }, { @@ -208,15 +208,12 @@ "outputs": [], "source": [ "// Load Bing skill\n", - "//Uncomment the Example \n", "using (var bingConnector = new BingConnector(BING_KEY))\n", "{\n", - "kernel.ImportSkill(new WebSearchEngineSkill(bingConnector), \"bing\");\n", - "//First run the example sample given below and uncomment the await the following statements \n", - "\n", - "await Example1Async(kernel);\n", + " kernel.ImportSkill(new WebSearchEngineSkill(bingConnector), \"bing\");\n", "\n", - "//await Example2Async(kernel);\n", + " //await Example1Async(kernel);\n", + " //await Example2Async(kernel);\n", "}" ] }