eemario opened a new pull request, #1421: URL: https://github.com/apache/flink-agents/pull/1421
Linked issue: #1411 ### Purpose of change Use duration inputs for Java Anthropic `timeout` and Watsonx `request_timeout`, matching the types accepted by their HTTP clients. #### Runtime flow Resource arguments are parsed by the existing `DurationUtils` through `ResourceDescriptor.getDurationArgument`, then validated and passed to the client. Descriptor durations serialize as ISO-8601 strings and are parsed again when resources are instantiated. #### Key decisions Reuse the framework parser without changing it. The shared descriptor changes are identical to #1410 and can be rebased away once either PR merges. Native Python SDK configuration remains unchanged. ### Behavioral Semantics #### Input behavior | Input | Result | | --- | --- | | Duration, unit string, or ISO-8601 string | Parsed with whole-microsecond precision | | Bare integer or integer string | Milliseconds | | Omitted or null | Anthropic SDK default; Watsonx 120 seconds | | Invalid syntax or sub-microsecond value | IllegalArgumentException naming the argument | #### Consumer contracts and failures Anthropic accepts zero through Integer.MAX_VALUE milliseconds; positive fractional milliseconds round up before reaching OkHttp. Negative or out-of-range values fail during construction. Zero sets the SDK request timeout to zero. Watsonx requires a positive duration and preserves microsecond precision when passing it to JDK HttpRequest. Zero and negative values fail during construction. Request execution, credentials, and retry handling are unchanged. ### Tests | Contract | Coverage | | --- | --- | | Duration parsing, defaults, and descriptor JSON | ResourceDescriptorTest | | Anthropic input forms, JSON round-trip, zero, rounding, range, invalid values | AnthropicChatModelConnectionTest | | Watsonx duration inputs, JSON round-trip, positive-only validation | WatsonxChatModelConnectionTest | 158 focused Java tests passed. Spotless and git diff --check passed. Live provider requests and the Pemja cross-language suite were not run. <details> <summary>Verification command</summary> ```bash mvn --batch-mode --no-transfer-progress test -pl integrations/chat-models/anthropic,integrations/chat-models/watsonx -am -Dtest=ResourceDescriptorTest,AnthropicChatModelConnectionTest,WatsonxChatModelConnectionTest -Dsurefire.failIfNoSpecifiedTests=false ``` </details> ### API Java Anthropic `timeout` and Watsonx `request_timeout` now accept Duration / String / Number. Bare numbers now mean milliseconds rather than seconds; fractional numeric values must be replaced with duration strings or Duration values. Adds the public `ResourceDescriptor.getDurationArgument` accessor. Defaults remain unchanged; no deprecated compatibility path is retained. ### Documentation - [ ] doc-needed - [ ] doc-not-needed - [x] doc-included ### Was this patch authored or co-authored using generative AI tooling? - [x] Yes - [ ] No Generated-by: Codex CLI 0.167.0-alpha.4.1 (GPT-6) -- 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]
