Skip to content

Commit

Permalink
bump sk to 1.0.1 (#85)
Browse files Browse the repository at this point in the history
bump version to 0.13.0
  • Loading branch information
xbotter authored Dec 21, 2023
1 parent 09c74b8 commit 3ab6938
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 96 deletions.
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.KernelMemory.Abstractions" Version="0.11.231121.2-preview+ea157ef" />
<PackageVersion Include="Microsoft.KernelMemory.Core" Version="0.18.231209.1-preview" />
<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.0.0-rc3" />
<PackageVersion Include="Microsoft.SemanticKernel.Core" Version="1.0.0-rc3" />
<PackageVersion Include="Microsoft.KernelMemory.Core" Version="0.23.231219.1" />
<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.0.1" />
<PackageVersion Include="Microsoft.SemanticKernel.Core" Version="1.0.1" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Core" Version="1.0.0-rc3" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Memory" Version="1.0.0-rc3" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Core" Version="1.0.1-alpha" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Memory" Version="1.0.1-alpha" />
<PackageVersion Include="Microsoft.SemanticKernel.TemplateEngine.Basic" Version="1.0.0-beta8" />
<!-- Validation -->
<PackageVersion Include="Microsoft.VisualStudio.Validation" Version="17.8.8" />
Expand All @@ -23,8 +23,8 @@
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
<PackageVersion Include="System.Threading.RateLimiting" Version="8.0.0" />
<PackageVersion Include="xunit" Version="2.6.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageVersion Include="xunit" Version="2.6.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.5" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<!-- Misc -->
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
Expand Down
13 changes: 7 additions & 6 deletions samples/SK-ERNIE-Bot.Sample/Controllers/ApiController.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.AI.ChatCompletion;
using Microsoft.SemanticKernel.AI.Embeddings;
using Microsoft.SemanticKernel.AI.TextGeneration;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Embeddings;
using Microsoft.SemanticKernel.TextGeneration;
using Microsoft.SemanticKernel.Memory;
using SK_ERNIE_Bot.Sample.Controllers.Models;
using System.Text;
using System.Threading;

namespace SK_ERNIE_Bot.Sample.Controllers
{
Expand Down Expand Up @@ -104,18 +105,18 @@ public async Task<IActionResult> FuncAsync([FromBody] UserInput input, Cancellat
""";
var func = _kernel.CreateFunctionFromPrompt(prompt);
var result = await _kernel.InvokeAsync(func,new KernelArguments(input.Text));
var result = await _kernel.InvokeAsync(func, new() { ["input"] = input.Text }, cancellationToken: cancellationToken);
return Ok(result.GetValue<string>());
}

[HttpPost("semanticPlugin")]
public async Task<IActionResult> SemanticPlugin([FromBody] UserInput input)
public async Task<IActionResult> SemanticPlugin([FromBody] UserInput input, CancellationToken cancellationToken)
{
var plugin = _kernel.ImportPluginFromPromptDirectory("Plugins/Demo", "Demo");

var translateFunc = plugin["Translate"];

var result = await _kernel.InvokeAsync(translateFunc, new KernelArguments(input.Text));
var result = await _kernel.InvokeAsync(translateFunc, new() { ["input"] = input.Text }, cancellationToken: cancellationToken);
return Ok(result.GetValue<string>());
}

Expand Down
6 changes: 2 additions & 4 deletions samples/SK-ERNIE-Bot.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ERNIE_Bot.SDK;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Plugins.Memory;
using Microsoft.SemanticKernel.Memory;

var builder = WebApplication.CreateBuilder(args);

Expand All @@ -13,20 +13,18 @@

builder.Services.AddScoped(svc =>
{
var kernel = new KernelBuilder()
var kernel = Kernel.CreateBuilder()
.WithERNIEBotChatCompletionService(svc, builder.Configuration, "ernie_bot", ModelEndpoints.ERNIE_Bot)
.Build();
return kernel;
});

builder.Services.AddScoped(svc =>
{
#pragma warning disable SKEXP0052 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
var memory = new MemoryBuilder()
.WithERNIEBotEmbeddingGenerationService(svc, builder.Configuration)
.WithMemoryStore(new VolatileMemoryStore())
.Build();
#pragma warning restore SKEXP0052 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
return memory;
});

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 @@ -8,6 +8,7 @@
<UserSecretsId>84a2cf80-3689-4f7e-b25f-661eea20cf5d</UserSecretsId>
<LangVersion>11</LangVersion>
<IsPackable>false</IsPackable>
<NoWarn>SKEXP0003;SKEXP0052</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
<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.12.0-preview</Version>
<Version>0.13.0</Version>
<PackageOutputPath>..\..\nupkgs</PackageOutputPath>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<NoWarn>SKEXP0001;SKEXP0002;SKEXP0052;SKEXP0003</NoWarn>

</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/ERNIE-Bot.SemanticKernel/ERNIEBotAIRequestSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.SemanticKernel.AI;
using Microsoft.SemanticKernel;
using System.Text.Json;
using System.Text.Json.Serialization;

Expand Down
7 changes: 3 additions & 4 deletions src/ERNIE-Bot.SemanticKernel/ERNIEBotChatCompletion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
using ERNIE_Bot.SDK;
using ERNIE_Bot.SDK.Models;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.AI;
using Microsoft.SemanticKernel.AI.ChatCompletion;
using Microsoft.SemanticKernel.AI.TextGeneration;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.TextGeneration;
using Microsoft.SemanticKernel.Services;
using System;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -142,7 +141,7 @@ private List<Message> ChatHistoryToMessages(ChatHistory chatHistory, out string?
.Select(m => new Message()
{
Role = AuthorRoleToMessageRole(m.Role),
Content = m.Content
Content = m.Content!
}).ToList();
}

Expand Down
5 changes: 2 additions & 3 deletions src/ERNIE-Bot.SemanticKernel/ERNIEBotChatResult.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using ERNIE_Bot.SDK.Models;
using Microsoft.SemanticKernel.AI.ChatCompletion;
using System.Runtime.CompilerServices;
using System.Text;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;

namespace Connectors.AI.ERNIEBot
{
Expand Down
8 changes: 2 additions & 6 deletions src/ERNIE-Bot.SemanticKernel/ERNIEBotEmbeddingGeneration.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using ERNIE_Bot.SDK;
using ERNIE_Bot.SDK.Models;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.AI.Embeddings;
using Microsoft.SemanticKernel.Services;
using System.Diagnostics.CodeAnalysis;
using Microsoft.SemanticKernel.Embeddings;


[Experimental("SKEXP0001")]
public class ERNIEBotEmbeddingGeneration : ITextEmbeddingGeneration
public class ERNIEBotEmbeddingGeneration : ITextEmbeddingGenerationService
{
private readonly ERNIEBotClient _client;
private readonly Dictionary<string, object?> _attributes = new();
Expand Down
13 changes: 5 additions & 8 deletions src/ERNIE-Bot.SemanticKernel/ERNIEBotKernelBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel.AI.ChatCompletion;
using Microsoft.SemanticKernel.AI.TextGeneration;
using Microsoft.SemanticKernel.Plugins.Memory;
using System.Diagnostics.CodeAnalysis;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.TextGeneration;
using Microsoft.SemanticKernel.Memory;

namespace Microsoft.SemanticKernel
{
Expand All @@ -21,7 +20,7 @@ public static class ERNIEBotKernelBuilderExtensions
/// <param name="serviceId">The service identifier.</param>
/// <param name="modelEndpoint">The model endpoint.</param>
/// <returns>The updated kernel builder.</returns>
public static KernelBuilder WithERNIEBotChatCompletionService(this KernelBuilder builder,
public static IKernelBuilder WithERNIEBotChatCompletionService(this IKernelBuilder builder,
IServiceProvider service, IConfiguration configuration,
string? serviceId = null,
ModelEndpoint? modelEndpoint = null)
Expand All @@ -45,7 +44,7 @@ public static KernelBuilder WithERNIEBotChatCompletionService(this KernelBuilder
/// <param name="alsoAsTextCompletion"></param>
/// <param name="setAsDefault"></param>
/// <returns></returns>
public static KernelBuilder WithERNIEBotChatCompletionService(this KernelBuilder builder,
public static IKernelBuilder WithERNIEBotChatCompletionService(this IKernelBuilder builder,
string clientId, string secret,
string? serviceId = null,
ModelEndpoint? modelEndpoint = null)
Expand All @@ -67,7 +66,6 @@ public static KernelBuilder WithERNIEBotChatCompletionService(this KernelBuilder
/// <param name="configuration"></param>
/// <returns></returns>

[Experimental("SKEXP0052")]
public static MemoryBuilder WithERNIEBotEmbeddingGenerationService(this MemoryBuilder builder,
IServiceProvider service, IConfiguration configuration)
{
Expand All @@ -83,7 +81,6 @@ public static MemoryBuilder WithERNIEBotEmbeddingGenerationService(this MemoryBu
/// <param name="clientId"></param>
/// <param name="secret"></param>
/// <returns></returns>
[Experimental("SKEXP0052")]
public static MemoryBuilder WithERNIEBotEmbeddingGenerationService(this MemoryBuilder builder,
string clientId, string secret)
{
Expand Down
56 changes: 0 additions & 56 deletions src/ERNIE-Bot.SemanticKernel/ExperimentalAttribute.cs

This file was deleted.

0 comments on commit 3ab6938

Please sign in to comment.