From 8c3b2192b0cd67580a64371a195272309c6b6705 Mon Sep 17 00:00:00 2001 From: Devis Lucato Date: Thu, 7 Dec 2023 17:52:50 -0800 Subject: [PATCH] Upgrade examples' nuget --- .../000-notebooks/001-upload-and-ask.ipynb | 43 ++++++++++++++----- .../002-semantic-kernel-plugin.ipynb | 12 +++--- .../002-dotnet-SemanticKernelPlugin.csproj | 2 +- .../Program.cs | 6 +-- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/examples/000-notebooks/001-upload-and-ask.ipynb b/examples/000-notebooks/001-upload-and-ask.ipynb index 979fb10cd..788b47e13 100644 --- a/examples/000-notebooks/001-upload-and-ask.ipynb +++ b/examples/000-notebooks/001-upload-and-ask.ipynb @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 1, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -26,7 +26,7 @@ { "data": { "text/html": [ - "
Installed Packages
  • Microsoft.KernelMemory.Core, 0.17.231206.1-preview
" + "
Installed Packages
  • Microsoft.KernelMemory.Core, 0.18.231207.1-preview
" ] }, "metadata": {}, @@ -34,7 +34,7 @@ } ], "source": [ - "#r \"nuget: Microsoft.KernelMemory.Core, 0.17.231206.1-preview\"\n", + "#r \"nuget: Microsoft.KernelMemory.Core, 0.18.231207.1-preview\"\n", "\n", "using Microsoft.KernelMemory;" ] @@ -53,7 +53,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 2, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -91,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 3, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -100,7 +100,28 @@ "kernelName": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "info: Microsoft.KernelMemory.Handlers.TextExtractionHandler[0]\n", + " Handler 'extract' ready\n", + "info: Microsoft.KernelMemory.Handlers.TextPartitioningHandler[0]\n", + " Handler 'partition' ready\n", + "info: Microsoft.KernelMemory.Handlers.SummarizationHandler[0]\n", + " Handler 'summarize' ready\n", + "info: Microsoft.KernelMemory.Handlers.GenerateEmbeddingsHandler[0]\n", + " Handler 'gen_embeddings' ready, 1 embedding generators\n", + "info: Microsoft.KernelMemory.Handlers.SaveRecordsHandler[0]\n", + " Handler save_records ready, 1 vector storages\n", + "info: Microsoft.KernelMemory.Handlers.DeleteDocumentHandler[0]\n", + " Handler 'private_delete_document' ready\n", + "info: Microsoft.KernelMemory.Handlers.DeleteIndexHandler[0]\n", + " Handler 'private_delete_index' ready\n" + ] + } + ], "source": [ "var memory = new KernelMemoryBuilder()\n", " .WithOpenAIDefaults(env[\"OPENAI_API_KEY\"])\n", @@ -118,7 +139,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 4, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -141,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 5, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -157,7 +178,7 @@ "text": [ "Question: What's Semantic Kernel?\n", "\n", - "Answer: Semantic Kernel is a lightweight SDK (Software Development Kit) developed by Microsoft. It enables the integration of AI Large Language Models (LLMs) with conventional programming languages. The SDK combines natural language semantic functions, traditional code native functions, and embeddings-based memory to add value and unlock new potential in applications with AI. Semantic Kernel supports prompt templating, function chaining, vectorized memory, and intelligent planning capabilities. It encapsulates several design patterns from the latest AI research, allowing developers to infuse their applications with features like prompt chaining, recursive reasoning, summarization, zero/few-shot learning, contextual memory, long-term memory, embeddings, semantic indexing, planning, retrieval-augmented generation, and accessing external knowledge stores. Semantic Kernel is open-source and aims to build AI-first apps faster by providing a flexible and extensible programming model.\n" + "Answer: Semantic Kernel is a lightweight SDK (Software Development Kit) developed by Microsoft. It enables the integration of AI Large Language Models (LLMs) with conventional programming languages. The SDK combines natural language semantic functions, traditional code native functions, and embeddings-based memory to add value and unlock new potential in applications with AI. Semantic Kernel supports prompt templating, function chaining, vectorized memory, and intelligent planning capabilities. It encapsulates several design patterns from the latest AI research, allowing developers to infuse their applications with features like prompt chaining, recursive reasoning, summarization, zero/few-shot learning, contextual memory, long-term memory, embeddings, semantic indexing, planning, retrieval-augmented generation, and accessing external knowledge stores. Semantic Kernel is open-source and aims to enable developers to build AI-first apps faster.\n" ] } ], @@ -178,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 6, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -194,7 +215,7 @@ "text": [ "Sources:\n", "\n", - " - sample-SK-Readme.pdf - doc001/3b9ae5f6963e4aecb0566043a47aa370 [Thursday, December 7, 2023]\n" + " - sample-SK-Readme.pdf - doc001/ecb6d46eb039411193996b6cc802b11e [Friday, December 8, 2023]\n" ] } ], diff --git a/examples/000-notebooks/002-semantic-kernel-plugin.ipynb b/examples/000-notebooks/002-semantic-kernel-plugin.ipynb index fafb043ad..1b14a9375 100644 --- a/examples/000-notebooks/002-semantic-kernel-plugin.ipynb +++ b/examples/000-notebooks/002-semantic-kernel-plugin.ipynb @@ -26,7 +26,7 @@ { "data": { "text/html": [ - "
Installed Packages
  • Microsoft.KernelMemory.SemanticKernelPlugin, 0.17.231206.1-preview
  • Microsoft.SemanticKernel, 1.0.0-rc3
