Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update sk version to 1.0.0-beta6 #68

Merged
merged 4 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/nuget-build.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
name: nuget-packages
path: ${{ github.workspace }}/nupkgs/*.nupkg


12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageVersion Include="Microsoft.KernelMemory.Core" Version="0.5.231030.1-preview" />
<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.0.0-beta1" />
<PackageVersion Include="Microsoft.SemanticKernel.Core" Version="1.0.0-beta1" />
<PackageVersion Include="Microsoft.KernelMemory.Core" Version="0.8.231113.1-preview" />
<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.0.0-beta6" />
<PackageVersion Include="Microsoft.SemanticKernel.Core" Version="1.0.0-beta6" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Core" Version="1.0.0-beta1" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Memory" Version="1.0.0-beta1" />
<PackageVersion Include="Microsoft.SemanticKernel.TemplateEngine.Basic" Version="1.0.0-beta4" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Core" Version="1.0.0-beta6" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Memory" Version="1.0.0-beta6" />
<PackageVersion Include="Microsoft.SemanticKernel.TemplateEngine.Basic" Version="1.0.0-beta6" />
<!-- Validation -->
<PackageVersion Include="Microsoft.VisualStudio.Validation" Version="17.6.11" />
<!-- Tests -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -7,6 +7,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>84a2cf80-3689-4f7e-b25f-661eea20cf5d</UserSecretsId>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
29 changes: 15 additions & 14 deletions samples/ERNIE-Bot.Sample/ERNIE-Bot.Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>ERNIE_Bot.Sample</RootNamespace>
<UserSecretsId>84a2cf80-3689-4f7e-b25f-661eea20cf5d</UserSecretsId>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>ERNIE_Bot.Sample</RootNamespace>
<UserSecretsId>84a2cf80-3689-4f7e-b25f-661eea20cf5d</UserSecretsId>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\ERNIE-Bot.SDK\ERNIE-Bot.SDK.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ERNIE-Bot.SDK\ERNIE-Bot.SDK.csproj" />
</ItemGroup>

</Project>
1 change: 0 additions & 1 deletion samples/SK-ERNIE-Bot.Sample/Controllers/ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 1 addition & 4 deletions samples/SK-ERNIE-Bot.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -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);

Expand All @@ -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;
});
Expand Down
1 change: 1 addition & 0 deletions samples/SK-ERNIE-Bot.Sample/SK-ERNIE-Bot.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<RootNamespace>SK_ERNIE_Bot.Sample</RootNamespace>
<UserSecretsId>84a2cf80-3689-4f7e-b25f-661eea20cf5d</UserSecretsId>
<LangVersion>11</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/custouch/semantic-kernel-ERNIE-Bot</PackageProjectUrl>
<RepositoryUrl>https://github.com/custouch/semantic-kernel-ERNIE-Bot</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>0.7.0-preview</Version>
<Version>0.8.0-preview</Version>
<PackageOutputPath>..\..\nupkgs</PackageOutputPath>
<PackageReadmeFile>readme.md</PackageReadmeFile>

Expand Down
4 changes: 2 additions & 2 deletions src/ERNIE-Bot.SemanticKernel/ERNIEBotChatCompletion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task<IReadOnlyList<IChatResult>> GetChatCompletionsAsync(ChatHistor
settings.PenaltyScore,
cancellationToken
);
return new List<ERNIEBotChatResult>() { new ERNIEBotChatResult(result) };
return new List<IChatResult>() { new ERNIEBotChatResult(result) };
}


Expand All @@ -66,7 +66,7 @@ public async Task<IReadOnlyList<ITextResult>> GetCompletionsAsync(string text, A
cancellationToken
);

return new List<ERNIEBotChatResult>() { new ERNIEBotChatResult(result) };
return new List<ITextResult>() { new ERNIEBotChatResult(result) }.AsReadOnly();
}

public async IAsyncEnumerable<IChatStreamingResult> GetStreamingChatCompletionsAsync(ChatHistory chat, AIRequestSettings? requestSettings = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
Expand Down
2 changes: 1 addition & 1 deletion src/ERNIE-Bot.SemanticKernel/ERNIEBotChatResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChatResponse>? _responses;
Expand Down