eemario commented on code in PR #1470:
URL: https://github.com/apache/flink-agents/pull/1470#discussion_r4735456865


##########
python/flink_agents/integrations/chat_models/openai/openai_chat_model.py:
##########
@@ -444,47 +464,74 @@ class OpenAIChatModelSetup(BaseChatModelSetup):
         default=False,
         description="Whether to use strict mode for invoking tools/using 
schemas.",
     )
-    reasoning_effort: Literal["low", "medium", "high"] | None = Field(
+    reasoning_effort: _ReasoningEffort | None = Field(
         default=None,
         description="The effort to use for reasoning models.",
     )
+    # The effort open() chose because none was configured, or None.
+    _default_reasoning_effort: _ReasoningEffort | None = 
PrivateAttr(default=None)
 
     def __init__(
         self,
         *,
         model: str = DEFAULT_OPENAI_MODEL,
         temperature: float = DEFAULT_TEMPERATURE,
-        max_tokens: int | None = None,
+        max_completion_tokens: int | None = None,
         additional_kwargs: Dict[str, Any] | None = None,
         strict: bool = False,
-        reasoning_effort: Literal["low", "medium", "high"] | None = None,
+        reasoning_effort: _ReasoningEffort | None = None,
         **kwargs: Any,
     ) -> None:
         """Init method."""
         additional_kwargs = additional_kwargs or {}
         super().__init__(
             model=model,
             temperature=temperature,
-            max_tokens=max_tokens,
+            max_completion_tokens=max_completion_tokens,
             additional_kwargs=additional_kwargs,
             strict=strict,
             reasoning_effort=reasoning_effort,
             **kwargs,
         )
 
+    @override
+    def open(self) -> None:
+        """Resolve the connection, prompt and tools, then pick the default
+        ``reasoning_effort`` described on this class.
+
+        The default depends on the resolved tools, so it is chosen here rather 
than
+        at construction.
+        """
+        super().open()
+        configured = (
+            self.reasoning_effort is not None
+            or "reasoning_effort" in self.additional_kwargs
+        )
+        if (
+            not configured
+            and self.tools
+            and self.model in _MODELS_CALLING_TOOLS_ONLY_WITHOUT_REASONING

Review Comment:
   One non-blocking question about per-call model overrides. I opened a 
`gpt-6-luna` setup with a tool bound, then called `setup.chat(messages, 
model="gpt-6.2-sol")` without setting `reasoning_effort`. On the base commit, 
the SDK received the request with that field omitted. On this head, it receives 
`reasoning_effort="none"` from the Luna setup, which the [GPT-6.2 Sol 
docs](https://developers.openai.com/api/docs/models/gpt-6.2-sol) say the API 
rejects. Would it make sense to choose this default based on the model used for 
the individual request?



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