Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Attempting to use SetNewMaxCompletionTokensPropertyEnabled in a new ChatCompletionOptions throws. #48287

Open
RogerBarreto opened this issue Feb 13, 2025 · 1 comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team OpenAI question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@RogerBarreto
Copy link

RogerBarreto commented Feb 13, 2025

Library name and version

Azure.AI.OpenAI 2.2.0-beta.1

Describe the bug

If we instantiate ChatCompletionOptions without enforcing a deserialization first, the additionalProperties internal field is not initialized (=null) and attempting to run the SetNewMaxCompletionTokensPropertyEnable extension method throws a ArgumentNullException.

Reproduction

var options1 = new ChatCompletionOptions();

// Throws Argument Null Exception.
options1.SetNewMaxCompletionTokensPropertyEnabled(true);

Exception

Image

Workaround (Proving the serialization point above)

ChatCompletionOptions options = ModelReaderWriter.Read<ChatCompletionOptions>(BinaryData.FromString("{}")!)!;

// This won't throw
options.SetNewMaxCompletionTokensPropertyEnabled(true);

Expected behavior

No errors.

Actual behavior

Argument Null Exception

Reproduction Steps

var options1 = new ChatCompletionOptions();
options1.SetNewMaxCompletionTokensPropertyEnabled(true);

Environment

.NET SDK:
Version: 9.0.103
Commit: 96da45d427
Workload version: 9.0.100-manifests.ea610b94
MSBuild version: 17.12.24+90b52dda6

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.103\

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team OpenAI question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. labels Feb 13, 2025
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jpalvarezl @ralph-msft @trrwilson.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team OpenAI question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

1 participant