samarthputhraya opened a new pull request, #1470:
URL: https://github.com/apache/flink-agents/pull/1470

   Linked issue: #1462
   
   ### Purpose of change
   
   A setup that names no model now sends `gpt-6-luna` (Java Responses and Chat 
Completions, Python). OpenAI shuts down GPT-4o and GPT-4o mini, the old 
defaults, on 14 Jan 2027 and names `gpt-6-luna` as their replacement 
([deprecations](https://developers.openai.com/api/docs/deprecations)). Its 
page, like `gpt-6-sol`'s, says "Chat Completions supports function calling only 
with `reasoning_effort` set to `none`", so the Chat Completions setups now 
accept `"none"` and send it themselves when a tool is bound.
   
   #### Runtime flow
   
   1. Constructors accept `none`, `low`, `medium`, `high`; the default stays 
unset.
   2. The Chat Completions `open()` (Java, Python) first runs the base 
`open()`, which resolves declared, `load_skill` and sub-agent tools, then 
chooses `"none"` if a tool resolved, the model is exactly `gpt-6-luna` or 
`gpt-6-sol`, and `reasoning_effort` is set neither directly nor in 
`additional_kwargs`.
   3. `getParameters()`/`model_kwargs` send the configured value, else that 
choice, else nothing. Responses has no `open()`.
   
   #### Key decisions
   
   - Exact ids, not a `gpt-6` prefix: `gpt-6.2-astra`/`gpt-6.2-sol` reject 
`none`; `gpt-6.1-sol`/`gpt-6.1-terra` call tools through Responses only.
   - Chosen in `open()`, after skill and sub-agent tools exist; stored apart 
from `reasoning_effort` and reset on each `open()`, so a dumped Python setup 
reads as unconfigured and a re-open recomputes it.
   - `gpt-6` joins the structured-output prefixes: every GPT-6 model page lists 
`structured_outputs`.
   - Test-scoped `flink-core` in the openai chat-model pom: the base `open()` 
uses Flink's `Preconditions`.
   
   #### Related (not changed here)
   
   All three setups still send `temperature` 0.1 by default (no `top_p`). The 
[GPT-6 
guide](https://developers.openai.com/api/docs/guides/latest-model/gpt-6-astra): 
"When reasoning effort is not `none`, remove `temperature`, `top_p`, and 
`top_logprobs`." So with the new default and no temperature set, the Java 
Responses setup would fail every request (the HTTP 400 in #1467), and both Chat 
Completions setups would fail without tools or with `low`/`medium`/`high`. 
Should this PR also drop the default temperature from the Chat Completions 
setups, or #1467 cover all three before release?
   
   ### Behavioral Semantics
   
   #### Interaction decisions (Chat Completions)
   
   | Tools after `open()` | Model | Effort configured | Sent |
   |---|---|---|---|
   | one or more | `gpt-6-luna`, `gpt-6-sol` | no | `"none"` |
   | one or more | `gpt-6-luna`, `gpt-6-sol` | directly | that value |
   | one or more | `gpt-6-luna`, `gpt-6-sol` | in `additional_kwargs` | that 
value (in `additional_kwargs`) |
   | one or more | other | no | nothing |
   | none | any | no | nothing |
   | not opened | any | no | nothing |
   
   Responses: the configured value or nothing.
   
   #### Behavioral contracts
   
   1. No `model` means `gpt-6-luna` (all three).
   2. `"none"` is accepted and sent as configured (all three).
   3. A value other than `none`, `low`, `medium` or `high` is rejected at 
construction.
   4. Chat Completions sends `"none"` on its own only in the first row.
   5. A configured value, direct or in `additional_kwargs`, is sent unchanged.
   6. Responses never sets `reasoning_effort` on its own.
   7. `gpt-6*` text models report `NATIVE_RECOMMENDED` structured output.
   
   #### Failure behavior
   
   No new failure path: an invalid value fails at construction as before (Java 
`IllegalArgumentException`, Python `ValidationError`), and provider errors 
reach the caller unchanged.
   
   ### Tests
   
   | Contract | Java | Python |
   |---|---|---|
   | 1 | `testDefaultModel` (both setups) | `test_default_model_when_omitted`, 
`test_default_model_with_tool_sends_none` |
   | 2 | `testAcceptedReasoningEffortSent` (both) | 
`test_reasoning_effort_reaches_request` |
   | 3 | `testUnknownReasoningEffortRejected` (both) | 
`test_unknown_reasoning_effort_rejected` |
   | 4 | `testDefaultModelWithToolGetsNone`, `testKnownModelWithToolGetsNone`, 
`testSkillAndSubagentToolsCount`, `testNoDefaultWithoutTools`, 
`testNoDefaultForOtherModels`, `testNoDefaultBeforeOpen`, 
`testReopenRecomputesDefault`, `testReasoningEffortReachesRequestBody` | 
`test_known_model_with_tool_sends_none`, `test_skill_and_subagent_tools_count`, 
`test_no_default_without_tools`, `test_no_default_for_other_models`, 
`test_no_default_before_open`, 
`test_second_open_keeps_the_default_out_of_the_dump` |
   | 5 | `testConfiguredReasoningEffortKept`, 
`testReasoningEffortInAdditionalKwargsKept`, 
`testReasoningEffortReachesRequestBody` | 
`test_configured_reasoning_effort_kept`, 
`test_reasoning_effort_in_additional_kwargs_kept` |
   | 6 | `testNoDefaultReasoningEffortWithTools` (Responses) | Java only |
   | 7 | `testQueryRecommendsNativeForCapableModels` | 
`test_query_recommends_native_for_capable_models` |
   
   - `mvn -pl integrations/chat-models/openai spotless:check test`, JDK 17: 214 
run, 0 failures, 0 errors (main: 176).
   - `pytest` on the openai and vllm chat-model tests and `test_aliases.py`, 
Python 3.12: 154 passed, 6 skipped (main: 123, 6); `ruff check` passed.
   
   Not verified: no request reached OpenAI (live tests skipped); that Chat 
Completions takes `"none"` with tools and the default temperature rests on 
OpenAI's docs. Not run: JDK 11/21, Python 3.10/3.11, `tools/ut.sh`, e2e, 
`check-license.sh` (no new files).
   
   <details><summary>Implementation invariants, test paths and sources</summary>
   
   - Each known model lists one snapshot, named like it, hence the exact match.
   - The choice reads the setup's own `model` at `open()`; per-call parameters 
are not consulted, and a per-call `reasoning_effort` still overrides it.
   - A `reasoning_effort` key in `additional_kwargs` counts as configured 
whatever its value.
   - Both `open()` overrides clear the previous choice before deciding, so a 
re-opened setup recomputes it from the tools and model of that call. Java's 
base `open()` appends to `getToolNames()` and `getTools()`, so 
`testReopenRecomputesDefault` empties both lists before re-opening.
   - The test-scoped `flink-core` follows 
`integrations/embedding-models/openai/pom.xml`.
   - The cross-language wrappers delegate `open()` (Python 
`JavaChatModelSetup`, Java `PythonChatModelSetup`), so the choice is made where 
the request is built.
   - The vLLM setups subclass the Chat Completions setups in both languages: 
they accept `"none"`, and the exact ids keep the automatic choice off vLLM 
model names.
   - `ReasoningEffort.of` in the OpenAI Java SDK takes any string, so `"none"` 
needs no SDK change.
   - Request-path tests: Java opens the setup on a connection to a loopback 
HTTP endpoint, calls `chat()` and reads the body the endpoint received; Python 
opens the setup, calls `chat()` and reads the kwargs a recording client 
received.
   - Java test classes: rows 1-5 are in `OpenAICompletionsSetupTest` (rows 1-3 
also `OpenAIResponsesModelSetupTest`); row 7 is 
`OpenAICompletionsConnectionTest`. Python: `test_openai_setup_parameters.py`, 
`test_openai_chat_model.py` (row 1) and 
`test_openai_native_structured_output.py` (row 7).
   - Model pages (read 27 Nov 2026): 
[gpt-6-luna](https://developers.openai.com/api/docs/models/gpt-6-luna) and 
[gpt-6-sol](https://developers.openai.com/api/docs/models/gpt-6-sol): "Chat 
Completions supports function calling only with `reasoning_effort` set to 
`none`."; 
[gpt-6.2-astra](https://developers.openai.com/api/docs/models/gpt-6.2-astra) 
and [gpt-6.2-sol](https://developers.openai.com/api/docs/models/gpt-6.2-sol): 
"The API rejects requests that set reasoning effort to `none`."; 
[gpt-6.1-sol](https://developers.openai.com/api/docs/models/gpt-6.1-sol) and 
[gpt-6.1-terra](https://developers.openai.com/api/docs/models/gpt-6.1-terra): 
"Tool calling requires the Responses API." [Structured 
outputs](https://developers.openai.com/api/docs/guides/structured-outputs): 
"`gpt-4o-2024-08-06` model snapshots and later".
   - Default temperature at main: `OpenAIResponsesModelSetup` L60, L151 (sent 
at `OpenAIResponsesModelConnection` L173-176); `OpenAICompletionsSetup` L62, 
L157 (sent at `OpenAICompletionsConnection` L318-321); `openai_chat_model.py` 
L387, L478.
   
   </details>
   
   ### API
   
   No signature change. For an existing caller:
   - No `model`: Chat Completions calls `gpt-6-luna`, not `gpt-4o-mini`; 
Responses, not `gpt-4o`.
   - `gpt-6-luna`/`gpt-6-sol` with a tool, no effort set: Chat Completions now 
sends `"none"`.
   - `"none"` is newly accepted; nothing accepted before is rejected.
   - `gpt-6*` structured output: `FEASIBLE` to `NATIVE_RECOMMENDED`, so `AUTO` 
goes native.
   - Unchanged: other models, Azure, `temperature`, `store`, examples naming a 
model.
   
   ### 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: Claude Code 2.1.332 (Claude Opus 5.5)
   


-- 
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