- OpenAI.Chat:
- Added the
SafetyIdentifierproperty toChatCompletionOptions, which enables users to specify a stable identifier that can be used to help detect end-users of their application that may be violating OpenAI's usage policies.
- Added the
- OpenAI.Responses:
- Added the
SafetyIdentifierproperty toCreateResponseOptionsandResponseResult, which enables users to specify a stable identifier that can be used to help detect end-users of their application that may be violating OpenAI's usage policies. - Added the
ConversationOptionsproperty toCreateResponseOptionsandResponseResult, which enables users to automatically manage the state of a conversation in a multi-turn interaction by persisting state and sharing context across subsequent responses, rather than having to chain multiple response items together. - Added the
MaxToolCallCountproperty toCreateResponseOptionsandResponseResult, which enables users to set the maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored. - Added the
TopLogProbabilityCountproperty toCreateResponseOptionsandResponseResult, which enables users to specify the number of most likely tokens to return at each token position, each with an associated log probability. - Added the
IncludedPropertiesproperty toCreateResponseOptions, which enables users to specify additional output data to be included in the model response. - Added a setter to the
Idproperty ofResponseItem. - Added a setter to the
Statusproperty of the types derived fromResponseItem.
- Added the
- OpenAI.Responses:
- Until now, this feature area has been marked as experimental via the
[Experimental]attribute. As we prepare to stabilize it and remove its experimental designation, we are cleaning up the APIs to better align them with the service REST APIs, as well as to offer more flexibility and improve usability. See our examples for helpful references on how to use the updated APIs.- The
OpenAIResponseClientclass has been renamed toResponsesClient. - The
ResponseCreationOptionsclass has been renamedtoCreateResponseOptions. - The
OpenAIResponseclass has been renamed toResponseResult. - When calling the
CreateResponse,CreateResponseAsync,CreateResponseStreamingandCreateResponseStreamingAsyncmethods of theResponsesClientwith aCreateResponseOptionsargument, the input items must now be specified via the newInputItemsproperty ofCreateResponseOptions. - When calling the
CreateResponseStreamingandCreateResponseStreamingAsyncmethods of theResponsesClientwith aCreateResponseOptionsargument, theStreamingEnabledproperty ofCreateResponseOptionsmust be set totrue. - The
OpenAIResponsesModelFactoryclass used for mocking output models (e.g.,ResponseResult,ResponseTokenUsage, etc.) has been removed in favor of adding setters to the properties of these models.
- The
- Until now, this feature area has been marked as experimental via the
Thank you to our developer community members who helped to make the OpenAI client library better with their contributions to this release:
- Benjamin Pinter (GitHub)
- OpenAI.Responses:
- Enabled support for stable web search via the
WebSearchToolclass, with a separateWebSearchPreviewToolclass for preview web search features. - Added
Filenameproperty toFileCitationMessageAnnotationto provide the name of the cited file. - Exposed reasoning streaming events, including:
StreamingResponseReasoningTextDeltaUpdateandStreamingResponseReasoningTextDoneUpdatefor reasoning text events.StreamingResponseReasoningSummaryPartAddedUpdateandStreamingResponseReasoningSummaryPartDoneUpdatefor reasoning summary part events.StreamingResponseReasoningSummaryTextDeltaUpdateandStreamingResponseReasoningSummaryTextDoneUpdatefor reasoning summary text events.
- Enabled support for stable web search via the
- OpenAI.Assistants:
- Fixed an issue with custom serialization for
MessageCreationAttachmentthat prevented proper handling of file attachments in message creation. (A community contribution, courtesy of BenjaminDavidPinter)
- Fixed an issue with custom serialization for
- OpenAI.Responses:
- Fixed the generated serialization name of
partial_image_b64inStreamingResponseImageGenerationCallPartialImageUpdateto ensure correct serialization of partial image data in streaming responses. - Fixed serialization issues with
Patchproperties by adding theJsonIgnoreattribute, preventingSystem.InvalidOperationExceptionwhen usingJsonSerializerwithout the custom converter.
- Fixed the generated serialization name of
- Updated the
System.ClientModeldependency to version 1.8.1 to adopt bug fixes for JSON Patch. For more context, see the System.ClientModel ChangeLog
Thank you to our developer community members who helped to make the OpenAI client library better with their contributions to this release:
- Maksim Kurnakov (GitHub)
- OpenAI.Chat:
- Added the
Minimalproperty toChatReasoningEffortLevel. (A community contribution, courtesy of kurnakovv) - Added support for System.Client.Model's
JsonPatch, which enables users to get and set additional JSON properties in response and request payloads.- See the following examples for more information:
- AdditionalProperties
- AdditionalPropertiesAsync
- Go to the OpenAI.Responses section in this changelog for more examples that can be extrapolated to Chat.
- See the following examples for more information:
- Added the
- OpenAI.Conversations:
- Introduced the new
ConversationClientto support the Conversations API with protocol methods for the following operations:CreateConversationandCreateConversationAsyncGetConversationandGetConversationAsyncUpdateConversationandUpdateConversationAsyncDeleteConversationandDeleteConversationAsyncCreateConversationItemsandCreateConversationItemsAsyncGetConversationItemsandGetConversationItemsAsyncDeleteConversationItemandDeleteConversationItemAsync
- Introduced the new
- OpenAI.Embeddings:
- Added support for System.Client.Model's
JsonPatch, which enables users to get and set additional JSON properties in response and request payloads.- Go to the OpenAI.Chat and OpenAI.Responses section in this changelog for examples that can be extrapolated to Embeddings.
- Added support for System.Client.Model's
- OpenAI.Responses:
- Added the
Minimalproperty toResponseReasoningEffortLevel. (A community contribution, courtesy of kurnakovv) - Added the
ContainerFileCitationMessageAnnotationclass which is derived fromResponseMessageAnnotationand is used to cite files in the container of the Code Interpreter tool. - Enabled support for the Image Generation tool, which can be used to generate images using models like
gpt-image-1.- Users can add the new
ImageGenerationToolto theToolsproperty of theirResponseCreationOptionsand configure it using properties such asBackground,Quality,Size, and more.
- Users can add the new
- Added support for System.Client.Model's
JsonPatch, which enables users to get and set additional JSON properties in response and request payloads.- See the following examples for more information:
- InputAdditionalProperties
- InputAdditionalPropertiesAsync
- OutputAdditionalProperties
- OutputAdditionalPropertiesAsync
- ModelOverridePerRequest
- ModelOverridePerRequestAsync
- Go to the OpenAI.Chat section for more examples that can be extrapolated to Responses.
- See the following examples for more information:
- Added the
- OpenAI.Videos:
- Introduced the new
VideoClientto support the Videos API with protocol methods for the following operations:CreateVideoandCreateVideoAsyncGetVideoandGetVideoAsyncDeleteVideoandDeleteVideoAsyncDownloadVideoandDownloadVideoAsyncGetVideosandGetVideosAsyncCreateVideoRemixandGetVideoRemixAsync
- Introduced the new
- OpenAI.Audio:
- Added the explicit conversion operators from
ClientResultthat were missing in theAudioTranscriptionandAudioTranslationclasses.
- Added the explicit conversion operators from
- OpenAI.Chat:
- Added the
ContentPartsproperty that was missing in theChatCompletionMessageListDatumclass.
- Added the
- OpenAI.Containers:
- Renamed the
GetContainerFileContentandGetContainerFileContentAsyncmethods ofContainerClienttoDownloadContainerFileandDownloadContainerFileAsync.
- Renamed the
- OpenAI.Responses:
- Removed the duplicated
GetInputItemsandGetInputItemsAsyncmethods of theOpenAIResponseClientin favor of the existingGetResponseInputItemsandGetResponseInputItemsAsyncmethods.
- Removed the duplicated
Thank you to our developer community members who helped to make the OpenAI client library better with their contributions to this release:
- Benjamin Pinter (GitHub)
- OpenAI.Responses:
- Added the
Modelproperty toOpenAIResponseClient. (A community contribution, courtesy of BenjaminDavidPinter) - Added the
ServiceDescriptionproperty toMcpTool. - Enabled support for connectors, which are OpenAI-maintained MCP wrappers for popular services like Microsoft Outlook or Dropbox.
- Added the
ConnectorIdproperty toMcpTool.
- Added the
- Enabled support for authentication with remote MCP servers.
- Added the
AuthorizationTokenproperty toMcpTool.
- Added the
- Enabled support for the Code Interpreter tool, which allows models to write and run Python code in a sandboxed environment to solve complex problems in domains like data analysis, coding, and math.
- Users can add the new
CodeInterpreterToolto theToolsproperty of theirResponseCreationOptionsand configure it.- Use the
Containerproperty to configure the sandboxed environment, including any files that should be made available.
- Use the
- Users can add the new
- Added the
- OpenAI.Responses:
- Fixed an issue with the constructor of
McpToolCallApprovalRequestItemnot taking the item ID as a parameter. MCP approval requests are correlated to MCP approval responses using this ID, which implies that this ID should be required. - Fixed an issue with some of the MCP-related
StreamingResponseUpdateclasses missing theItemIdandOutputIndexproperties.
- Fixed an issue with the constructor of
- OpenAI.Audio:
- Added the
Endpointproperty toAudioClient.
- Added the
- OpenAI.Batch:
- Added the
Endpointproperty toBatchClient.
- Added the
- OpenAI.Chat:
- Added the
Endpointproperty toChatClient. - Added the
ServiceTierproperty toChatCompletionOptions,ChatCompletion, andStreamingChatCompletionUpdateto configure the policy that the server will use to process the request in terms of pricing, performance, etc. - Added an explicit conversion operator to
ChatCompletionandChatCompletionDeletionResultto convert fromClientResult.
- Added the
- OpenAI.Containers:
- Added the
Endpointproperty toContainerClient. - Added convenience counterparts to the protocol methods of
ContainerClientthat use the strongly-typed model classes. - Added automatic pagination support to the following methods of
ContainerClient:GetContainersandGetContainersAsyncGetContainerFilesandGetContainerFilesAsync
- Added an explicit conversion operator to
ContainerResource,ContainerFileResource,DeleteContainerResponse, andDeleteContainerFileResponseto convert fromClientResult.
- Added the
- OpenAI.Embeddings:
- Added the
Endpointproperty toEmbeddingsClient. - Added an explicit conversion operator to
OpenAIEmbeddingCollectionto convert fromClientResult.
- Added the
- OpenAI.Evals:
- Added the
Endpointproperty toEvaluationClient.
- Added the
- OpenAI.Files:
- Added the
Endpointproperty toOpenAIFileClient. - Added an explicit conversion operator to
OpenAIFile,OpenAIFileCollection, andFileDeletionResultto convert fromClientResult.
- Added the
- OpenAI.FineTuning:
- Added the
Endpointproperty toFineTuningClient.
- Added the
- OpenAI.Graders:
- Added the
Endpointproperty toGraderClient. - Added an explicit conversion operator to
RunGraderResponseandValidateGraderResponseto convert fromClientResult.
- Added the
- OpenAI.Images:
- Added the
Endpointproperty toImageClient. - Added an explicit conversion operator to
GeneratedImageCollectionto convert fromClientResult. - Added the
Backgroundproperty toImageEditOptionsto set transparency for the background of the generated image(s). - Added the
Qualityproperty toImageEditOptionsto set the quality of the generated image(s).
- Added the
- OpenAI.Images:
- Added the
Endpointproperty toImageClient. - Added an explicit conversion operator to
GeneratedImageCollectionto convert fromClientResult. - Added the
Backgroundproperty toImageEditOptionsto set transparency for the background of the generated image(s). - Added the
Qualityproperty toImageEditOptionsto set the quality of the generated image(s).
- Added the
- OpenAI.Models:
- Added the
Endpointproperty toOpenAIModelClient. - Added an explicit conversion operator to
OpenAIModel,OpenAIModelCollection, andModelDeletionResultto convert fromClientResult.
- Added the
- OpenAI.Moderations:
- Added the
Endpointproperty toModerationClient. - Added an explicit conversion operator to
ModerationResultCollectionto convert fromClientResult.
- Added the
- OpenAI.Realtime:
- Added a constructor that can take a string API key to
RealtimeClient. - Added constructors that can take a custom
AuthenticationPolicytoRealtimeClient. - Added the
Endpointproperty toRealtimeClient. - Replaced the
RequestOptionsparameter of the following methods ofRealtimeClientfor a newRealtimeSessionOptionsparameter and aCancellationTokenparameter:StartConversationSessionandStartConversationSessionAsyncStartTranscriptionSessionandStartTranscriptionSessionAsyncStartSessionandStartSessionAsync
- Added a constructor that can take a string API key to
- OpenAI.Responses:
- Added the
Endpointproperty toOpenAIResponseClient. - Added an explicit conversion operator to
OpenAIResponseto convert fromClientResult. - Added new classes derived from
ResponseToolto facilitate certain scenarios:FunctionToolFileSearchToolWebSearchToolComputerTool
- Added initial support for integrating with remote MCP servers via the Responses API in streaming and non-streaming scenarios.
- Users can add the new
McpToolto theToolsproperty of theirResponseCreationOptionsand configure it.- Use the
AllowedToolsproperty to limit which of the server tools can be called by the model. - Use the
ToolCallApprovalPolicyproperty to specify which tools require an explicit approval before being called by the model.
- Use the
- Support for selecting the
McpToolvia theToolChoiceproperty is coming soon. - Support for configuring the
McpToolwith an access token that can be used to authenticate with the remote MCP server is coming soon. - Support for connectors is coming soon.
- Users can add the new
- Added new classes derived from
ResponseMessageAnnotationto facilitate certain scenarios:FileCitationMessageAnnotationFilePathMessageAnnotationUriCitationMessageAnnotation
- Added the
ServiceTierproperty toResponseCreationOptions,OpenAIResponse, andStreamingChatCompletionUpdateto configure the policy that the server will use to process the request in terms of pricing, performance, etc.
- Added the
- OpenAI.VectorStores:
- Added the
Endpointproperty toOpenAIResponseClient. - Added an explicit conversion operator to
VectorStore,VectorStoreFile,VectorStoreFileBatch,VectorStoreDeletionResult, andFileFromStoreRemovalResultto convert fromClientResult.
- Added the
- OpenAI.Realtime:
- Fixed an issue with the classes derived from
ResponseItem(such asReasoningResponseItem) missing some constructors or property setters, which made it difficult to use them as inputs. - Fixed an issue with the HTTP pipeline of the
RealtimeClientthat was preventing the following methods from working correctly:CreateEphemeralTokenandCreateEphemeralTokenAsyncCreateEphemeralTranscriptionTokenandCreateEphemeralTranscriptionTokenAsync
- Fixed an issue with the classes derived from
- OpenAI.Chat:
- Changed the type of the
optionsparameter of theGetChatCompletionMessagesmethod of theChatClientfromChatCompletionCollectionOptionstoChatCompletionMessageCollectionOptions.
- Changed the type of the
- OpenAI.Realtime:
- Replaced the
RequestOptionsparameter for a newRealtimeSessionOptionsparameter and aCancellationTokenparameter.
- Replaced the
- OpenAI.Responses:
- Renamed the
Backgroundproperty toBackgroundModeEnabledfor clarity. - Renamed the
ComputerOutputclass toComputerCallOutput. - Changed the type of the
Deltaproperty ofStreamingResponseFunctionCallArgumentsDeltaUpdatefromstringtoBinaryData. - Changed the type of the
Argumentsproperty ofStreamingResponseFunctionCallArgumentsDoneUpdatefromstringtoBinaryDataand renamed it toFunctionArguments. - Renamed the
WebSearchContextSizeclass toWebSearchToolContextSize. - Renamed the
WebSearchUserLocationclass toWebSearchToolLocation. - Refactored the factory methods of
ResponseItem. - Refactored the factory methods of
ResponseTool. - Removed the properties of
ResponseMessageAnnotationexcept for theKindproperty and moved them to the new derived types.
- Renamed the
- OpenAI.VectorStores:
- Removed the
OperationResultpattern along with theCreateVectorStoreOperationAddFileToVectorStoreOperation, andCreateBatchFileJobOperationclasses. - Renamed the
VectorStoreBatchFileJobclass toVectorStoreFileBatch - Renamed the
VectorStoreFileAssociationclass toVectorStoreFile - Renamed the
VectorStoreFileAssociationErrorclass toVectorStoreFileError - Renamed the
VectorStoreFileAssociationStatusclass toVectorStoreFileStatus - Renamed the
VectorStoreFileAssociationErrorCodeclass toVectorStoreFileErrorCode - Renamed the
VectorStoreFileAssociationCollectionOptionsclass toVectorStoreFileCollectionOptions - Renamed the
VectorStoreFileAssociationCollectionOrderclass toVectorStoreFileCollectionOrder - Renamed the
CancelBatchFileJobandCancelBatchFileJobAsyncmethods ofVectorStoreClienttoCancelVectorStoreFileBatchandCancelVectorStoreFileBatchAsync - Renamed the
CreateBatchFileJobandCreateBatchFileJobAsyncmethods ofVectorStoreClienttoAddFileBatchToVectorStoreandAddFileBatchToVectorStoreAsync - Renamed the
GetBatchFileJobandGetBatchFileJobAsyncmethods ofVectorStoreClienttoGetVectorStoreFileBatchandGetVectorStoreFileBatchAsync - Renamed the
GetFileAssociationandGetFileAssociationAsyncmethods ofVectorStoreClienttoGetVectorStoreFileandGetVectorStoreFileAsync - Renamed the
GetFileAssociationsandGetFileAssociationsAsyncmethods ofVectorStoreClienttoGetVectorStoreFilesandGetVectorStoreFilesAsync - Renamed the
GetFileAssociationsInBatchandGetFileAssociationsInBatchAsyncmethods ofVectorStoreClienttoGetVectorStoreFilesInBatchandGetVectorStoreFilesInBatchAsync - Renamed the
RemoveFileFromStoreandRemoveFileFromStoreAsyncmethods ofVectorStoreClienttoRemoveFileFromVectorStoreandRemoveFileFromVectorStoreAsync
- Removed the
- Updated the
System.ClientModeldependency to version 1.6.1.
- OpenAI.Audio:
- Added the
Modelproperty toAudioClient. - Added constructors that can take a custom
AuthenticationPolicytoAudioClient.
- Added the
- OpenAI.Batch:
- Added new methods to
BatchClient:GetBatchandGetBatchAsync
- Added constructors that can take a custom
AuthenticationPolicytoBatchClient.
- Added new methods to
- OpenAI.Chat:
- Added new methods to
ChatClient:UpdateChatCompletionandUpdateChatCompletionAsyncGetChatCompletionsandGetChatCompletionsAsyncGetChatCompletionMessagesandGetChatCompletionMessagesAsync
- Added the
Modelproperty toChatClient. - Added constructors that can take a custom
AuthenticationPolicytoChatClient.
- Added new methods to
- OpenAI.Containers:
- Introduced the new
ContainersClientto support the Containers API with protocol methods for the following operations:CreateContainerandCreateContainerAsyncGetContainersandGetContainersAsyncGetContainerandGetContainerAsyncDeleteContainerandDeleteContainerAsyncCreateContainerFileandCreateContainerFileAsyncGetContainerFilesandGetContainerFilesAsyncGetContainerFileandGetContainerFileAsyncGetContainerFileContentandGetContainerFileContentAsyncDeleteContainerFileandDeleteContainerFileAsync
- Introduced the new
- OpenAI.Embeddings:
- Added the
Modelproperty toEmbeddingClient. - Added constructors that can take a custom
AuthenticationPolicytoEmbeddingClient.
- Added the
- OpenAI.Evals:
- Added constructors that can take a custom
AuthenticationPolicytoEvaluationClient.
- Added constructors that can take a custom
- OpenAI.Files:
- Added constructors that can take a custom
AuthenticationPolicytoOpenAIFileClient.
- Added constructors that can take a custom
- OpenAI.FineTuning:
- Added constructors that can take a custom
AuthenticationPolicytoFineTuningClient.
- Added constructors that can take a custom
- OpenAI.Graders:
- Introduced the new
GraderClientto support the Graders API with protocol methods for the following operations:RunGraderandRunGraderAsyncValidateGraderandValidateGraderAsync
- Introduced the new
- OpenAI.Images:
- Added the
Modelproperty toImageClient. - Added constructors that can take a custom
AuthenticationPolicytoImageClient.
- Added the
- OpenAI.Models:
- Added constructors that can take a custom
AuthenticationPolicytoOpenAIModelClient.
- Added constructors that can take a custom
- OpenAI.Moderations:
- Added the
Modelproperty toModerationClient. - Added constructors that can take a custom
AuthenticationPolicytoModerationClient.
- Added the
- OpenAI.Realtime:
- Enabled support for semantic voice activity detection (VAD) via the new
CreateSemanticVoiceActivityTurnDetectionOptionsmethod ofTurnDetectionOptions.
- Enabled support for semantic voice activity detection (VAD) via the new
- OpenAI.Responses:
- Added a model factory.
- Added constructors that can take a custom
AuthenticationPolicytoOpenAIResponseClient.
- OpenAI.VectorStores:
- Added constructors that can take a custom
AuthenticationPolicytoVectorStoreClient.
- Added constructors that can take a custom
- OpenAI.Assistants:
- Fixed an issue causing the
ImageDetailproperty ofMessageContentto not be serialized correctly.
- Fixed an issue causing the
- OpenAI.Audio:
- Added a check to all overloads of
TranscribeAudioStreamingandTranscribeAudioStreamingAsyncin theAudioClientto prevent using thewhisper-1model, which does not support streaming and simply ignores thestreamparameter.
- Added a check to all overloads of
- OpenAI.Realtime:
- Improved the disposal logic in
AsyncWebsocketMessageResultEnumeratorto prevent multiple disposals.
- Improved the disposal logic in
- OpenAI.Responses:
- Fixed an issue in code generation that caused the
StreamingResponseTextAnnotationAddedUpdateclass to not be generated correctly as part of the set of possible handles when streaming. - Fixed an issue in code generation that caused the
Statusproperty ofReasoningResponseItemand theReasoningStatusenum to not be generated correctly and lead to incorrect behavior.
- Fixed an issue in code generation that caused the
- The
OpenAINuGet package now contains signed binaries. - Updated the
System.ClientModeldependency to version 1.5.1, which contains a fix for a concurrency bug which could cause some applications running on the legacy .NET Framework to experience an infinite loop while deserializing service responses. - Removed the explicit
net6.0target framework, as this version reached end-of-life in November 2024 and is no longer maintained nor supported by Microsoft. This does not prevent using the OpenAI library on .NET 6, as the runtime will fallback to thenetstandard2.0target.
- OpenAI.Audio:
- Enabled support for streaming audio transcriptions:
- Added new methods to
AudioClient:TranscribeAudioStreamingandTranscribeAudioStreamingAsync
- Added new types of
StreamingAudioTranscriptionUpdateto work with streaming transcriptions:StreamingAudioTranscriptionTextDeltaUpdateStreamingAudioTranscriptionTextDoneUpdate
- Added new methods to
- Added the
TranscriptionTokenLogProbabilitiesproperty toAudioTranscriptionto represent token-level log probability information. - Added the
AudioTranscriptionIncludesenum andIncludesproperty toAudioTranscriptionOptionsto request additional information in the transcription response. - Added new voices to
GeneratedSpeechVoice. - Added the
Instructionsproperty toSpeechGenerationOptionsto control the voice of the generated audio with additional instructions.
- Enabled support for streaming audio transcriptions:
- OpenAI.Batch:
- Added new
Rehydratemethod overloads that receive a batch ID instead of rehydration token.
- Added new
- OpenAI.Chat:
- Added new methods to
ChatClient:DeleteChatCompletionandDeleteChatCompletionAsyncGetChatCompletionandGetChatCompletionAsync
- Added
Aacformat toChatOutputAudioFormat. - Added new voices to
ChatOutputAudioVoice.
- Added new methods to
- OpenAI.Evals:
- Introduced the new
EvaluationClientto support the Evaluations API with protocol methods for the following operations:CreateEvaluationandCreateEvaluationAsyncGetEvaluationandGetEvaluationAsyncGetEvaluationsandGetEvaluationsAsyncUpdateEvaluationandUpdateEvaluationAsyncDeleteEvaluationandDeleteEvaluationAsyncCreateEvaluatinRunandCreateEvaluationRunAsyncGetEvaluationRunandGetEvaluationRunAsyncGetEvaluationRunsandGetEvaluationRunsAsyncCancelEvaluationRunandCancelEvaluationRunAsyncDeleteEvaluationRunandDeleteEvaluationRunAsyncGetEvaluationRunOutputItemandGetEvaluationRunOutputItemAsyncGetEvaluationRunOutputItemsandGetEvaluationRunOutputItemsAsync
- Introduced the new
- OpenAI.FineTuning:
- Added new methods to
FineTuningClient:GetFineTuningCheckpointPermissionsandGetFineTuningCheckpointPermissionsAsyncCreateFineTuningCheckpointPermissionandCreateFineTuningCheckpointPermissionAsyncDeleteFineTuningCheckpointPermissionandDeleteFineTuningCheckpointPermissionPauseFineTuningJobandPauseFineTuningJobAsyncResumeFineTuningJobandResumeFineTuningJobAsync
- Added new experimental types to support fine-tuning workflows.
- Added new methods to
- OpenAI.Images:
- Added the
Usageproperty toGeneratedImageCollectionto represent image token usage information. - Added the
Backgroundproperty toImageGenerationOptionsto set transparency for the background of the generated image(s). - Added the
ModerationLevelproperty toImageGenerationOptionsto control the content-moderation level for generated image(s). - Added the
OutputCompressionFactorproperty toImageGenerationOptionsto set the compression level (0-100%) for the generated images. - Added the
OutputFileFormatproperty toImageGenerationOptionsto set the file format in which the generated images are returned. - Added support for new values to the
GeneratedImageSizeenum.
- Added the
- OpenAI.Responses:
- Added new methods to the
OpenAIResponseClient:CancelResponseandCancelResponseAsyncGetResponseStreamingandGetResponseStreamingAsync.
- Added
Linuxproperty toComputerToolEnvironment. - Added
Backgroundproperty toResponseCreationOptionsto support background mode. - Added
SequenceNumberproperty toStreamingResponseUpdateto support background mode while streaming. - Added
InputTokenDetailsproperty toResponseTokenUsageto represent token usage information. - Added
EncryptedContentproperty toReasoningResponseItemto represent the encrypted content of the reasoning item.
- Added new methods to the
- OpenAI.VectorStores:
- Added new methods to
VectorStoreClient:RetrieveVectorStoreFileContentandRetrieveVectorStoreFileContentAsyncSearchVectorStoreandSearchVectorStoreAsyncUpdateVectorStoreFileAttributesandUpdateVectorStoreFileAttributes
- Added new methods to
- OpenAI.Files:
- Added a
SizeInBytesLongproperty toOpenAIFileto correctly represent the size of a file.
- Added a
- OpenAI.Responses:
- Fixed an issue where setting the
ReasoningSummaryVerbosityproperty ofResponseReasoningOptionswas sending the wrong property to the service. - Fixed an issue with the
CreateInputFilePartmethod ofResponseContentPartnot being able to send files asBinaryData.
- Fixed an issue where setting the
- Removed the implicit operator from all models that converts a model to
BinaryContent. - Removed the explicit operator from all models that converts a
ClientResultto a model. - OpenAI:
- Renamed the
GetRealtimeConversationClientmethod fromOpenAIClienttoGetRealtimeClient.
- Renamed the
- OpenAI.FineTuning:
- Renamed the
FineTuningJobOperationclass toFineTuningJob. - Removed protocol methods for
CreateFineTuningJob,GetJob, andGetJobsand added convenience methods for them.
- Renamed the
- OpenAI.Realtime:
- Updated namespace from
OpenAI.ConversationstoOpenAI.Realtime. All APIs and types related to real-time conversations have been moved to the newOpenAI.Realtimenamespace.
- Updated namespace from
- OpenAI.Responses:
- Removed the
SummaryTextPartsproperty ofReasoningResponseItemin favor a new property calledSummaryParts. - Removed the following public constructors:
FileSearchCallResponseItem(IEnumerable<string> queries, IEnumerable<FileSearchCallResult> results)FunctionCallOutputResponseItem(string callId, string functionOutput)FunctionCallResponseItem(string callId, string functionName, BinaryData functionArguments)
- Made several properties read-only that were previously settable:
CallIdandOutputinComputerCallOutputResponseItemAction,CallId, andStatusinComputerCallResponseItemResultsandStatusinFileSearchCallResponseItemCallIdinFunctionCallOutputResponseItemCallIdinFunctionCallResponseItem
- Changed the following property types:
AttributesinFileSearchCallResultis nowIReadOnlyDictionary<string, BinaryData>instead ofIDictionary<string, BinaryData>.Statusproperties are now nullable in multiple response item types.CodeinResponseErroris nowResponseErrorCodeinstead ofstring.
- Renamed the
WebSearchToolContextSizeextensible enum toWebSearchContextSize. - Renamed the
WebSearchToolLocationclass toWebSearchUserLocation.
- Removed the
- OpenAI.VectorStores:
- Renamed method parameters from
vectorStoretooptionsinCreateVectorStoreandModifyVectorStoremethods inVectorStoreClient.
- Renamed method parameters from
- OpenAI.Chat:
- Enabled support for file inputs. When using models with vision capabilities, you can now also provide PDF files as inputs, either as a file ID or as base64-encoded data. (aaa924e)
- Added the
CreateFilePart(string fileId)andCreateFilePart(BinaryData fileBytes, string fileBytesMediaType, string filename)factory methods toChatMessageContentPart.
- Added the
- Enabled support for file inputs. When using models with vision capabilities, you can now also provide PDF files as inputs, either as a file ID or as base64-encoded data. (aaa924e)
- OpenAI.Responses:
- Added the
ResponseToolChoiceclass to help specify which tool the model should select when generating a response. (aaa924e)
- Added the
- OpenAI.Assistants:
- Removed the default constructor and the use of the
requiredkeyword from theFileSearchRankingOptionsandFunctionToolDefinitionclasses to align with the rest of the library. (86407c8)
- Removed the default constructor and the use of the
- OpenAI.RealtimeConversation:
- Removed the default constructor and the use of the
requiredkeyword from theConversationFunctionToolclass to align with the rest of the library. (86407c8)
- Removed the default constructor and the use of the
- OpenAI.Responses:
- Removed the
idparameter from the factory methods of theResponseItemclass. - Renamed the
AllowParallelToolCallsproperty of theResponseCreationOptionsandOpenAIResponseclasses toParallelToolCallsEnabled. (aaa924e) - Changed the type of the
ToolChoiceproperty of theResponseCreationOptionsandOpenAIResponseclasses fromBinaryDatatoResponseToolChoice. (aaa924e) - Changed
MessageRolefrom an "extensible enum" to a regular enum. (aaa924e) - Refactored the
StreamingResponse*classes. (aaa924e)
- Removed the
- OpenAI.VectorStores:
- Removed the default constructor and the use of the
requiredkeyword from theVectorStoreExpirationPolicyclass to align with the rest of the library. (86407c8)
- Removed the default constructor and the use of the
- OpenAI.Responses:
- Enabled support for the new Responses API. (0ca4c06)
- Added a new
OpenAIResponseClientin a corresponding scenario namespace. - This release aims to bring the new Responses API to .NET as soon as possible. Details, examples, and comprehensive updates for other operations are coming soon!
- Added a new
- Enabled support for the new Responses API. (0ca4c06)
- OpenAI.Chat:
- Enabled support for web search. (0ca4c06)
- Added a
WebSearchOptionsproperty toChatCompletionOptions(web_search_optionsin the REST API). - Added an
Annotationsproperty toChatCompletion.
- Added a
- Enabled support for web search. (0ca4c06)
- OpenAI.Files:
- Enabled support for user data and evals files. (0ca4c06)
- OpenAI.Chat:
- Fixed an issue that caused calls to the
CompleteChatStreamingandCompleteChatStreamingAsyncmethods to fail with audio-enabled models unless provided aChatCompletionOptionsinstance that had previously been used in a non-streamingCompleteChatorCompleteChatAsyncmethod call. (d6615ab) - Fixed an issue that caused calls to the
CompleteChatStreamingandCompleteChatStreamingAsyncmethods to not report token usage when provided aChatCompletionOptionsinstance that had previously been used in a non-streamingCompleteChatorCompleteChatAsyncmethod call. (d6615ab) - Fixed a series of issues with standalone serialization and deserialization of
ChatCompletionOptionsthat impacted the ability to manipulate chat completion requests viaSystem.ClientModel.Primitives.ModelReaderWriterand related utilities. (d6615ab)
- Fixed an issue that caused calls to the
- OpenAI.Audio:
- Added explicit support for new values of
GeneratedSpeechVoice. (0e0c460)
- Added explicit support for new values of
- OpenAI.Chat:
- Enabled support for input and output audio in chat completions using the
gpt-4o-audio-previewmodel.- Added a
ResponseModalitiesproperty toChatCompletionOptions(modalitiesin the REST API). (0e0c460)- Set this flags enum property to
ChatResponseModalities.Text | ChatResponseModalities.Audioin order to request output audio. Note that you need to set the newAudioOptionsproperty too.
- Set this flags enum property to
- Added an
AudioOptionsproperty toChatCompletionOptions(audioin the REST API). (0e0c460)- Use this property to configure the output audio voice and format.
- Added a
CreateInputAudioPart(BinaryData, ChatInputAudioFormat)static method toChatMessageContentPart. (0e0c460)- Use this method to send input audio as a
ChatMessageContentPartin theContentproperty of aUserChatMessage.
- Use this method to send input audio as a
- Added an
OutputAudioproperty toChatCompletion. (0e0c460)- Use this property to retrieve the output audio that was generated by the model.
- Added an
OutputAudioReferenceproperty toAssistantChatMessage. (0e0c460)- Use this property to reference the output audio of a prior
ChatCompletionto continue an existing chat.
- Use this property to reference the output audio of a prior
- For more information, see the example in the README.
- Added a
- Enabled support for Predicted Outputs in chat completions using the
gpt-4oandgpt-4o-minimodels. 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
OutputPredictionproperty toChatCompletionOptions(predictionin the REST API). (0e0c460)- Use this property to configure a Predicted Output. The property is of a new type called
ChatOutputPrediction, which you can create via theChatOutputPrediction.CreateStaticContentPrediction(string)orChatOutputPrediction.CreateStaticContentPrediction(IEnumerable<ChatMessageContentPart>)static methods.
- Use this property to configure a Predicted Output. The property is of a new type called
- Added an
AcceptedPredictionTokenCountproperty toChatOutputTokenUsageDetails. (0e0c460)- When using Predicted Outputs, use this property to track the number of tokens in the prediction that appeared in the completion.
- Added a
RejectedPredictionTokenCountproperty toChatOutputTokenUsageDetails. (0e0c460)- 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 an
- Added a
ReasoningEffortLevelproperty toChatCompletionOptions(reasoning_effortin the REST API). (0e0c460)- Use this property to constrain the effort on reasoning for the models with reasoning capabilities (such as
o3-miniando1). Reducing the reasoning effort can result in faster responses and fewer tokens used on reasoning.
- Use this property to constrain the effort on reasoning for the models with reasoning capabilities (such as
- Added a
DeveloperChatMessageclass. (0e0c460)- Use this type of message to provide instructions that the model should follow, regardless of messages sent by the user. It replaces the existing
SystemChatMessageclass when usingo1and newer models.
- Use this type of message to provide instructions that the model should follow, regardless of messages sent by the user. It replaces the existing
- Enabled support for input and output audio in chat completions using the
- OpenAI.RealtimeConversation:
- Added explicit support for new values of
ConversationVoice. (0e0c460)
- Added explicit support for new values of
- OpenAI.Assistants:
- Removed the setters of the
IDictionary<string, string> Metadataproperties of the "options" classes (e.g.,AssistantCreationOptions) to be able to guarantee that the collections are always initialized. (0e0c460)- The dictionaries remain writeable, and you can add elements to it using collection initializer syntax or the
Add(TKey, TValue)method.
- The dictionaries remain writeable, and you can add elements to it using collection initializer syntax or the
- Removed the setters of the
- OpenAI.RealtimeConversation:
- Renamed the
InputTokens,OutputTokens, andTotalTokensproperties inConversationTokenUsagetoInputTokenCount,OutputTokenCount, andTotalTokenCount, respectively. (0e0c460) - Renamed the
AudioTokens,CachedTokens, andTextTokensproperties inConversationInputTokenUsageDetailstoAudioTokenCount,CachedTokenCount, andTextTokenCount, respectively. (0e0c460) - Renamed the
AudioTokensandTextTokensproperties inConversationOutputTokenUsageDetailstoAudioTokenCountandTextTokenCount, respectively. (0e0c460)
- Renamed the
- OpenAI.VectorStores:
- Removed the setters of the
IDictionary<string, string> Metadataproperties of the "options" classes (e.g.,VectorStoreCreationOptions) to be able to guarantee that the collections are always initialized. (0e0c460)- The dictionaries remain writeable, and you can add elements to it using collection initializer syntax or the
Add(TKey, TValue)method.
- The dictionaries remain writeable, and you can add elements to it using collection initializer syntax or the
- Removed the setters of the
- Added .NET 8 as a target framework. (6203354)
- Enabled support for trimming. (4cd8529)
- Enabled support for native AOT compilation. (4cd8529)
- OpenAI.Assistants:
- Added a
Contentproperty toRunStepFileSearchResult(step_details.tool_calls.file_search.results.contentin the REST API). (bf3f0ed)- When using an Assistant with the File Search tool, you can use this property to retrieve the contents of the File Search results that were used by the model.
- Added
FileSearchRankingOptionsandFileSearchResultsproperties toRunStepDetailsUpdate. (bf3f0ed)
- Added a
- OpenAI.RealtimeConversation:
- OpenAI.Assistants:
- Renamed
RunStepTypetoRunStepKind. (bf3f0ed) - Changed
RunStepKindfrom an "extensible enum" to a regular enum. (bf3f0ed) - Renamed the
ToolCallIdproperty ofRunStepToolCalltoId. (bf3f0ed) - Renamed the
ToolKindproperty ofRunStepToolCalltoKind. (bf3f0ed) - Replaced the
FileSearchRankerandFileSearchScoreThresholdproperties ofRunStepToolCallwith a newFileSearchRankingOptionsproperty that contains both values to make it clearer how they are related. (bf3f0ed)
- Renamed
- OpenAI.RealtimeConversation:
- OpenAI.Chat:
- Added a
StoredOutputEnabledproperty toChatCompletionOptions(storein the REST API). (b0f9e5c)- Use this property to indicate whether or not to store the output of the chat completion for use in model distillation or evals.
- Added a
Metadataproperty toChatCompletionOptions(metadatain the REST API). (b0f9e5c)- Use this property to add custom tags and values to the chat completions for filtering in the OpenAI dashboard.
- Added an
InputTokenDetailsproperty toChatTokenUsage(usage.prompt_token_detailsin the REST API). (b0f9e5c)- The property is of a new type called
ChatInputTokenUsageDetails, which contains properties forAudioTokenCountandCachedTokenCountfor usage with supported models.
- The property is of a new type called
- Added an
AudioTokenCountproperty toChatOutputTokenUsageDetails(usage.completion_token_detailsin the REST API). Audio support in chat completions is coming soon. (b0f9e5c)
- Added a
- OpenAI.Moderations:
- Added
IllicitandIllicitViolentpropertiesModerationResultto represent these two new moderation categories. (b0f9e5c)
- Added
- OpenAI.RealtimeConversation:
- Made improvements to the experimental Realtime API. Please note this features area is currently under rapid development and not all changes may be reflected here. (b0f9e5c)
- Several types have been renamed for consistency and clarity.
ConversationRateLimitsUpdate(previouslyConversationRateLimitsUpdatedUpdate) now includes namedRequestDetailsandTokenDetailsproperties, mapping to the corresponding named items in the underlyingrate_limitscommand payload.
- Made improvements to the experimental Realtime API. Please note this features area is currently under rapid development and not all changes may be reflected here. (b0f9e5c)
- OpenAI.RealtimeConversation:
- Fixed serialization and deserialization of
ConversationToolChoiceliteral values (such as"required"). (9de3709)
- Fixed serialization and deserialization of
- Updated the
System.ClientModeldependency to version1.2.1. (b0f9e5c)- This updates the
System.Text.Jsontransitive dependency to version6.0.10, which includes a security compliance fix for CVE-2024-43485. Please note that the OpenAI library was not impacted by this vulnerability since it does not use the[JsonExtensionData]feature.
- This updates the
Note
With this updated preview library release, we're excited to bring early support for the newly-announced /realtime beta API. You can read more about /realtime here: https://openai.com/index/introducing-the-realtime-api/. Given the scope and recency of the feature area, the new RealtimeConversationClient is subject to substantial refinement and change over the coming weeks -- this release is purely intended to empower early development against gpt-4o-realtime-preview as quickly and efficiently as possible.
- Added a new
RealtimeConversationClientin a corresponding scenario namespace. (ff75da4)- This maps to the new
/realtimebeta endpoint and is thus marked with a new[Experimental("OPENAI002")]diagnostic tag. - This is a very early version of the convenience surface and thus subject to significant change
- Documentation and samples will arrive soon; in the interim, see the scenario test files for basic usage
- You can also find an external sample employing this client, together with Azure OpenAI support, at https://github.com/Azure-Samples/aoai-realtime-audio-sdk/tree/main/dotnet/samples/console
- This maps to the new
Note
First stable version of the official OpenAI library for .NET.
- Support for OpenAI's latest flagship models, including GPT-4o, GPT-4o mini, o1-preview, and o1-mini
- Support for the entire OpenAI REST API, including:
- Structured outputs
- Reasoning tokens
- Experimental support for Assistants beta v2
- Support for sync and async APIs
- Convenient APIs to facilitate working with streaming chat completions and assistants
- Tons of other quality-of-life features for ease of use and productivity
Note
The following breaking changes only apply when upgrading from the previous 2.0.0-beta.* versions.
- Implemented
ChatMessageContentto encapsulate the representation of content parts inChatMessage,ChatCompletion, andStreamingChatCompletionUpdate. (31c2ba6) - Changed the representation of function arguments to
BinaryDatainChatToolCall,StreamingChatToolCallUpdate,ChatFunctionCall, andStreamingChatFunctionCallUpdate. (31c2ba6) - Renamed
OpenAIClientOptions'sApplicationIdtoUserAgentApplicationId. (31c2ba6) - Renamed
StreamingChatToolCallUpdate'sIdtoToolCallId. (31c2ba6) - Renamed
StreamingChatCompletionUpdate'sIdtoCompletionId. (31c2ba6) - Replaced
AutoandNonein the deprecatedChatFunctionChoicewithCreateAutoChoice()andCreateNoneChoice(). (31c2ba6) - Replaced the deprecated
ChatFunctionChoice(ChatFunction)constructor withCreateNamedChoice(string functionName). (31c2ba6) - Renamed
FileClienttoOpenAIFileClientand the correspondingGetFileClient()method inOpenAIClienttoGetOpenAIFileClient(). (31c2ba6) - Renamed
ModelClienttoOpenAIModelClientand the correspondingGetModelClient()method inOpenAIClienttoGetOpenAIModelClient(). (31c2ba6)
- Refactored
ModerationResultby mergingModerationCategoriesandModerationCategoryScoresinto individualModerationCategoryproperties, each withFlaggedandScoreproperties. (19ceae4) - Renamed type
OpenAIFileInfotoOpenAIFileandOpenAIFileInfoCollectiontoOpenAIFileCollection. (19ceae4) - Renamed type
OpenAIModelInfotoOpenAIModelandOpenAIModelInfoCollectiontoOpenAIModelCollection. (19ceae4) - Renamed type
EmbeddingtoOpenAIEmbeddingandEmbeddingCollectiontoOpenAIEmbeddingCollection. (19ceae4) - Renamed property
ImageUrltoImageUriand methodFromImageUrltoFromImageUriin theMessageContenttype. (19ceae4) - Renamed property
ParallelToolCallsEnabledtoAllowParallelToolCallsin theRunCreationOptions,ThreadRun, andChatCompletionOptionstypes. (19ceae4) - Renamed properties
PromptTokenstoInputTokenCount,CompletionTokenstoOutputTokenCount, andTotalTokenstoTotalTokenCountin theRunTokenUsageandRunStepTokenUsagetypes. (19ceae4) - Renamed properties
InputTokenstoInputTokenCountandTotalTokenstoTotalTokenCountin theEmbeddingTokenUsagetype. (19ceae4) - Renamed properties
MaxPromptTokenstoMaxInputTokenCountandMaxCompletionTokenstoMaxOutputTokenCountin theThreadRun,RunCreationOptions, andRunIncompleteReasontypes. (19ceae4) - Removed the
virtualkeyword from thePipelineproperty across all clients. (75eded5) - Renamed the
Granularitiesproperty ofAudioTranscriptionOptionstoTimestampGranularities. (a330c2e) - Changed
AudioTranscriptionFormatfrom an enum to an "extensible enum". (a330c2e) - Changed
AudioTranslationFormatfrom an enum to an "extensible enum". (a330c2e) - Changed
GenerateImageFormatfrom an enum to an "extensible enum". (a330c2e) - Changed
GeneratedImageQualityfrom an enum to an "extensible enum". (a330c2e) - Changed
GeneratedImageStylefrom an enum to an "extensible enum". (a330c2e) - Removed method overloads in
AssistantClientandVectorStoreClientthat take complex parameters in favor of methods that take simple string IDs. (a330c2e) - Updated the
TokenIdsproperty type in theTranscribedSegmenttype fromIReadOnlyList<int>toReadOnlyMemory<int>. (a330c2e) - Updated the
inputsparameter type in theGenerateEmbeddingsandGenerateEmbeddingsAsyncmethods ofEmbeddingClientfromIEnumerable<IEnumerable<int>>toIEnumerable<ReadOnlyMemory<int>>. (a330c2e) - Changed
ChatMessageContentPartKindfrom an extensible enum to an enum. (a330c2e) - Changed
ChatToolCallKindfrom an extensible enum to an enum. (a330c2e) - Changed
ChatToolKindfrom an extensible enum to an enum. (a330c2e) - Changed
OpenAIFilePurposefrom an extensible enum to an enum. (a330c2e) - Changed
OpenAIFileStatusfrom an extensible enum to an enum. (a330c2e) - Renamed
OpenAIFilePurposetoFilePurpose. (a330c2e) - Renamed
OpenAIFileStatustoFileStatus. (a330c2e) - Removed constructors that take string API key and options. (a330c2e)
- The library now includes support for the new OpenAI o1 model family. (2ab1a94)
ChatCompletionOptionswill automatically apply itsMaxOutputTokenCountvalue (renamed fromMaxTokens) to the newmax_completion_tokensrequest body propertyUsageincludes a newOutputTokenDetailsproperty with aReasoningTokenCountvalue that will reflecto1model use of this new subcategory of output tokens.- Note that
OutputTokenCount(completion_tokens) is the sum of displayed tokens generated by the model and (when applicable) these new reasoning tokens
- Assistants file search now includes support for
RankingOptions. (2ab1a94)- Use of the
include[]query string parameter and retrieval of run step detail result content is currently only available via protocol methods
- Use of the
- Added support for the Uploads API in
FileClient. ThisExperimentalfeature allows uploading large files in multiple parts. (2ab1a94)- The feature is supported by the
CreateUpload,AddUploadPart,CompleteUpload, andCancelUploadprotocol methods.
- The feature is supported by the
- Renamed
ChatMessageContentPart'sCreateTextMessageContentPartfactory method toCreateTextPart. (2ab1a94) - Renamed
ChatMessageContentPart'sCreateImageMessageContentPartfactory method toCreateImagePart. (2ab1a94) - Renamed
ChatMessageContentPart'sCreateRefusalMessageContentPartfactory method toCreateRefusalPart. (2ab1a94) - Renamed
ImageChatMessageContentPartDetailtoChatImageDetailLevel. (2ab1a94) - Removed
ChatMessageContentPart'sToStringoverload. (2ab1a94) - Renamed the
MaxTokensproperty inChatCompletionOptionstoMaxOutputTokenCount. (2ab1a94) - Renamed properties in
ChatTokenUsage: - Removed the common
ListOrderenum from the top-levelOpenAInamespace in favor of individual enums in their corresponding sub-namespace. (2ab1a94) - Renamed the
PageSizeproperty toPageSizeLimit. (2ab1a94) - Updated deletion methods to return a result object instead of a
bool. Affected methods: - Removed setters from collection properties. (2ab1a94)
- Renamed
ChatTokenLogProbabilityInfotoChatTokenLogProbabilityDetails. (2ab1a94) - Renamed
ChatTokenTopLogProbabilityInfotoChatTokenTopLogProbabilityDetails. (2ab1a94) - Renamed the
Utf8ByteValuesproperties ofChatTokenLogProbabilityDetailsandChatTokenTopLogProbabilityDetailstoUtf8Bytesand changed their type fromIReadOnlyList<int>toReadOnlyMemory<byte>?. (2ab1a94) - Renamed the
StartandEndproperties ofTranscribedSegmentandTranscribedWordtoStartTimeandEndTime. (2ab1a94) - Changed the type of
TranscribedSegment'sAverageLogProbabilityandNoSpeechProbabilityproperties fromdoubletofloat. (2ab1a94) - Changed the type of
TranscribedSegment'sSeekOffsetproperty fromlongtoint. (2ab1a94) - Changed the type of
TranscribedSegment'sTokenIdsproperty fromIReadOnlyList<long>toIReadOnlyList<int>. (2ab1a94) - Updated the
Embedding.Vectorproperty to theEmbedding.ToFloats()method. (2ab1a94) - Removed the optional parameter from the constructors of
VectorStoreCreationHelper,AssistantChatMessage, andChatFunction. (2ab1a94) - Removed the optional
purposeparameter fromFileClient.GetFilesAsyncandFileClient.GetFilesmethods, and added overloads wherepurposeis required. (2ab1a94) - Renamed
ModerationClient'sClassifyTextInputmethods toClassifyText. (2ab1a94) - Removed duplicated
Createdproperty fromGeneratedImageCollection. (2ab1a94)
- Addressed an issue that caused multi-page queries of fine-tuning jobs, checkpoints, and events to fail. (2ab1a94)
ChatCompletionOptionscan now be serialized viaModelReaderWriter.Write()prior to callingCompleteChatusing the options. (2ab1a94)
- Added support for
CancellationTokentoModelClientmethods. (2ab1a94) - Applied the
Obsoleteattribute where appropriate to align with the existing deprecations in the REST API. (2ab1a94)
- Added the
OpenAIChatModelFactoryin theOpenAI.Chatnamespace (a static class that can be used to instantiate OpenAI models for mocking in non-live test scenarios). (79014ab)
- Updated fine-tuning pagination methods
GetJobs,GetEvents, andGetJobCheckpointsto returnIEnumerable<ClientResult>instead ofClientResult. (5773292) - Updated the batching pagination method
GetBatchesto returnIEnumerable<ClientResult>instead ofClientResult. (5773292) - Changed
GeneratedSpeechVoicefrom an enum to an "extensible enum". (79014ab) - Changed
GeneratedSpeechFormatfrom an enum to an "extensible enum". (cc9169a) - Renamed
SpeechGenerationOptions'sSpeedproperty toSpeedRatio. (cc9169a)
- Corrected an internal deserialization issue that caused recent updates to Assistants
file_searchto fail when streaming a run. Strongly typed support forranking_optionsis not included but will arrive soon. (cc9169a) - Mitigated a .NET runtime issue that prevented
ChatResponseFormatfrom serializing correct on targets including Unity. (cc9169a)
- Reverted the removal of the version path parameter "v1" from the default endpoint URL. (583e9f6)
- Added the
Experimentalattribute to the following APIs:
- Renamed
AudioClient'sGenerateSpeechFromTextmethods to simplyGenerateSpeech. (d84bf54) - Changed the type of
OpenAIFileInfo'sSizeInBytesproperty fromlong?toint?. (d84bf54)
- Fixed a newly introduced bug (#185) where providing
OpenAIClientOptionsto a top-levelOpenAIClientdid not carry over to scenario clients (e.g.ChatClient) created via that top-level client (d84bf54)
- Removed the version path parameter "v1" from the default endpoint URL. (d84bf54)
- Added support for the new structured outputs response format feature, which enables chat completions, assistants, and tools on each of those clients to provide a specific JSON Schema that generated content should adhere to. (3467b53)
- To enable top-level structured outputs for response content, use
ChatResponseFormat.CreateJsonSchemaFormat()andAssistantResponseFormat.CreateJsonSchemaFormat()as theResponseFormatin method options likeChatCompletionOptions - To enable structured outputs for function tools, set
StrictParameterSchemaEnabledtotrueon the tool definition - For more information, please see the new section in readme.md
- To enable top-level structured outputs for response content, use
- Chat completions: the request message types of
AssistantChatMessage,SystemChatMessage, andToolChatMessagenow support array-based content part collections in addition to simple string input. (3467b53) - Added the following model factories (static classes that can be used to instantiate OpenAI models for mocking in non-live test scenarios):
OpenAIAudioModelFactoryin theOpenAI.Audionamespace (3284295)OpenAIEmbeddingsModelFactoryin theOpenAI.Embeddingsnamespace (3284295)OpenAIFilesModelFactoryin theOpenAI.Filesnamespace (b1ce397)OpenAIImagesModelFactoryin theOpenAI.Imagesnamespace (3284295)OpenAIModelsModelFactoryin theOpenAI.Modelsnamespace (b1ce397)OpenAIModerationsModelFactoryin theOpenAI.Moderationsnamespace (b1ce397)
- Removed client constructors that do not explicitly take an API key parameter or an endpoint via an
OpenAIClientOptionsparameter, making it clearer how to appropriately instantiate a client. (13a9c68) - Removed the endpoint parameter from all client constructors, making it clearer that an alternative endpoint must be specified via the
OpenAIClientOptionsparameter. (13a9c68) - Removed
OpenAIClient'sEndpointprotectedproperty. (13a9c68) - Made
OpenAIClient's constructor that takes aClientPipelineparameterprotected internalinstead of justprotected. (13a9c68) - Renamed the
Userproperty in applicable Options classes toEndUserId, making its purpose clearer. (13a9c68)
- The
AssistantsnamespaceVectorStoreCreationHelpertype now properly includes aChunkingStrategyproperty. (3467b53)
ChatCompletion.ToString()will no longer throw an exception when no content is present, as is the case for tool calls. Additionally, if a tool call is present with no content,ToString()will return the serialized form of the first available tool call. (3467b53)
- Changed name of return types from methods returning streaming collections from
ResultCollectiontoCollectionResult. (7bdecfd) - Changed return types from methods returning paginated collections from
PageableCollectiontoPageCollection. (7bdecfd) - Users must now call
GetAllValueson the collection of pages to enumerate collection items directly. Corresponding protocol methods returnIEnumerable<ClientResult>where each collection item represents a single service response holding a page of values. (7bdecfd) - Updated
VectorStoreFileCountsandVectorStoreFileAssociationErrortypes fromreadonly structtoclass. (58f93c8)
- (#49) Fixed a bug with extensible enums implementing case-insensitive equality but case-sensitive hash codes. (0c12500)
- (#57) Fixed a bug with requests URIs with query string parameter potentially containing a malformed double question mark (
??) on .NET Framework (net481). (0c12500) - Added optional
CancellationTokenparameters to methods forAssistantClientandVectorStoreclient, consistent with past changes in 19a65a0. (d77539c) - Fixed Assistants
FileSearchToolDefinition'sMaxResultsparameter to appropriately serialize and deserialize the value (d77539c) - Added missing
[EditorBrowsable(EditorBrowsableState.Never)]attributes toAssistantClientprotocol methods, which should improve discoverability of the strongly typed methods. (d77539c)
- Removed the usage of
initand updated properties to useset. (58f93c8)
- (#84) Fixed a
NullReferenceExceptionthrown when adding the custom headers policy whileOpenAIClientOptionsis null (0b97311)
OrganizationIdandProjectIdare now present onOpenAIClientOptions. When instantiating a client, providing an instance ofOpenAIClientOptionswith these properties set will cause the client to add the appropriate request headers for org/project, eliminating the need to manually configure the headers. (9ee7dff)
- (#72) Fixed
filenamerequest encoding in operations usingmultipart/form-data, includingfilesandaudio(2ba8e69) - (#79) Fixed hard-coded
userrole for caller-created Assistants API messages on threads (d665b61) - Fixed non-streaming Assistants API run step details not reporting code interpreter logs when present (d665b61)
Assistants (beta):
AssistantClient.CreateMessage()and the explicit constructor forThreadInitializationMessagenow require aMessageRoleparameter. This properly enables the ability to create an Assistant message representing conversation history on a new thread. (d665b61)
- API updates, current to openai/openai-openapi@dd73070b (1af6569)
- This includes
MaxResultsfor AssistantsFileSearchToolDefinition,ParallelToolCallsEnabledfor function tools in Assistants and Chat, andFileChunkingStrategyfor Assistants VectorStores
- This includes
- Optional
CancellationTokenparameters are now directly present on most methods, eliminating the need to use protocol methods (19a65a0)
- (#30) Mitigated a .NET runtime issue that prevented chat message content and several other types from serializing correct on targets including mono and wasm (896b9e0)
- Assistants: Fixed an issue that threw an exception when receiving code interpreter run step logs when streaming a run (207d597)
- Fixed a concurrency condition that could cause
multipart/form-datarequests to no longer generate random content part boundaries (no direct scenario impact) (7cacdee)
Assistants (beta):
InputQuoteis removed from AssistantsTextAnnotationandTextAnnotationUpdate, per openai/openai-openapi@dd73070b (1af6569)
- Added an environment-variable-based test project to the repository with baseline scenario coverage (db6328a)
- Build/analyzer warnings cleaned up throughout the project (45fc4d7, b1fa082, 22ab606)
- Proactively aligned library's implementation of server-sent event (SSE) handling with the source of the incoming
System.Net.ServerSentEventsnamespace (674e0f7)
- Added new, built-in helpers to simplify the use of text-only message content (1c40de6)
- Optimized embedding deserialization and addressed correctness on big endian systems (e28b5a7)
- Optimized b64_json message parsing via regex (efd76b5)
- Removed a vestigial package reference (5874f53)
This is the official OpenAI client library for C# / .NET. It provides convenient access to the OpenAI REST API from .NET applications and supports all the latest features. It is generated from our OpenAPI specification in collaboration with Microsoft.
If you are a user migrating from version 1.11.0 or earlier, we will soon share a migration guide to help you get started.
- Addendum: the migration guide is now available.