wenjin272 commented on code in PR #1051:
URL: https://github.com/apache/flink-agents/pull/1051#discussion_r3861524397


##########
python/flink_agents/api/chat_models/chat_model.py:
##########
@@ -115,6 +115,17 @@ class BaseChatModelConnection(Resource, ABC):
     One connection can be shared in multiple chat model setup.
     """
 
+    # Reject unrecognized constructor arguments instead of silently ignoring 
them
+    # (pydantic's default extra="ignore"), so a misspelled or unsupported 
config
+    # key fails loudly at construction time instead of appearing to apply and
+    # then having no effect. `name` is declared below purely so the resource
+    # name callers and the resource provider commonly pass through survives
+    # this check; it is not otherwise used by this class.
+    model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")

Review Comment:
   Applying `extra="forbid"` here also affects the Java chat-model wrappers. 
The current [cross-language 
CI](https://github.com/apache/flink-agents/actions/runs/32878446289/job/97901950082)
 fails because `JavaChatModelSetupImpl` receives `java_clazz` and 
`extract_reasoning`: `java_clazz` is bridge metadata, while `extract_reasoning` 
is a valid argument consumed by the Java Ollama setup, but both are rejected as 
unknown Python fields. Java descriptors intentionally carry 
implementation-specific arguments in an open map, so this also makes Java and 
Python validation semantics diverge.
   
   Could we keep strict validation for Python-native chat models while 
filtering these arguments before constructing `JavaChatModel*Impl`, or 
explicitly retaining `extra="ignore"` on the Java wrapper classes?



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