weiqingy commented on code in PR #883:
URL: https://github.com/apache/flink-agents/pull/883#discussion_r3563380956


##########
integrations/chat-models/openai/src/main/java/org/apache/flink/agents/integrations/chatmodels/openai/OpenAICompletionsConnection.java:
##########
@@ -98,15 +101,21 @@ public OpenAICompletionsConnection(
             builder.baseUrl(apiBaseUrl);
         }
 
-        Integer timeoutSeconds = descriptor.getArgument("timeout");
-        if (timeoutSeconds != null && timeoutSeconds > 0) {
-            builder.timeout(Duration.ofSeconds(timeoutSeconds));
-        }
-
-        Integer maxRetries = descriptor.getArgument("max_retries");
-        if (maxRetries != null && maxRetries >= 0) {
-            builder.maxRetries(maxRetries);
-        }
+        int rawTimeout =
+                Optional.ofNullable(descriptor.<Number>getArgument("timeout"))
+                        .map(Number::intValue)
+                        
.orElse(OpenAIChatCompletionsUtils.DEFAULT_TIMEOUT_SECONDS);
+        this.timeoutSeconds =
+                rawTimeout > 0 ? rawTimeout : 
OpenAIChatCompletionsUtils.DEFAULT_TIMEOUT_SECONDS;

Review Comment:
   Confirmed — matches Python's `Field(ge=0)` now (throws on negatives, accepts 
`0`), and the tests across all three connections close the branch. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to