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

Remove unnecessary null checks in AzureOpenAiChatOptions.Builder #1425

Closed
wants to merge 1 commit into from

Conversation

sobychacko
Copy link
Contributor

This is related to #889

This commit addresses a bug where certain fields were being made indirectly mandatory due to Assert.notNull checks in the Builder's with* methods. Specifically:

  • Removed Assert.notNull checks from withResponseFormat, withSeed, withLogprobs, withTopLogprobs, and withEnhancements methods.

These checks were causing exceptions in AzureOpenAiChatModel.getDefaultOptions when not all fields were set, leading to failures in methods like ChatClient.create, even when using the AzureOpenAiChatModel constructor with OpenAIClient.

The removal of these checks aligns with the @JsonInclude(Include.NON_NULL) annotation on AzureOpenAiChatOptions, which already ignores null options. This change maintains the intended flexibility while preventing unintended mandatory requirements.

This is related to spring-projects#889

This commit addresses a bug where certain fields were being made
indirectly mandatory due to Assert.notNull checks in the Builder's
with* methods. Specifically:

- Removed Assert.notNull checks from withResponseFormat, withSeed,
  withLogprobs, withTopLogprobs, and withEnhancements methods.

These checks were causing exceptions in AzureOpenAiChatModel.getDefaultOptions
when not all fields were set, leading to failures in methods like
ChatClient.create, even when using the AzureOpenAiChatModel constructor
with OpenAIClient.

The removal of these checks aligns with the @JsonInclude(Include.NON_NULL)
annotation on AzureOpenAiChatOptions, which already ignores null options.
This change maintains the intended flexibility while preventing unintended
mandatory requirements.
@markpollack
Copy link
Member

merged e29d38d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants