From c1ba439716c499d8ad29598cb46919240c752a48 Mon Sep 17 00:00:00 2001 From: xbotter Date: Mon, 13 Nov 2023 17:32:48 +0800 Subject: [PATCH 1/4] update sk beta6 --- Directory.Packages.props | 10 +++++----- .../SK-ERNIE-Bot.Sample/Controllers/ApiController.cs | 1 - samples/SK-ERNIE-Bot.Sample/Program.cs | 5 +---- src/ERNIE-Bot.SemanticKernel/ERNIEBotChatCompletion.cs | 4 ++-- src/ERNIE-Bot.SemanticKernel/ERNIEBotChatResult.cs | 2 +- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 6318cfd..a9825db 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,13 +8,13 @@ - - + + - - - + + + diff --git a/samples/SK-ERNIE-Bot.Sample/Controllers/ApiController.cs b/samples/SK-ERNIE-Bot.Sample/Controllers/ApiController.cs index dcff94e..36022df 100644 --- a/samples/SK-ERNIE-Bot.Sample/Controllers/ApiController.cs +++ b/samples/SK-ERNIE-Bot.Sample/Controllers/ApiController.cs @@ -4,7 +4,6 @@ using Microsoft.SemanticKernel.AI.ChatCompletion; using Microsoft.SemanticKernel.AI.Embeddings; using Microsoft.SemanticKernel.AI.TextCompletion; -using Microsoft.SemanticKernel.SemanticFunctions; using SK_ERNIE_Bot.Sample.Controllers.Models; using System.Text; diff --git a/samples/SK-ERNIE-Bot.Sample/Program.cs b/samples/SK-ERNIE-Bot.Sample/Program.cs index eaef1b8..1e7b5fe 100644 --- a/samples/SK-ERNIE-Bot.Sample/Program.cs +++ b/samples/SK-ERNIE-Bot.Sample/Program.cs @@ -1,8 +1,6 @@ using ERNIE_Bot.SDK; using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.Plugins.Memory; -using Microsoft.SemanticKernel.TemplateEngine; -using Microsoft.SemanticKernel.TemplateEngine.Basic; var builder = WebApplication.CreateBuilder(args); @@ -15,9 +13,8 @@ builder.Services.AddScoped(svc => { - var kernel = Kernel.Builder + var kernel = new KernelBuilder() .WithERNIEBotChatCompletionService(svc, builder.Configuration, "ernie_bot", ModelEndpoints.ERNIE_Bot) - .WithPromptTemplateEngine(new BasicPromptTemplateEngine()) .Build(); return kernel; }); diff --git a/src/ERNIE-Bot.SemanticKernel/ERNIEBotChatCompletion.cs b/src/ERNIE-Bot.SemanticKernel/ERNIEBotChatCompletion.cs index 1440e4f..fa28bd1 100644 --- a/src/ERNIE-Bot.SemanticKernel/ERNIEBotChatCompletion.cs +++ b/src/ERNIE-Bot.SemanticKernel/ERNIEBotChatCompletion.cs @@ -47,7 +47,7 @@ public async Task> GetChatCompletionsAsync(ChatHistor settings.PenaltyScore, cancellationToken ); - return new List() { new ERNIEBotChatResult(result) }; + return new List() { new ERNIEBotChatResult(result) }; } @@ -66,7 +66,7 @@ public async Task> GetCompletionsAsync(string text, A cancellationToken ); - return new List() { new ERNIEBotChatResult(result) }; + return new List() { new ERNIEBotChatResult(result) }.AsReadOnly(); } public async IAsyncEnumerable GetStreamingChatCompletionsAsync(ChatHistory chat, AIRequestSettings? requestSettings = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) diff --git a/src/ERNIE-Bot.SemanticKernel/ERNIEBotChatResult.cs b/src/ERNIE-Bot.SemanticKernel/ERNIEBotChatResult.cs index df8061d..3248372 100644 --- a/src/ERNIE-Bot.SemanticKernel/ERNIEBotChatResult.cs +++ b/src/ERNIE-Bot.SemanticKernel/ERNIEBotChatResult.cs @@ -18,7 +18,7 @@ public ERNIEBotChatMessage(string content) } } - internal class ERNIEBotChatResult : IChatStreamingResult, ITextStreamingResult + internal class ERNIEBotChatResult : IChatResult, ITextResult, IChatStreamingResult, ITextStreamingResult { private readonly ChatResponse? _response; private readonly IAsyncEnumerable? _responses; From 06d6981692d0555eb2c435d44d1c681f215234de Mon Sep 17 00:00:00 2001 From: xbotter Date: Tue, 14 Nov 2023 09:14:59 +0800 Subject: [PATCH 2/4] update kernel memory version --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index a9825db..039cd6b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From 7901aa80ba8ad86337fd6b1f378b42daf4bb8318 Mon Sep 17 00:00:00 2001 From: xbotter Date: Tue, 14 Nov 2023 09:16:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=80=20Update=20version=20to=200.8.?= =?UTF-8?q?0-preview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the version in Directory.Build.props to 0.8.0-preview. --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c13d5b2..b790e04 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -12,7 +12,7 @@ https://github.com/custouch/semantic-kernel-ERNIE-Bot https://github.com/custouch/semantic-kernel-ERNIE-Bot git - 0.7.0-preview + 0.8.0-preview ..\..\nupkgs readme.md From 9dde868b867386996efb30060725a46f33b40469 Mon Sep 17 00:00:00 2001 From: xbotter Date: Tue, 14 Nov 2023 09:31:46 +0800 Subject: [PATCH 4/4] Nuget Build CI --- .github/workflows/nuget-build.yml | 33 +++++++++++++++++++ .../ERNIE-Bot-Kernel-Memory.Sample.csproj | 3 +- .../ERNIE-Bot.Sample/ERNIE-Bot.Sample.csproj | 29 ++++++++-------- .../SK-ERNIE-Bot.Sample.csproj | 1 + 4 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/nuget-build.yml diff --git a/.github/workflows/nuget-build.yml b/.github/workflows/nuget-build.yml new file mode 100644 index 0000000..5758ebc --- /dev/null +++ b/.github/workflows/nuget-build.yml @@ -0,0 +1,33 @@ +name: NuGet-Build + +on: + workflow_dispatch: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + env: + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Pack + run: dotnet pack --configuration Release --include-symbols --include-source -o nupkgs + - name: Upload Artifact + uses: actions/upload-artifact@v3.1.3 + with: + name: nuget-packages + path: ${{ github.workspace }}/nupkgs/*.nupkg + + diff --git a/samples/ERNIE-Bot-Kernel-Memory.Sample/ERNIE-Bot-Kernel-Memory.Sample.csproj b/samples/ERNIE-Bot-Kernel-Memory.Sample/ERNIE-Bot-Kernel-Memory.Sample.csproj index 51420d6..03911d0 100644 --- a/samples/ERNIE-Bot-Kernel-Memory.Sample/ERNIE-Bot-Kernel-Memory.Sample.csproj +++ b/samples/ERNIE-Bot-Kernel-Memory.Sample/ERNIE-Bot-Kernel-Memory.Sample.csproj @@ -1,4 +1,4 @@ - + Exe @@ -7,6 +7,7 @@ enable 84a2cf80-3689-4f7e-b25f-661eea20cf5d enable + false diff --git a/samples/ERNIE-Bot.Sample/ERNIE-Bot.Sample.csproj b/samples/ERNIE-Bot.Sample/ERNIE-Bot.Sample.csproj index 3045329..e6fdbee 100644 --- a/samples/ERNIE-Bot.Sample/ERNIE-Bot.Sample.csproj +++ b/samples/ERNIE-Bot.Sample/ERNIE-Bot.Sample.csproj @@ -1,19 +1,20 @@ - + - - net6.0 - enable - enable - ERNIE_Bot.Sample - 84a2cf80-3689-4f7e-b25f-661eea20cf5d - + + net6.0 + enable + enable + ERNIE_Bot.Sample + 84a2cf80-3689-4f7e-b25f-661eea20cf5d + false + - - - + + + - - - + + + diff --git a/samples/SK-ERNIE-Bot.Sample/SK-ERNIE-Bot.Sample.csproj b/samples/SK-ERNIE-Bot.Sample/SK-ERNIE-Bot.Sample.csproj index 67b3e05..c87d979 100644 --- a/samples/SK-ERNIE-Bot.Sample/SK-ERNIE-Bot.Sample.csproj +++ b/samples/SK-ERNIE-Bot.Sample/SK-ERNIE-Bot.Sample.csproj @@ -7,6 +7,7 @@ SK_ERNIE_Bot.Sample 84a2cf80-3689-4f7e-b25f-661eea20cf5d 11 + false