" + "
Installed Packages
  • Microsoft.KernelMemory.SemanticKernelPlugin, 0.18.231207.1-preview
  • Microsoft.SemanticKernel, 1.0.0-rc3
" ] }, "metadata": {}, @@ -35,7 +35,7 @@ ], "source": [ "#r \"nuget: Microsoft.SemanticKernel, 1.0.0-rc3\"\n", - "#r \"nuget: Microsoft.KernelMemory.SemanticKernelPlugin, 0.17.231206.1-preview\"\n", + "#r \"nuget: Microsoft.KernelMemory.SemanticKernelPlugin, 0.18.231207.1-preview\"\n", "\n", "using Microsoft.SemanticKernel;\n", "using Microsoft.KernelMemory;" @@ -198,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 5, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -292,7 +292,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 7, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -319,7 +319,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 8, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -333,7 +333,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "💫 Orion is a constellation named after a hunter in Greek mythology and also refers to NASA's spacecraft.\n" + "🌌 Orion is a constellation named after a Greek hunter. It is visible in winter and has a spacecraft named after it.\n" ] } ], diff --git a/examples/002-dotnet-SemanticKernelPlugin/002-dotnet-SemanticKernelPlugin.csproj b/examples/002-dotnet-SemanticKernelPlugin/002-dotnet-SemanticKernelPlugin.csproj index 1a82f3f4c..040c44b81 100644 --- a/examples/002-dotnet-SemanticKernelPlugin/002-dotnet-SemanticKernelPlugin.csproj +++ b/examples/002-dotnet-SemanticKernelPlugin/002-dotnet-SemanticKernelPlugin.csproj @@ -13,7 +13,7 @@ - + diff --git a/examples/002-dotnet-SemanticKernelPlugin/Program.cs b/examples/002-dotnet-SemanticKernelPlugin/Program.cs index 5dd8bafc2..a172ef4a1 100644 --- a/examples/002-dotnet-SemanticKernelPlugin/Program.cs +++ b/examples/002-dotnet-SemanticKernelPlugin/Program.cs @@ -20,11 +20,11 @@ public static async Task Main() var builder = new KernelBuilder(); builder // For OpenAI: - //.WithOpenAIChatCompletion( + //.AddOpenAIChatCompletion( // modelId: "gpt-3.5-turbo", // apiKey: EnvVar("OPENAI_API_KEY")) - // Azure OpenAI: - .WithAzureOpenAIChatCompletion( + // Azure OpenAI: + .AddAzureOpenAIChatCompletion( deploymentName: EnvVar("AOAI_DEPLOYMENT_TEXT"), modelId: EnvVar("AOAI_DEPLOYMENT_TEXT"), endpoint: EnvVar("AOAI_ENDPOINT"),