diff --git a/dotnet/samples/Concepts/ChatCompletion/OpenAI_StructuredOutputs.cs b/dotnet/samples/Concepts/ChatCompletion/OpenAI_StructuredOutputs.cs index 426a191944a0..9aed38a8a56c 100644 --- a/dotnet/samples/Concepts/ChatCompletion/OpenAI_StructuredOutputs.cs +++ b/dotnet/samples/Concepts/ChatCompletion/OpenAI_StructuredOutputs.cs @@ -299,10 +299,7 @@ public async Task StructuredOutputsWithFunctionsFromYamlAsync() var functionPath = Path.Combine(Directory.GetCurrentDirectory(), "Resources", "Plugins", "MoviePlugins", "MoviePluginYaml", "TopMovies.yaml"); // Load YAML prompt. - using Stream stream = File.OpenRead(functionPath); - using StreamReader reader = new(stream); - - var topMoviesYaml = reader.ReadToEnd(); + var topMoviesYaml = File.ReadAllText(functionPath); // Import a function from YAML. var function = kernel.CreateFunctionFromPromptYaml(topMoviesYaml); diff --git a/dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Helpers/OpenAIChatResponseFormatHelperTests.cs b/dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Helpers/OpenAIChatResponseFormatBuilderTests.cs similarity index 93% rename from dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Helpers/OpenAIChatResponseFormatHelperTests.cs rename to dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Helpers/OpenAIChatResponseFormatBuilderTests.cs index 7530cbabe7df..13a5862b19b7 100644 --- a/dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Helpers/OpenAIChatResponseFormatHelperTests.cs +++ b/dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Helpers/OpenAIChatResponseFormatBuilderTests.cs @@ -10,13 +10,13 @@ namespace SemanticKernel.Connectors.OpenAI.UnitTests.Helpers; /// -/// Unit tests for class. +/// Unit tests for class. /// -public sealed class OpenAIChatResponseFormatHelperTests +public sealed class OpenAIChatResponseFormatBuilderTests { private readonly JsonSerializerOptions _options = new(); - public OpenAIChatResponseFormatHelperTests() + public OpenAIChatResponseFormatBuilderTests() { this._options.Converters.Add(new BinaryDataJsonConverter()); } @@ -33,7 +33,7 @@ public void GetJsonSchemaResponseFormatReturnsChatResponseFormatByDefault( var jsonElement = jsonDocument.RootElement; // Act - var chatResponseFormat = OpenAIChatResponseFormatHelper.GetJsonSchemaResponseFormat(jsonElement); + var chatResponseFormat = OpenAIChatResponseFormatBuilder.GetJsonSchemaResponseFormat(jsonElement); var responseFormat = this.GetResponseFormat(chatResponseFormat); // Assert @@ -79,7 +79,7 @@ public void GetJsonSchemaResponseFormatThrowsExceptionWhenSchemaDoesNotExist() var jsonElement = jsonDocument.RootElement; // Act & Assert - Assert.Throws(() => OpenAIChatResponseFormatHelper.GetJsonSchemaResponseFormat(jsonElement)); + Assert.Throws(() => OpenAIChatResponseFormatBuilder.GetJsonSchemaResponseFormat(jsonElement)); } public static TheoryData ChatResponseFormatJson => new() diff --git a/dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.ChatCompletion.cs b/dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.ChatCompletion.cs index 8800ef8bf306..9d03c3322964 100644 --- a/dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.ChatCompletion.cs +++ b/dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.ChatCompletion.cs @@ -540,10 +540,10 @@ protected virtual ChatCompletionOptions CreateChatCompletionOptions( } } - return OpenAIChatResponseFormatHelper.GetJsonSchemaResponseFormat(formatElement); + return OpenAIChatResponseFormatBuilder.GetJsonSchemaResponseFormat(formatElement); case Type formatObjectType: - return OpenAIChatResponseFormatHelper.GetJsonSchemaResponseFormat(formatObjectType); + return OpenAIChatResponseFormatBuilder.GetJsonSchemaResponseFormat(formatObjectType); } return null; diff --git a/dotnet/src/Connectors/Connectors.OpenAI/Helpers/OpenAIChatResponseFormatHelper.cs b/dotnet/src/Connectors/Connectors.OpenAI/Helpers/OpenAIChatResponseFormatBuilder.cs similarity index 96% rename from dotnet/src/Connectors/Connectors.OpenAI/Helpers/OpenAIChatResponseFormatHelper.cs rename to dotnet/src/Connectors/Connectors.OpenAI/Helpers/OpenAIChatResponseFormatBuilder.cs index e6415c4f606b..835d4c19ae32 100644 --- a/dotnet/src/Connectors/Connectors.OpenAI/Helpers/OpenAIChatResponseFormatHelper.cs +++ b/dotnet/src/Connectors/Connectors.OpenAI/Helpers/OpenAIChatResponseFormatBuilder.cs @@ -9,9 +9,9 @@ namespace Microsoft.SemanticKernel.Connectors.OpenAI; /// -/// Helper class to process object. +/// Helper class to build object. /// -internal static class OpenAIChatResponseFormatHelper +internal static class OpenAIChatResponseFormatBuilder { /// /// for JSON schema format for structured outputs.