Skip to content

Preserve unset booleans in GoogleGenAiChatOptions - #6992

Open
dlwldn30 wants to merge 1 commit into
spring-projects:mainfrom
dlwldn30:fix-google-genai-boolean-option-merge
Open

dlwldn30 wants to merge 1 commit into
spring-projects:mainfrom
dlwldn30:fix-google-genai-boolean-option-merge

Conversation

@dlwldn30

Copy link
Copy Markdown
Contributor

Problem

GoogleGenAiChatOptions converts unset googleSearchRetrieval and includeServerSideToolInvocations values from null to false when options are built.

ChatClient merges request options into model defaults by applying only non-null request values. Because an unrelated request option is already converted to false, it unintentionally disables model-level Google Search and server-side tool invocation defaults.

Changes

  • Preserve the nullable state of both optional Boolean fields.
  • Mark the fields as nullable to match their constructor parameters and getters.
  • Add regression coverage for unset values, unrelated request-option merges, and explicit false overrides.

The runtime consumers already use Boolean.TRUE.equals(...), so unset values continue to behave as disabled when requests are created while remaining distinguishable during option merging.

Testing

  • ./mvnw -Dmaven.build.cache.enabled=false -pl models/spring-ai-google-genai -am clean package
  • 9 reactor modules passed, including 206 tests in spring-ai-google-genai.

Signed-off-by: dlwldn30 <dlwldn30@naver.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants