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/Directory.Packages.props b/Directory.Packages.props index 6318cfd..039cd6b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,14 +7,14 @@ - - - + + + - - - + + + 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/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/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 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 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;