samarthputhraya commented on code in PR #1470:
URL: https://github.com/apache/flink-agents/pull/1470#discussion_r4719547523
##########
integrations/chat-models/openai/src/main/java/org/apache/flink/agents/integrations/chatmodels/openai/OpenAICompletionsSetup.java:
##########
@@ -148,6 +173,24 @@ public OpenAICompletionsSetup(
resourceContext);
}
+ /**
+ * Resolves the connection, prompt and tools, then picks the default
{@code reasoning_effort}
+ * described on this class. The default depends on the resolved tools, so
it is chosen here
+ * rather than in the constructor.
+ */
+ @Override
+ public void open() throws Exception {
+ defaultReasoningEffort = null;
Review Comment:
Done in d03e180. `open()` no longer clears `defaultReasoningEffort`, and the
Python reset branch and the re-open line in its docstring are gone. I removed
`testReopenRecomputesDefault` in Java. In Python I took the second `open()` out
of `test_second_open_keeps_the_default_out_of_the_dump` and renamed it
`test_default_stays_out_of_the_dump`: after a single `open()` it still checks
that the chosen `"none"` stays out of `reasoning_effort` and `model_dump()`.
Happy to drop that one as well if you'd rather not have it.
##########
docs/content/docs/development/calling-llms/chat-models/providers.md:
##########
@@ -1004,13 +1004,13 @@ OpenAI provides cloud-based chat models with
state-of-the-art performance for a
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
-| `model` | str | `"gpt-4o-mini"` | Name of the chat model to use |
+| `model` | str | `"gpt-6-luna"` | Name of the chat model to use |
| `temperature` | float | `0.1` | Sampling temperature (0.0 to 2.0) |
| `max_tokens` | int | None | Maximum number of tokens to generate |
| `logprobs` | bool | None | Whether to return log probabilities per token |
| `top_logprobs` | int | `0` | Number of top token log probabilities to return
(0-20) |
| `strict` | bool | `False` | Enable strict mode for tool calling and schemas |
-| `reasoning_effort` | str | None | Reasoning effort level for reasoning
models ("low", "medium", "high") |
+| `reasoning_effort` | str | None | Reasoning effort level for reasoning
models ("none", "low", "medium", "high"). Unset by default, except on
`gpt-6-luna` and `gpt-6-sol`, which call functions through Chat Completions
only with `"none"`: a setup on one of them with at least one tool, including
the tools added for skills and sub-agents, sends `"none"` unless
`reasoning_effort` is set here or in `additional_kwargs` |
Review Comment:
Done in 7d51844. The `reasoning_effort` rows now list the accepted values
and say it's unset by default (both Chat Completions tables, and the Responses
row for consistency). One `{{< hint info >}}` sits right after the Chat
Completions setup tabs, so it covers Python and Java. It says that on
`gpt-6-luna` and `gpt-6-sol` the setup sends `"none"` when a tool is configured
(skill and sub-agent tools count) and `reasoning_effort` isn't set directly or
in `additional_kwargs`. I didn't build the docs site locally; the hint uses the
same markup as the other hints on that page.
##########
python/flink_agents/integrations/chat_models/openai/openai_chat_model.py:
##########
@@ -50,7 +50,7 @@
resolve_openai_credentials,
)
-DEFAULT_OPENAI_MODEL = "gpt-4o-mini"
+DEFAULT_OPENAI_MODEL = "gpt-6-luna"
Review Comment:
Thanks for checking those models. I did it here, in d3536da. The Chat
Completions setting is now `max_completion_tokens` in Java, Python and YAML
(YAML takes the descriptor argument names, so it follows):
- Java: `OpenAICompletionsSetup` reads and validates
`max_completion_tokens`, and `OpenAICompletionsConnection` reads it under that
name. The request field doesn't change, since Java already sent
`max_completion_tokens`.
- Python: `OpenAIChatModelSetup` has a `max_completion_tokens` field and
sends it under that name. No alias. `max_tokens` now fails at construction
(`extra="forbid"`). Java ignores an argument it doesn't read, so a Java
`max_tokens` is now ignored rather than rejected.
- `providers.md`: both setup tables and both usage examples. New tests on
each side check the request field and the old name.
- vLLM: both vLLM setups inherit the new name. Java vLLM requests are
unchanged. Python vLLM requests now send `max_completion_tokens` instead of
`max_tokens`, the same field the Java vLLM path already sent. vLLM's
`ChatCompletionRequest` has `max_completion_tokens` and marks `max_tokens`
"deprecated in favor of the max_completion_tokens field" (v0.10.2 and v0.14.1
API docs), and v0.10.2's `_validate_input` reads `request.max_completion_tokens
or request.max_tokens`. I haven't run it against a vLLM server.
- Left alone: the Responses setup (it maps `max_tokens` to
`max_output_tokens`) and Azure OpenAI, which isn't a subclass of either Chat
Completions setup and keeps `max_tokens` in both languages. Azure's Java
connection already sends `max_completion_tokens`; Python Azure still sends
`max_tokens`. I can line Azure up in a follow-up if you want.
Not tested against the API.
--
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]