diff --git a/CHANGELOG.md b/CHANGELOG.md index f342d9893..d618f5bf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.0.0-beta.7 (Unreleased) + +## Bugs Fixed + +- ([#84](https://github.com/openai/openai-dotnet/issues/84)) Fixed a `NullReferenceException` thrown when adding the custom headers policy while `OpenAIClientOptions` is null (commit_hash) + ## 2.0.0-beta.6 (2024-06-21) ## Features Added diff --git a/src/Custom/OpenAIClient.cs b/src/Custom/OpenAIClient.cs index a9718090b..91a044de5 100644 --- a/src/Custom/OpenAIClient.cs +++ b/src/Custom/OpenAIClient.cs @@ -277,11 +277,11 @@ private static PipelinePolicy CreateAddCustomHeadersPolicy(OpenAIClientOptions o message.Request.Headers.Set(UserAgentHeaderName, telemetryDetails.ToString()); } - if (!string.IsNullOrEmpty(options.OrganizationId)) + if (!string.IsNullOrEmpty(options?.OrganizationId)) { message.Request.Headers.Set(OpenAIOrganizationHeaderName, options.OrganizationId); } - if (!string.IsNullOrEmpty(options.ProjectId)) + if (!string.IsNullOrEmpty(options?.ProjectId)) { message.Request.Headers.Set(OpenAIProjectHeaderName, options.ProjectId); } diff --git a/src/OpenAI.csproj b/src/OpenAI.csproj index ad20b8fe4..8f61f3af6 100644 --- a/src/OpenAI.csproj +++ b/src/OpenAI.csproj @@ -5,7 +5,7 @@ OpenAI 2.0.0 - beta.6 + beta.7 netstandard2.0;net6.0 latest