GreatEugenius commented on PR #843:
URL: https://github.com/apache/flink-agents/pull/843#issuecomment-4903495465

   Overall the approach looks good — reserved key in the params map, 
per-connection capability flag, native path gated behind "schema present + no 
tools", prompt path as fallback.
   
   One thought on the strip: right now every non-native connection has to pop 
the key itself (the 4 non-OpenAI Python ones do it purely to avoid leaking; the 
Java ones don't strip at all and are only safe incidentally). Since both 
languages already funnel through `BaseChatModelSetup.chat()` before 
`connection.chat(...)`, could we strip there based on the flag?
   
   ```python
   # Python
   if not connection.supports_native_structured_output:
       merged_kwargs.pop(STRUCTURED_OUTPUT_SCHEMA_KEY, None)
   ```
   
   ```java
   // Java
   if (!connection.supportsNativeStructuredOutput()) {
       params.remove(BaseChatModelConnection.STRUCTURED_OUTPUT_SCHEMA_KEY);
   }
   ```
   
   That removes the 4 leak-only pops on the Python side, closes the Java 
asymmetry, and gives the flag a real caller on both. Native connections would 
still pop themselves (to discard when tools are bound). Not blocking.


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