From 9e9a6a1488bb22aa29d97824b7ab78580dda8d25 Mon Sep 17 00:00:00 2001 From: name Date: Fri, 19 May 2023 13:34:09 -0700 Subject: [PATCH] fixing tests --- .../Connectors/OpenAI/OpenAICompletionTests.cs | 16 ++++++++++++---- dotnet/src/SemanticKernel/Planning/Plan.cs | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dotnet/src/IntegrationTests/Connectors/OpenAI/OpenAICompletionTests.cs b/dotnet/src/IntegrationTests/Connectors/OpenAI/OpenAICompletionTests.cs index fb44827089ac..1d3daa0e8f83 100644 --- a/dotnet/src/IntegrationTests/Connectors/OpenAI/OpenAICompletionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/OpenAI/OpenAICompletionTests.cs @@ -3,11 +3,13 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.AI; using Microsoft.SemanticKernel.Orchestration; +using Microsoft.SemanticKernel.Reliability; using Microsoft.SemanticKernel.SkillDefinition; using SemanticKernel.IntegrationTests.TestSettings; using Xunit; @@ -86,8 +88,10 @@ public async Task OpenAIChatAsTextTestAsync(string prompt, string expectedAnswer public async Task CanUseOpenAiChatForTextCompletionAsync() { // Note: we use OpenAi Chat Completion and GPT 3.5 Turbo - IKernel target = Kernel.Builder.WithLogger(this._logger).Build(); - this.ConfigureChatOpenAI(target); + KernelBuilder builder = Kernel.Builder.WithLogger(this._logger); + this.ConfigureChatOpenAI(builder); + + IKernel target = builder.Build(); var func = target.CreateSemanticFunction( "List the two planets after '{{$input}}', excluding moons, using bullet points."); @@ -169,17 +173,21 @@ public async Task AzureOpenAIHttpRetryPolicyTestAsync(string prompt, string expe // Arrange var retryConfig = new HttpRetryConfig(); retryConfig.RetryableStatusCodes.Add(HttpStatusCode.Unauthorized); - IKernel target = Kernel.Builder.WithLogger(this._testOutputHelper).Configure(c => c.SetDefaultHttpRetryConfig(retryConfig)).Build(); + KernelBuilder builder = Kernel.Builder + .WithLogger(this._testOutputHelper) + .Configure(c => c.SetDefaultHttpRetryConfig(retryConfig)); var azureOpenAIConfiguration = this._configuration.GetSection("AzureOpenAI").Get(); Assert.NotNull(azureOpenAIConfiguration); // Use an invalid API key to force a 401 Unauthorized response - target.Config.AddAzureTextCompletionService( + builder.WithAzureTextCompletionService( deploymentName: azureOpenAIConfiguration.DeploymentName, endpoint: azureOpenAIConfiguration.Endpoint, apiKey: "INVALID_KEY"); + IKernel target = builder.Build(); + IDictionary skill = TestHelpers.GetSkills(target, "SummarizeSkill"); // Act diff --git a/dotnet/src/SemanticKernel/Planning/Plan.cs b/dotnet/src/SemanticKernel/Planning/Plan.cs index be75527382bc..8792e51d4564 100644 --- a/dotnet/src/SemanticKernel/Planning/Plan.cs +++ b/dotnet/src/SemanticKernel/Planning/Plan.cs @@ -101,6 +101,7 @@ public Plan(string goal) public Plan(string goal, params ISKFunction[] steps) : this(goal) { this.AddSteps(steps); + } ///