Skip to content

Commit

Permalink
Merge pull request #95 from ivatilca/main
Browse files Browse the repository at this point in the history
Update to SK 1.0.1
  • Loading branch information
markwallace-microsoft authored Feb 18, 2024
2 parents f3771ac + a663508 commit 13ef8a8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
15 changes: 9 additions & 6 deletions sk-csharp-hello-world/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.AI.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.AI.OpenAI;
using Microsoft.SemanticKernel.PromptTemplate.Handlebars;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Microsoft.SemanticKernel.PromptTemplates.Handlebars;
using Plugins;

var kernelSettings = KernelSettings.LoadSettings();

KernelBuilder builder = new();
var builder = Kernel.CreateBuilder();
builder.Services.AddLogging(c => c.SetMinimumLevel(LogLevel.Information).AddDebug());
builder.Services.AddChatCompletionService(kernelSettings);
builder.Plugins.AddFromType<LightPlugin>();
Expand All @@ -36,7 +36,7 @@
// Get the chat completions
OpenAIPromptExecutionSettings openAIPromptExecutionSettings = new()
{
FunctionCallBehavior = FunctionCallBehavior.AutoInvokeKernelFunctions
ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions
};

var result = kernel.InvokeStreamingAsync<StreamingChatMessageContent>(
Expand Down Expand Up @@ -67,5 +67,8 @@
}
}
System.Console.WriteLine();
chatMessages.AddMessage(chatMessageContent!);
if (chatMessageContent != null)
{
chatMessages.AddMessage(chatMessageContent.Role, chatMessageContent.Content!);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static IServiceCollection AddChatCompletionService(this IServiceCollect
switch (kernelSettings.ServiceType.ToUpperInvariant())
{
case ServiceTypes.AzureOpenAI:
serviceCollection = serviceCollection.AddAzureOpenAIChatCompletion(kernelSettings.DeploymentId, kernelSettings.ModelId, endpoint: kernelSettings.Endpoint, apiKey: kernelSettings.ApiKey, serviceId: kernelSettings.ServiceId);
serviceCollection = serviceCollection.AddAzureOpenAIChatCompletion(kernelSettings.DeploymentId, endpoint: kernelSettings.Endpoint, apiKey: kernelSettings.ApiKey, serviceId: kernelSettings.ServiceId);
break;

case ServiceTypes.OpenAI:
Expand Down
2 changes: 1 addition & 1 deletion sk-csharp-hello-world/plugins/LightPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.AI.ChatCompletion;
using Microsoft.SemanticKernel.ChatCompletion;

namespace Plugins;

Expand Down
8 changes: 4 additions & 4 deletions sk-csharp-hello-world/sk-csharp-hello-world.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.0.0-rc3" />
<PackageReference Include="Microsoft.SemanticKernel.PromptTemplate.Handlebars" Version="1.0.0-rc3" />
<PackageReference Include="Microsoft.SemanticKernel.Yaml" Version="1.0.0-rc3" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.0.1" />
<PackageReference Include="Microsoft.SemanticKernel.PromptTemplates.Handlebars" Version="1.0.1" />
<PackageReference Include="Microsoft.SemanticKernel.Yaml" Version="1.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 13ef8a8

Please sign in to comment.