[integration][openai] Align default parameters for openai chat model between java and python#883
Open
rob-9 wants to merge 16 commits into
Open
[integration][openai] Align default parameters for openai chat model between java and python#883rob-9 wants to merge 16 commits into
rob-9 wants to merge 16 commits into
Conversation
wenjin272
reviewed
Jul 9, 2026
wenjin272
left a comment
Contributor
There was a problem hiding this comment.
Thanks for taking this on @rob-9. The code looks good to me, but I think we should also update the documentation.
The user-facing docs still describe the old Java defaults. After this PR, Java OpenAI/Azure connections explicitly default to timeout=60 and max_retries=3, but these tables still mention SDK fallback/None and max_retries=2. Please update the docs to match the new constructor behavior.
Author
|
@wenjin272 thx |
weiqingy
reviewed
Jul 10, 2026
weiqingy
reviewed
Jul 10, 2026
98af5a7 to
cf9be98
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
purpose
the Java OpenAI chat model connections (
OpenAICompletionsConnection,AzureOpenAIChatModelConnection, andOpenAIResponsesModelConnection) didn't set explicit defaults fortimeoutandmax_retries, falling through to the openai-java SDK's internal values. the Python SDK explicitly defaults totimeout=60sandmax_retries=3, meaning the same agent config behaves differently across languages.this PR aligns Java to match Python:
DEFAULT_TIMEOUT_SECONDS = 60/DEFAULT_MAX_RETRIES = 3constants inOpenAIChatCompletionsUtils.Optional.ofNullable(...).orElse(DEFAULT_*)so absent args get the explicit default.IllegalArgumentExceptionat construction time instead of being silently skipped.testing
OpenAICompletionsConnectionTest— asserts correct defaults, explicit overrides, negative rejection, zero acceptance, and api_key validation.OpenAIResponsesModelConnectionTest— same coverage for the Responses API connection.AzureOpenAIChatModelConnectionTestwith default-resolution, override, and boundary assertions.timeout == 60.0andmax_retries == 3.breaking changes
max_retriesdefault changed from 2 → 3 forOpenAICompletionsConnectionandOpenAIResponsesModelConnection.timeout=0was previously silently ignored (SDK default applied); it is now passed through asDuration.ofSeconds(0).docs
doc-not-needed