Skip to content

Commit

Permalink
Update CC to SK 1.0.0 Beta 6 (#609)
Browse files Browse the repository at this point in the history
### Motivation and Context
A few breaking changes occurred in SK 1.0.0 beta 6

### Description
Update to SK 1.0.0 beta 6 and adapt code to support the breaking changes
from the library

### Contribution Checklist
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
  • Loading branch information
glahaye authored Nov 14, 2023
1 parent 605a43e commit 1a49aed
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions memorypipeline/CopilotChatMemoryPipeline.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.8.231108.1-preview" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.8.231113.1-preview" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.0.0-beta6" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion shared/CopilotChatShared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.8.231108.1-preview" />
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.8.231113.1-preview" />
<PackageReference Include="Tesseract" Version="5.2.0" />
</ItemGroup>

Expand Down
8 changes: 4 additions & 4 deletions webapi/Controllers/ChatController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private async Task RegisterPlannerFunctionsAsync(CopilotChatPlanner planner, Dic
{
this._logger.LogInformation("Enabling GitHub plugin.");
BearerAuthenticationProvider authenticationProvider = new(() => Task.FromResult(GithubAuthHeader));
await planner.Kernel.ImportPluginFunctionsAsync(
await planner.Kernel.ImportOpenApiPluginFunctionsAsync(
pluginName: "GitHubPlugin",
filePath: Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Plugins", "OpenApi/GitHubPlugin/openapi.json"),
new OpenApiFunctionExecutionParameters
Expand All @@ -295,7 +295,7 @@ await planner.Kernel.ImportPluginFunctionsAsync(
var authenticationProvider = new BasicAuthenticationProvider(() => { return Task.FromResult(JiraAuthHeader); });
var hasServerUrlOverride = variables.TryGetValue("jira-server-url", out string? serverUrlOverride);

await planner.Kernel.ImportPluginFunctionsAsync(
await planner.Kernel.ImportOpenApiPluginFunctionsAsync(
pluginName: "JiraPlugin",
filePath: Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Plugins", "OpenApi/JiraPlugin/openapi.json"),
new OpenApiFunctionExecutionParameters
Expand Down Expand Up @@ -334,7 +334,7 @@ await planner.Kernel.ImportPluginFunctionsAsync(
var requiresAuth = !plugin.AuthType.Equals("none", StringComparison.OrdinalIgnoreCase);
BearerAuthenticationProvider authenticationProvider = new(() => Task.FromResult(PluginAuthValue));

await planner.Kernel.ImportPluginFunctionsAsync(
await planner.Kernel.ImportOpenApiPluginFunctionsAsync(
$"{plugin.NameForModel}Plugin",
PluginUtils.GetPluginManifestUri(plugin.ManifestDomain),
new OpenApiFunctionExecutionParameters
Expand Down Expand Up @@ -386,7 +386,7 @@ private async Task RegisterPlannerHostedFunctionsUsedAsync(CopilotChatPlanner pl
() => Task.FromResult(plugin.Key));

// Register the ChatGPT plugin with the planner's kernel.
await planner.Kernel.ImportPluginFunctionsAsync(
await planner.Kernel.ImportOpenApiPluginFunctionsAsync(
PluginUtils.SanitizePluginName(plugin.Name),
PluginUtils.GetPluginManifestUri(plugin.ManifestDomain),
new OpenApiFunctionExecutionParameters
Expand Down
28 changes: 14 additions & 14 deletions webapi/CopilotChatWebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.36.0" />
<PackageReference Include="Microsoft.Identity.Web" Version="2.15.3" />
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.8.231108.1-preview" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.Abstractions" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.AI.OpenAI" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.Functions.OpenAPI" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.Planners.Core" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.Plugins.Core" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.Plugins.MsGraph" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.Plugins.Web" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.SemanticKernel.TemplateEngine.Basic" Version="1.0.0-beta5" />
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.8.231113.1-preview" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.Abstractions" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.AI.OpenAI" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Qdrant" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.Functions.OpenAPI" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.Planners.Core" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.Plugins.Core" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.Plugins.MsGraph" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.Plugins.Web" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel.TemplateEngine.Basic" Version="1.0.0-beta6" />
<PackageReference Include="SharpToken" Version="1.2.12" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
Expand All @@ -57,7 +57,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageReference Include="Roslynator.Analyzers" Version="4.6.1">
<PackageReference Include="Roslynator.Analyzers" Version="4.6.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -67,7 +67,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.6.1">
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.6.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions webapi/Services/SemanticKernelProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static KernelBuilder InitializeCompletionKernel(
case string y when y.Equals("AzureOpenAIText", StringComparison.OrdinalIgnoreCase):
var azureAIOptions = memoryOptions.GetServiceConfig<AzureOpenAIConfig>(configuration, "AzureOpenAIText");
#pragma warning disable CA2000 // No need to dispose of HttpClient instances from IHttpClientFactory
builder.WithAzureChatCompletionService(
builder.WithAzureOpenAIChatCompletionService(
azureAIOptions.Deployment,
azureAIOptions.Endpoint,
azureAIOptions.APIKey,
Expand Down Expand Up @@ -112,7 +112,7 @@ private static KernelBuilder InitializePlannerKernel(
case string y when y.Equals("AzureOpenAIText", StringComparison.OrdinalIgnoreCase):
var azureAIOptions = memoryOptions.GetServiceConfig<AzureOpenAIConfig>(configuration, "AzureOpenAIText");
#pragma warning disable CA2000 // No need to dispose of HttpClient instances from IHttpClientFactory
builder.WithAzureChatCompletionService(
builder.WithAzureOpenAIChatCompletionService(
plannerOptions.Model,
azureAIOptions.Endpoint,
azureAIOptions.APIKey,
Expand Down Expand Up @@ -155,7 +155,7 @@ private static MemoryBuilder InitializeMigrationMemory(
case string y when y.Equals("AzureOpenAIEmbedding", StringComparison.OrdinalIgnoreCase):
var azureAIOptions = memoryOptions.GetServiceConfig<AzureOpenAIConfig>(configuration, "AzureOpenAIEmbedding");
#pragma warning disable CA2000 // No need to dispose of HttpClient instances from IHttpClientFactory
builder.WithAzureTextEmbeddingGenerationService(
builder.WithAzureOpenAITextEmbeddingGenerationService(
azureAIOptions.Deployment,
azureAIOptions.Endpoint,
azureAIOptions.APIKey,
Expand Down

0 comments on commit 1a49aed

Please sign in to comment.