From ef15ba463bfc01b5a9dadeee5b6bd374d9563108 Mon Sep 17 00:00:00 2001 From: Jose Arriaga Maldonado Date: Fri, 7 Feb 2025 13:20:55 -0800 Subject: [PATCH 1/4] Prepare 2.2.0-beta.1 release (Part 2) --- CHANGELOG.md | 58 ++++++++++++++++++++++++++++++++++++----------- src/OpenAI.csproj | 4 ++-- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9854cf260..275778c17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,55 @@ # Release History -## 2.2.0-beta.1 (Unreleased) +## 2.2.0-beta.1 (2025-02-07) ### Features added -- Chat completion now supports audio input and output! - - To configure a chat completion to request audio output using the `gpt-4o-audio-preview` model, use `ChatResponseModalities.Text | ChatResponseModalities.Audio` as the value for `ChatCompletionOptions.ResponseModalities` and create a `ChatAudioOptions` instance for `ChatCompletionOptions.AudioOptions`. - - Input chat audio is provided to `UserChatMessage` instances using `ChatContentPart.CreateInputAudioPart()` - - Output chat audio is provided on the `OutputAudio` property of `ChatCompletion` - - References to prior assistant audio are provided via `OutputAudioReference` instances on the `AudioReference` property of `AssistantChatMessage`; `AssistantChatMessage(chatCompletion)` will automatically handle this, too - - For more information, see the example in the README -- Predicted output can be used with chat completion: the new `OutputPrediction` property on `ChatCompletionOptions` can be populated with `ChatMessageContentPart` instances via `ChatOutputPrediction.CreateStaticContentPrediction()` to substantially accelerate some varieties of requests. -- For `o3-mini`, `o1`, and later models with reasoning capabilities: - - The new `DeveloperChatMessage`, which replaces `SystemChatMessage`, can be used to provide instructions to the model - - `ChatCompletionOptions` can specify a `ReasoningEffortLevel` property to adjust the level of token consumption the model will attempt to apply +- OpenAI.Audio: + - Added explicit support for new values of `GeneretedSpeechVoice`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) +- OpenAI.Chat: + - Enabled support for input and output audio in chat completions using the `gpt-4o-audio-preview` model. + - Added a `ResponseModalities` property to `ChatCompletionOptions` ([`modalities` in the REST API](https://platform.openai.com/docs/api-reference/chat/create)). ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Set this flags enum property to `ChatResponseModalities.Text | ChatResponseModalities.Audio` in order to request audio output. Note that you need to set the new `AudioOptions` property too. + - Added an `AudioOptions` property to `ChatCompletionOptions` ([`audio` in the REST API](https://platform.openai.com/docs/api-reference/chat/create)). ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Use this property to configure the output audio voice and format. + - Added a `CreateInputAudioPart(BinaryData, ChatInputAudioFormat)` static method to `ChatMessageContentPart`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Use this method to send input audio in the `Content` of a `UserChatMessage`. + - Added an `OutputAudio` property to `ChatCompletion`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Added an `OutputAudioReference` property to `AssistantChatMessage`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Use this property to reference the output audio of a prior `ChatCompletion` to continue an existing chat. + - For more information, see the example in the [README](README). + - Enabled support for [Predicted Outputs](https://platform.openai.com/docs/guides/predicted-outputs) in chat completions using the `gpt-4o` and `gpt-4o-mini` models. Predicted Outputs can greatly improve response times when large parts of the model response are known ahead of time. This is most common when you are regenerating a file with only minor changes to most of the content. + - Added an `OutputPrediction` property to `ChatCompletionOptions` ([`prediction` in the REST API](https://platform.openai.com/docs/api-reference/chat/create)). ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Use this property to configure a Predicted Output. The property is of a new type called `ChatOutputPrediction`, which you can create via the `ChatOutputPrediction.CreateStaticContentPrediction(string)` or `ChatOutputPrediction.CreateStaticContentPrediction(IEnumerable)` static methods. + - Added a `AcceptedPredictionTokenCount` property to `ChatOutputTokenUsageDetails`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - When using Predicted Outputs, use this property to track the number of tokens in the prediction that appeared in the completion. + - Added a `RejectedPredictionTokenCount` property to `ChatOutputTokenUsageDetails`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - When using Predicted Outputs, use this property to track the number of tokens in the prediction that did not appear in the completion. Note that these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits. + - Added a `ReasoningEffortLevel` property to `ChatCompletionOptions` ([`reasoning_effort` in the REST API](https://platform.openai.com/docs/api-reference/chat/create)). ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Use this property to constrain the effort on reasoning for the models with reasoning capabilities (such as `o3-mini` and `o1`). Reducing the reasoning effort can result in faster responses and fewer tokens used on reasoning. + - Added a `DeveloperChatMessage` class. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Use this type of message to provide instructions that the model should follow, regardless of messages sent by the user. It replaces the existing `SystemChatMessage` class when using `o1` and newer models. +- OpenAI.RealtimeConversation: + - Added explicit support for new values of `ConversationVoice`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) -### `[Experimental]` Breaking changes +### Breaking changes in Preview APIs + +- OpenAI.Assistants: + - Removed the setters of the `IDictionary Metadata` properties of the "options" classes (e.g., `AssistantCreationOptions`) to be able to guarantee that the collections are always initialized. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - The dictionaries remain writeable, and you can add elements to it using collection initializer syntax or the `Add(TKey, TValue)` method. +- OpenAI.RealtimeConversation: + - Renamed the `InputTokens`, `OutputTokens`, and `TotalTokens` properties in `ConversationTokenUsage` to `InputTokenCount`, `OutputTokenCount`, and `TotalTokenCount`, respectively. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Renamed the `AudioTokens`, `CachedTokens`, and `TextTokens` properties in `ConversationInputTokenUsageDetails` to `AudioTokenCount`, `CachedTokenCount`, and `TextTokenCount`, respectively. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Renamed the `AudioTokens` and `TextTokens` properties in `ConversationOutputTokenUsageDetails` to `AudioTokenCount` and `TextTokenCount`, respectively. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) +- OpenAI.VectorStores: + - Removed the setters of the `IDictionary Metadata` properties of the "options" classes (e.g., `VectorStoreCreationOptions`) to be able to guarantee that the collections are always initialized. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - The dictionaries remain writeable, and you can add elements to it using collection initializer syntax or the `Add(TKey, TValue)` method. + +### Other Changes -- The `IDictionary Metadata` property in several request options types in the Assistants and RealtimeConversation areas have had their setters removed, aligning them with other request use of collections. The dictionaries remain writeable and use both initializer syntax and range copies to produce the same effect. +- Added .NET 8 as a target framework. ([6203354](https://github.com/openai/openai-dotnet/commit/6203354b36395fa79a34e3b4fd7b97b43b9720b9)) +- Enabled support for trimming. ([4cd8529](https://github.com/openai/openai-dotnet/commit/4cd85298d110afcbef40f07746d6502a73493e16)) +- Enabled support for native AOT compilation. ([4cd8529](https://github.com/openai/openai-dotnet/commit/4cd85298d110afcbef40f07746d6502a73493e16)) ## 2.1.0 (2024-12-04) diff --git a/src/OpenAI.csproj b/src/OpenAI.csproj index f0d283ce3..6e426f6a1 100644 --- a/src/OpenAI.csproj +++ b/src/OpenAI.csproj @@ -6,8 +6,8 @@ SDK Code Generation OpenAI OpenAI;openai-dotnet;ChatGPT;Dall-E - 2.1.0 - + 2.2.0 + beta.1 net8.0;net6.0;netstandard2.0 latest From 0eca53bda82209099c8963f49c7d567061e94113 Mon Sep 17 00:00:00 2001 From: Jose Arriaga Maldonado Date: Fri, 7 Feb 2025 13:26:50 -0800 Subject: [PATCH 2/4] Fix README link --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 275778c17..0f9de1240 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ - Added an `OutputAudio` property to `ChatCompletion`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - Added an `OutputAudioReference` property to `AssistantChatMessage`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - Use this property to reference the output audio of a prior `ChatCompletion` to continue an existing chat. - - For more information, see the example in the [README](README). + - For more information, see the example in the [README](README.md). - Enabled support for [Predicted Outputs](https://platform.openai.com/docs/guides/predicted-outputs) in chat completions using the `gpt-4o` and `gpt-4o-mini` models. Predicted Outputs can greatly improve response times when large parts of the model response are known ahead of time. This is most common when you are regenerating a file with only minor changes to most of the content. - Added an `OutputPrediction` property to `ChatCompletionOptions` ([`prediction` in the REST API](https://platform.openai.com/docs/api-reference/chat/create)). ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - Use this property to configure a Predicted Output. The property is of a new type called `ChatOutputPrediction`, which you can create via the `ChatOutputPrediction.CreateStaticContentPrediction(string)` or `ChatOutputPrediction.CreateStaticContentPrediction(IEnumerable)` static methods. From 255c5b367f5cad65e26baac32d70e2dead49a350 Mon Sep 17 00:00:00 2001 From: Jose Arriaga Maldonado <45773732+joseharriaga@users.noreply.github.com> Date: Fri, 7 Feb 2025 13:27:29 -0800 Subject: [PATCH 3/4] Update CHANGELOG.md Co-authored-by: Travis Wilson <35748617+trrwilson@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f9de1240..55737b12b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### Features added - OpenAI.Audio: - - Added explicit support for new values of `GeneretedSpeechVoice`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Added explicit support for new values of `GeneratedSpeechVoice`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - OpenAI.Chat: - Enabled support for input and output audio in chat completions using the `gpt-4o-audio-preview` model. - Added a `ResponseModalities` property to `ChatCompletionOptions` ([`modalities` in the REST API](https://platform.openai.com/docs/api-reference/chat/create)). ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) From e910a321efb1f5c85c7924d9632f3f9f8da98f04 Mon Sep 17 00:00:00 2001 From: Jose Arriaga Maldonado Date: Fri, 7 Feb 2025 13:36:43 -0800 Subject: [PATCH 4/4] A few more CHANGELOG fixes --- CHANGELOG.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55737b12b..06366df59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,19 +9,20 @@ - OpenAI.Chat: - Enabled support for input and output audio in chat completions using the `gpt-4o-audio-preview` model. - Added a `ResponseModalities` property to `ChatCompletionOptions` ([`modalities` in the REST API](https://platform.openai.com/docs/api-reference/chat/create)). ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - - Set this flags enum property to `ChatResponseModalities.Text | ChatResponseModalities.Audio` in order to request audio output. Note that you need to set the new `AudioOptions` property too. + - Set this flags enum property to `ChatResponseModalities.Text | ChatResponseModalities.Audio` in order to request output audio. Note that you need to set the new `AudioOptions` property too. - Added an `AudioOptions` property to `ChatCompletionOptions` ([`audio` in the REST API](https://platform.openai.com/docs/api-reference/chat/create)). ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - Use this property to configure the output audio voice and format. - Added a `CreateInputAudioPart(BinaryData, ChatInputAudioFormat)` static method to `ChatMessageContentPart`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - - Use this method to send input audio in the `Content` of a `UserChatMessage`. + - Use this method to send input audio as a `ChatMessageContentPart` in the `Content` property of a `UserChatMessage`. - Added an `OutputAudio` property to `ChatCompletion`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Use this property to retrieve the output audio that was generated by the model. - Added an `OutputAudioReference` property to `AssistantChatMessage`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - Use this property to reference the output audio of a prior `ChatCompletion` to continue an existing chat. - For more information, see the example in the [README](README.md). - Enabled support for [Predicted Outputs](https://platform.openai.com/docs/guides/predicted-outputs) in chat completions using the `gpt-4o` and `gpt-4o-mini` models. Predicted Outputs can greatly improve response times when large parts of the model response are known ahead of time. This is most common when you are regenerating a file with only minor changes to most of the content. - Added an `OutputPrediction` property to `ChatCompletionOptions` ([`prediction` in the REST API](https://platform.openai.com/docs/api-reference/chat/create)). ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - Use this property to configure a Predicted Output. The property is of a new type called `ChatOutputPrediction`, which you can create via the `ChatOutputPrediction.CreateStaticContentPrediction(string)` or `ChatOutputPrediction.CreateStaticContentPrediction(IEnumerable)` static methods. - - Added a `AcceptedPredictionTokenCount` property to `ChatOutputTokenUsageDetails`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) + - Added an `AcceptedPredictionTokenCount` property to `ChatOutputTokenUsageDetails`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - When using Predicted Outputs, use this property to track the number of tokens in the prediction that appeared in the completion. - Added a `RejectedPredictionTokenCount` property to `ChatOutputTokenUsageDetails`. ([0e0c460](https://github.com/openai/openai-dotnet/commit/0e0c460c88424fc2241956ed5ead6dd5ed7638ec)) - When using Predicted Outputs, use this property to track the number of tokens in the prediction that did not appear in the completion. Note that these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.