This is an automated email from the ASF dual-hosted git repository.

wenjin272 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git


The following commit(s) were added to refs/heads/main by this push:
     new ef1cf860 [python] Reject unknown constructor arguments on chat model 
connections/setups (#1051)
ef1cf860 is described below

commit ef1cf860f2a06c465accb794389c3fff8a86803a
Author: Ashfaq <[email protected]>
AuthorDate: Thu Aug 27 09:25:59 2026 +0530

    [python] Reject unknown constructor arguments on chat model 
connections/setups (#1051)
    
    Generated-by: Claude Code 2.0.76 (Claude Sonnet 5)
---
 python/flink_agents/api/chat_models/chat_model.py    | 14 +++++++++++++-
 .../flink_agents/api/chat_models/java_chat_model.py  | 11 +++++++++++
 .../api/chat_models/tests/test_chat_model_base.py    | 18 ++++++++++++++++++
 .../anthropic/tests/test_anthropic_chat_model.py     |  6 ++----
 .../tests/test_anthropic_response_parsing.py         |  2 +-
 .../azure/tests/test_azure_openai_chat_model.py      |  4 ----
 .../test_azure_openai_native_structured_output.py    |  1 -
 .../integrations/chat_models/ollama_chat_model.py    |  2 --
 .../openai/tests/test_openai_chat_model.py           | 20 +++++---------------
 .../tests/test_openai_native_structured_output.py    |  2 +-
 .../chat_models/tests/test_ollama_chat_model.py      |  8 +++-----
 .../chat_models/tests/test_tongyi_chat_model.py      |  7 ++-----
 .../chat_models/vllm/tests/test_vllm_chat_model.py   | 16 +++++++---------
 .../watsonx/tests/test_watsonx_chat_model.py         | 14 +++-----------
 14 files changed, 66 insertions(+), 59 deletions(-)

diff --git a/python/flink_agents/api/chat_models/chat_model.py 
b/python/flink_agents/api/chat_models/chat_model.py
index cb1c663b..528ae347 100644
--- a/python/flink_agents/api/chat_models/chat_model.py
+++ b/python/flink_agents/api/chat_models/chat_model.py
@@ -20,7 +20,7 @@ from abc import ABC, abstractmethod
 from enum import Enum
 from typing import Any, ClassVar, Dict, List, Mapping, Sequence, Tuple, cast
 
-from pydantic import Field, PrivateAttr, field_validator
+from pydantic import ConfigDict, Field, PrivateAttr, field_validator
 from typing_extensions import override
 
 from flink_agents.api.agents.types import OutputSchema
@@ -115,6 +115,15 @@ 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. Java-backed subclasses (JavaChatModelConnection,
+    # JavaChatModelSetup) override this back to "ignore", since their 
descriptor
+    # arguments intentionally carry implementation-specific, provider-facing 
keys
+    # (e.g. java_clazz, extract_reasoning) that this base has no field for.
+    model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
+
     @classmethod
     @override
     def resource_type(cls) -> ResourceType:
@@ -279,6 +288,9 @@ class BaseChatModelSetup(Resource):
     different chat configurations.
     """
 
+    # See BaseChatModelConnection.model_config for rationale.
+    model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
+
     connection: str = Field(description="The referenced connection name.")
     model: str = Field(description="Name of the chat model to use.")
     _resolved_connection: BaseChatModelConnection | None = 
PrivateAttr(default=None)
diff --git a/python/flink_agents/api/chat_models/java_chat_model.py 
b/python/flink_agents/api/chat_models/java_chat_model.py
index be0768fa..74a3a7dd 100644
--- a/python/flink_agents/api/chat_models/java_chat_model.py
+++ b/python/flink_agents/api/chat_models/java_chat_model.py
@@ -15,6 +15,8 @@
 #  See the License for the specific language governing permissions and
 # limitations under the License.
 
#################################################################################
+from pydantic import ConfigDict
+
 from flink_agents.api.chat_models.chat_model import (
     BaseChatModelConnection,
     BaseChatModelSetup,
@@ -31,6 +33,12 @@ class JavaChatModelConnection(BaseChatModelConnection):
     unlike JavaChatModelSetup, it does not provide direct chat functionality 
in Python.
     """
 
+    # Java descriptors intentionally carry implementation-specific arguments 
(e.g.
+    # java_clazz, or setup-specific keys like extract_reasoning) in an open 
map, so
+    # this reverts the base class's strict extra="forbid" back to "ignore" 
rather
+    # than making Java and Python validation semantics diverge.
+    model_config = ConfigDict(arbitrary_types_allowed=True, extra="ignore")
+
     java_class_name: str = ""
 
 
@@ -44,4 +52,7 @@ class JavaChatModelSetup(BaseChatModelSetup):
     implementation.
     """
 
+    # See JavaChatModelConnection.model_config for rationale.
+    model_config = ConfigDict(arbitrary_types_allowed=True, extra="ignore")
+
     java_class_name: str = ""
diff --git a/python/flink_agents/api/chat_models/tests/test_chat_model_base.py 
b/python/flink_agents/api/chat_models/tests/test_chat_model_base.py
index 462674bd..a7524973 100644
--- a/python/flink_agents/api/chat_models/tests/test_chat_model_base.py
+++ b/python/flink_agents/api/chat_models/tests/test_chat_model_base.py
@@ -255,3 +255,21 @@ def 
test_native_strategy_forces_native_regardless_of_capability() -> None:
 def test_prompt_strategy_never_resolves_to_native() -> None:
     """PROMPT never resolves to native even when the model is capable."""
     assert StructuredOutputStrategy.PROMPT.resolves_to_native(True) is False
+
+
+def test_connection_rejects_unrecognized_constructor_argument() -> None:
+    """An unknown/misspelled constructor argument must raise, not be dropped.
+
+    Regression test: BaseChatModelConnection previously inherited pydantic's
+    default extra="ignore" behavior, so a caller who mistyped a config key (or
+    passed a key that only exists on a different language's implementation)
+    saw no error and no effect -- the value was silently discarded.
+    """
+    with pytest.raises(ValidationError, match="not_a_real_field"):
+        _RecordingConnection(not_a_real_field="oops")
+
+
+def test_setup_rejects_unrecognized_constructor_argument() -> None:
+    """Same guarantee as the connection, for BaseChatModelSetup."""
+    with pytest.raises(ValidationError, match="not_a_real_field"):
+        _RecordingChatModelSetup(connection="c", model="m", 
not_a_real_field="oops")
diff --git 
a/python/flink_agents/integrations/chat_models/anthropic/tests/test_anthropic_chat_model.py
 
b/python/flink_agents/integrations/chat_models/anthropic/tests/test_anthropic_chat_model.py
index 1aeb0ce5..c6a6e8f5 100644
--- 
a/python/flink_agents/integrations/chat_models/anthropic/tests/test_anthropic_chat_model.py
+++ 
b/python/flink_agents/integrations/chat_models/anthropic/tests/test_anthropic_chat_model.py
@@ -38,7 +38,7 @@ api_key = os.environ.get("TEST_API_KEY")
 
 @pytest.mark.skipif(api_key is None, reason="TEST_API_KEY is not set")
 def test_anthropic_chat_model() -> None:
-    connection = AnthropicChatModelConnection(name="anthropic_server", 
api_key=api_key)
+    connection = AnthropicChatModelConnection(api_key=api_key)
 
     def get_resource(name: str, type: ResourceType) -> Resource:
         if type == ResourceType.CHAT_MODEL_CONNECTION:
@@ -50,7 +50,6 @@ def test_anthropic_chat_model() -> None:
     mock_ctx.get_resource = get_resource
 
     chat_model = AnthropicChatModelSetup(
-        name="anthropic",
         model=test_model,
         connection="anthropic_server",
         resource_context=mock_ctx,
@@ -80,7 +79,7 @@ def add(a: int, b: int) -> int:
 
 @pytest.mark.skipif(api_key is None, reason="TEST_API_KEY is not set")
 def test_anthropic_chat_with_tools() -> None:
-    connection = AnthropicChatModelConnection(name="anthropic_server", 
api_key=api_key)
+    connection = AnthropicChatModelConnection(api_key=api_key)
 
     def get_resource(name: str, type: ResourceType) -> Resource:
         if type == ResourceType.CHAT_MODEL_CONNECTION:
@@ -92,7 +91,6 @@ def test_anthropic_chat_with_tools() -> None:
     mock_ctx.get_resource = get_resource
 
     chat_model = AnthropicChatModelSetup(
-        name="anthropic",
         model=test_model,
         connection="anthropic_server",
         tools=["add"],
diff --git 
a/python/flink_agents/integrations/chat_models/anthropic/tests/test_anthropic_response_parsing.py
 
b/python/flink_agents/integrations/chat_models/anthropic/tests/test_anthropic_response_parsing.py
index 90d3be81..421ac3cd 100644
--- 
a/python/flink_agents/integrations/chat_models/anthropic/tests/test_anthropic_response_parsing.py
+++ 
b/python/flink_agents/integrations/chat_models/anthropic/tests/test_anthropic_response_parsing.py
@@ -34,7 +34,7 @@ from 
flink_agents.integrations.chat_models.anthropic.anthropic_chat_model import
 
 
 def _connection() -> AnthropicChatModelConnection:
-    return AnthropicChatModelConnection(name="test", api_key="dummy")
+    return AnthropicChatModelConnection(api_key="dummy")
 
 
 def _connection_returning(message: Message) -> AnthropicChatModelConnection:
diff --git 
a/python/flink_agents/integrations/chat_models/azure/tests/test_azure_openai_chat_model.py
 
b/python/flink_agents/integrations/chat_models/azure/tests/test_azure_openai_chat_model.py
index 0f1c99fb..3febba04 100644
--- 
a/python/flink_agents/integrations/chat_models/azure/tests/test_azure_openai_chat_model.py
+++ 
b/python/flink_agents/integrations/chat_models/azure/tests/test_azure_openai_chat_model.py
@@ -45,7 +45,6 @@ api_version = os.environ.get("AZURE_OPENAI_API_VERSION")
 @pytest.mark.skipif(api_key is None, reason="AZURE_OPENAI_API_KEY is not set")
 def test_azure_openai_chat_model() -> None:
     connection = AzureOpenAIChatModelConnection(
-        name="azure_openai",
         api_key=api_key,
         azure_endpoint=azure_endpoint,
         api_version=api_version,
@@ -61,7 +60,6 @@ def test_azure_openai_chat_model() -> None:
     mock_ctx.get_resource = get_resource
 
     chat_model = AzureOpenAIChatModelSetup(
-        name="azure_openai",
         model=test_deployment,
         connection="azure_openai",
         resource_context=mock_ctx,
@@ -92,7 +90,6 @@ def add(a: int, b: int) -> int:
 @pytest.mark.skipif(api_key is None, reason="AZURE_OPENAI_API_KEY is not set")
 def test_azure_openai_chat_with_tools() -> None:
     connection = AzureOpenAIChatModelConnection(
-        name="azure_openai",
         api_key=api_key,
         azure_endpoint=azure_endpoint,
         api_version=api_version,
@@ -108,7 +105,6 @@ def test_azure_openai_chat_with_tools() -> None:
     mock_ctx.get_resource = get_resource
 
     chat_model = AzureOpenAIChatModelSetup(
-        name="azure_openai",
         model=test_deployment,
         connection="azure_openai",
         tools=["add"],
diff --git 
a/python/flink_agents/integrations/chat_models/azure/tests/test_azure_openai_native_structured_output.py
 
b/python/flink_agents/integrations/chat_models/azure/tests/test_azure_openai_native_structured_output.py
index 063f3dc2..cbaf084d 100644
--- 
a/python/flink_agents/integrations/chat_models/azure/tests/test_azure_openai_native_structured_output.py
+++ 
b/python/flink_agents/integrations/chat_models/azure/tests/test_azure_openai_native_structured_output.py
@@ -73,7 +73,6 @@ def _connection(
     api_version: str = CAPABLE_API_VERSION,
 ) -> AzureOpenAIChatModelConnection:
     conn = AzureOpenAIChatModelConnection(
-        name="azure_openai",
         api_key="test-key",
         azure_endpoint="https://example.openai.azure.com";,
         api_version=api_version,
diff --git a/python/flink_agents/integrations/chat_models/ollama_chat_model.py 
b/python/flink_agents/integrations/chat_models/ollama_chat_model.py
index b0061fb8..bd16905a 100644
--- a/python/flink_agents/integrations/chat_models/ollama_chat_model.py
+++ b/python/flink_agents/integrations/chat_models/ollama_chat_model.py
@@ -242,7 +242,6 @@ class OllamaChatModelSetup(BaseChatModelSetup):
         model: str,
         temperature: float = 0.75,
         num_ctx: int = DEFAULT_CONTEXT_WINDOW,
-        request_timeout: float | None = DEFAULT_REQUEST_TIMEOUT,
         additional_kwargs: Dict[str, Any] | None = None,
         keep_alive: float | str | None = None,
         think: bool | Literal["low", "medium", "high"] = True,
@@ -257,7 +256,6 @@ class OllamaChatModelSetup(BaseChatModelSetup):
             model=model,
             temperature=temperature,
             num_ctx=num_ctx,
-            request_timeout=request_timeout,
             additional_kwargs=additional_kwargs,
             keep_alive=keep_alive,
             think=think,
diff --git 
a/python/flink_agents/integrations/chat_models/openai/tests/test_openai_chat_model.py
 
b/python/flink_agents/integrations/chat_models/openai/tests/test_openai_chat_model.py
index 6eae8273..5a30004c 100644
--- 
a/python/flink_agents/integrations/chat_models/openai/tests/test_openai_chat_model.py
+++ 
b/python/flink_agents/integrations/chat_models/openai/tests/test_openai_chat_model.py
@@ -45,9 +45,7 @@ api_base_url = os.environ.get("TEST_API_BASE_URL")
 
 @pytest.mark.skipif(api_key is None, reason="TEST_API_KEY is not set")
 def test_openai_chat_model() -> None:
-    connection = OpenAIChatModelConnection(
-        name="openai", api_key=api_key, api_base_url=api_base_url
-    )
+    connection = OpenAIChatModelConnection(api_key=api_key, 
api_base_url=api_base_url)
 
     def get_resource(name: str, type: ResourceType) -> Resource:
         if type == ResourceType.CHAT_MODEL_CONNECTION:
@@ -59,7 +57,7 @@ def test_openai_chat_model() -> None:
     mock_ctx.get_resource = get_resource
 
     chat_model = OpenAIChatModelSetup(
-        name="openai", model=test_model, connection="openai", 
resource_context=mock_ctx
+        model=test_model, connection="openai", resource_context=mock_ctx
     )
     response = chat_model.chat([ChatMessage(role=MessageRole.USER, 
content="Hello!")])
     assert response is not None
@@ -86,9 +84,7 @@ def add(a: int, b: int) -> int:
 
 @pytest.mark.skipif(api_key is None, reason="TEST_API_KEY is not set")
 def test_openai_chat_with_tools() -> None:
-    connection = OpenAIChatModelConnection(
-        name="openai", api_key=api_key, api_base_url=api_base_url
-    )
+    connection = OpenAIChatModelConnection(api_key=api_key, 
api_base_url=api_base_url)
 
     def get_resource(name: str, type: ResourceType) -> Resource:
         if type == ResourceType.CHAT_MODEL_CONNECTION:
@@ -100,7 +96,6 @@ def test_openai_chat_with_tools() -> None:
     mock_ctx.get_resource = get_resource
 
     chat_model = OpenAIChatModelSetup(
-        name="openai",
         model=test_model,
         connection="openai",
         tools=["add"],
@@ -130,9 +125,7 @@ def test_default_model_when_omitted() -> None:
 
 def test_connection_default_timeout_and_max_retries() -> None:
     """Pin canonical connection defaults to prevent silent drift."""
-    conn = OpenAIChatModelConnection(
-        name="test", api_key="fake", api_base_url="http://localhost";
-    )
+    conn = OpenAIChatModelConnection(api_key="fake", 
api_base_url="http://localhost";)
     assert conn.timeout == 60.0
     assert conn.max_retries == 3
 
@@ -140,7 +133,7 @@ def test_connection_default_timeout_and_max_retries() -> 
None:
 def test_zero_timeout_disables_client_timeout() -> None:
     """Keep zero-timeout semantics aligned with the Java OpenAI SDK."""
     conn = OpenAIChatModelConnection(
-        name="test", api_key="fake", api_base_url="http://localhost";, timeout=0
+        api_key="fake", api_base_url="http://localhost";, timeout=0
     )
 
     assert conn.client.timeout is None
@@ -156,7 +149,6 @@ def test_zero_timeout_disables_client_timeout() -> None:
 def test_zero_timeout_disables_custom_http_client_timeout() -> None:
     http_client = httpx.Client(timeout=10.0)
     conn = OpenAIChatModelConnection(
-        name="test",
         api_key="fake",
         api_base_url="http://localhost";,
         timeout=0,
@@ -173,7 +165,6 @@ def test_zero_timeout_disables_custom_http_client_timeout() 
-> None:
 def test_connection_rejects_non_finite_timeout(timeout: float) -> None:
     with pytest.raises(ValidationError, match="finite"):
         OpenAIChatModelConnection(
-            name="test",
             api_key="fake",
             api_base_url="http://localhost";,
             timeout=timeout,
@@ -192,7 +183,6 @@ def test_connection_rejects_values_beyond_java_sdk_limits(
 ) -> None:
     with pytest.raises(ValidationError, match="less than or equal"):
         OpenAIChatModelConnection(
-            name="test",
             api_key="fake",
             api_base_url="http://localhost";,
             **{argument: value},
diff --git 
a/python/flink_agents/integrations/chat_models/openai/tests/test_openai_native_structured_output.py
 
b/python/flink_agents/integrations/chat_models/openai/tests/test_openai_native_structured_output.py
index ce6909f7..7132d804 100644
--- 
a/python/flink_agents/integrations/chat_models/openai/tests/test_openai_native_structured_output.py
+++ 
b/python/flink_agents/integrations/chat_models/openai/tests/test_openai_native_structured_output.py
@@ -40,7 +40,7 @@ class Person(BaseModel):
 
 def _connection() -> OpenAIChatModelConnection:
     conn = OpenAIChatModelConnection(
-        name="openai", api_key="test-key", api_base_url="http://localhost";
+        api_key="test-key", api_base_url="http://localhost";
     )
     mock_client = MagicMock()
     mock_message = MagicMock()
diff --git 
a/python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py 
b/python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py
index e9782649..cceedcd2 100644
--- 
a/python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py
+++ 
b/python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py
@@ -42,7 +42,7 @@ client = pull_model(test_model)
     client is None, reason="Ollama client is not available or test model is 
missing"
 )
 def test_ollama_chat() -> None:
-    server = OllamaChatModelConnection(name="ollama", request_timeout=120.0)
+    server = OllamaChatModelConnection(request_timeout=120.0)
     response = server.chat(
         [ChatMessage(role=MessageRole.USER, content="Hello!")], 
model=test_model
     )
@@ -76,7 +76,7 @@ def get_tool(name: str, type: ResourceType) -> FunctionTool:
     client is None, reason="Ollama client is not available or test model is 
missing"
 )
 def test_ollama_chat_with_tools() -> None:
-    connection = OllamaChatModelConnection(name="ollama", 
request_timeout=120.0)
+    connection = OllamaChatModelConnection(request_timeout=120.0)
 
     def get_resource(name: str, type: ResourceType) -> Resource:
         if type == ResourceType.TOOL:
@@ -88,7 +88,6 @@ def test_ollama_chat_with_tools() -> None:
     mock_ctx.get_resource = get_resource
 
     llm = OllamaChatModelSetup(
-        name="ollama",
         connection="ollama",
         model=test_model,
         tools=["add"],
@@ -155,7 +154,7 @@ def test_ollama_chat_with_extract_reasoning() -> None:
     # Configure mock client to return our mock response
     mock_client.chat.return_value = mock_response
     # Create model with mocked client
-    connection = OllamaChatModelConnection(name="ollama")
+    connection = OllamaChatModelConnection()
 
     def get_resource(name: str, type: ResourceType) -> Resource:
         return connection
@@ -164,7 +163,6 @@ def test_ollama_chat_with_extract_reasoning() -> None:
     mock_ctx.get_resource = get_resource
 
     llm = OllamaChatModelSetup(
-        name="ollama",
         connection="ollama",
         model=test_model,
         extract_reasoning=True,
diff --git 
a/python/flink_agents/integrations/chat_models/tests/test_tongyi_chat_model.py 
b/python/flink_agents/integrations/chat_models/tests/test_tongyi_chat_model.py
index 99742251..f46d7bc8 100644
--- 
a/python/flink_agents/integrations/chat_models/tests/test_tongyi_chat_model.py
+++ 
b/python/flink_agents/integrations/chat_models/tests/test_tongyi_chat_model.py
@@ -41,7 +41,7 @@ api_key_available = "DASHSCOPE_API_KEY" in os.environ
 @pytest.mark.skipif(not api_key_available, reason="DashScope API key is not 
set")
 def test_tongyi_chat() -> None:
     """Test basic chat functionality of TongyiChatModelConnection."""
-    connection = TongyiChatModelConnection(name="tongyi")
+    connection = TongyiChatModelConnection()
     response = connection.chat(
         [ChatMessage(role=MessageRole.USER, content="Hello!")], 
model=test_model
     )
@@ -77,7 +77,7 @@ def get_tool(name: str, type: ResourceType) -> FunctionTool:
 @pytest.mark.skipif(not api_key_available, reason="DashScope API key is not 
set")
 def test_tongyi_chat_with_tools() -> None:
     """Test chat functionality with tool calling."""
-    connection = TongyiChatModelConnection(name="tongyi")
+    connection = TongyiChatModelConnection()
 
     def get_resource(name: str, type: ResourceType) -> Resource:
         if type == ResourceType.TOOL:
@@ -89,7 +89,6 @@ def test_tongyi_chat_with_tools() -> None:
     mock_ctx.get_resource = get_resource
 
     llm = TongyiChatModelSetup(
-        name="tongyi",
         model=test_model,
         connection="tongyi",
         tools=["add"],
@@ -146,7 +145,6 @@ def test_tongyi_chat_with_extract_reasoning(monkeypatch: 
pytest.MonkeyPatch) ->
     )
 
     connection = TongyiChatModelConnection(
-        name="tongyi",
         api_key=os.environ.get("DASHSCOPE_API_KEY", "fake-key"),
     )
 
@@ -157,7 +155,6 @@ def test_tongyi_chat_with_extract_reasoning(monkeypatch: 
pytest.MonkeyPatch) ->
     mock_ctx.get_resource = get_resource
 
     llm = TongyiChatModelSetup(
-        name="tongyi",
         model=test_model,
         connection="tongyi",
         extract_reasoning=True,
diff --git 
a/python/flink_agents/integrations/chat_models/vllm/tests/test_vllm_chat_model.py
 
b/python/flink_agents/integrations/chat_models/vllm/tests/test_vllm_chat_model.py
index 36b9b8e2..77192e10 100644
--- 
a/python/flink_agents/integrations/chat_models/vllm/tests/test_vllm_chat_model.py
+++ 
b/python/flink_agents/integrations/chat_models/vllm/tests/test_vllm_chat_model.py
@@ -34,7 +34,7 @@ from 
flink_agents.integrations.chat_models.vllm.vllm_chat_model import (
 
 
 def test_connection_defaults_to_local_vllm_server() -> None:
-    connection = VLLMChatModelConnection(name="vllm")
+    connection = VLLMChatModelConnection()
     assert isinstance(connection, OpenAIChatModelConnection)
     assert connection.api_base_url == DEFAULT_VLLM_API_BASE_URL
     assert connection.api_key == DEFAULT_VLLM_API_KEY
@@ -42,7 +42,6 @@ def test_connection_defaults_to_local_vllm_server() -> None:
 
 def test_connection_honors_explicit_arguments() -> None:
     connection = VLLMChatModelConnection(
-        name="vllm",
         api_key="secret-key",
         api_base_url="http://vllm-host:8000/v1";,
         timeout=30.0,
@@ -56,24 +55,24 @@ def test_connection_honors_explicit_arguments() -> None:
 
 def test_setup_requires_model() -> None:
     with pytest.raises(ValueError, match="model is required for vLLM"):
-        VLLMChatModelSetup(name="vllm_model", connection="vllm")
+        VLLMChatModelSetup(connection="vllm")
 
 
 def test_connection_defaults_whitespace_only_arguments() -> None:
     # Semantic parity with the Java connection, which treats blank values as 
absent.
-    connection = VLLMChatModelConnection(name="vllm", api_key=" ", 
api_base_url="  ")
+    connection = VLLMChatModelConnection(api_key=" ", api_base_url="  ")
     assert connection.api_key == DEFAULT_VLLM_API_KEY
     assert connection.api_base_url == DEFAULT_VLLM_API_BASE_URL
 
 
 def test_setup_rejects_whitespace_only_model() -> None:
     with pytest.raises(ValueError, match="model is required for vLLM"):
-        VLLMChatModelSetup(name="vllm_model", connection="vllm", model=" ")
+        VLLMChatModelSetup(connection="vllm", model=" ")
 
 
 def test_setup_rejects_empty_model() -> None:
     with pytest.raises(ValueError, match="model is required for vLLM"):
-        VLLMChatModelSetup(name="vllm_model", connection="vllm", model="")
+        VLLMChatModelSetup(connection="vllm", model="")
 
 
 class _Person(BaseModel):
@@ -84,7 +83,7 @@ class _Person(BaseModel):
 
 
 def test_supports_native_structured_output_follows_served_model() -> None:
-    connection = VLLMChatModelConnection(name="vllm")
+    connection = VLLMChatModelConnection()
     assert 
connection.supports_native_structured_output("Qwen/Qwen2.5-7B-Instruct")
     assert connection.supports_native_structured_output(
         "meta-llama/Llama-3.1-8B-Instruct"
@@ -94,7 +93,7 @@ def 
test_supports_native_structured_output_follows_served_model() -> None:
 
 
 def test_native_response_format_applied_for_qwen_model() -> None:
-    connection = VLLMChatModelConnection(name="vllm")
+    connection = VLLMChatModelConnection()
     mock_client = MagicMock()
     mock_message = MagicMock()
     mock_message.role = "assistant"
@@ -119,7 +118,6 @@ def test_native_response_format_applied_for_qwen_model() -> 
None:
 
 def test_setup_carries_served_model_name() -> None:
     setup = VLLMChatModelSetup(
-        name="vllm_model",
         connection="vllm",
         model="Qwen/Qwen2.5-7B-Instruct",
         temperature=0.3,
diff --git 
a/python/flink_agents/integrations/chat_models/watsonx/tests/test_watsonx_chat_model.py
 
b/python/flink_agents/integrations/chat_models/watsonx/tests/test_watsonx_chat_model.py
index 57063f60..ab79674c 100644
--- 
a/python/flink_agents/integrations/chat_models/watsonx/tests/test_watsonx_chat_model.py
+++ 
b/python/flink_agents/integrations/chat_models/watsonx/tests/test_watsonx_chat_model.py
@@ -41,7 +41,6 @@ credentials_available = (
 def _fake_connection(**kwargs: Any) -> WatsonxChatModelConnection:
     """Create a connection with fake credentials for offline tests."""
     return WatsonxChatModelConnection(
-        name="watsonx",
         url=kwargs.pop("url", "https://us-south.ml.cloud.ibm.com";),
         api_key=kwargs.pop("api_key", "fake-key"),
         project_id=kwargs.pop("project_id", "fake-project"),
@@ -55,7 +54,7 @@ def _fake_connection(**kwargs: Any) -> 
WatsonxChatModelConnection:
 )
 def test_watsonx_chat() -> None:
     """Test basic chat functionality of WatsonxChatModelConnection."""
-    connection = WatsonxChatModelConnection(name="watsonx")
+    connection = WatsonxChatModelConnection()
     response = connection.chat(
         [ChatMessage(role=MessageRole.USER, content="Hello!")], 
model=test_model
     )
@@ -103,7 +102,6 @@ def test_watsonx_chat_mocked(monkeypatch: 
pytest.MonkeyPatch) -> None:
     mock_ctx.get_resource = get_resource
 
     llm = WatsonxChatModelSetup(
-        name="watsonx",
         model=test_model,
         connection="watsonx",
         temperature=0.5,
@@ -315,22 +313,18 @@ def test_configuration_contract(monkeypatch: 
pytest.MonkeyPatch) -> None:
         monkeypatch.delenv(var, raising=False)
 
     with pytest.raises(ValueError, match="url"):
-        WatsonxChatModelConnection(name="watsonx")
+        WatsonxChatModelConnection()
 
     with pytest.raises(ValueError, match="credentials"):
-        WatsonxChatModelConnection(
-            name="watsonx", url="https://us-south.ml.cloud.ibm.com";
-        )
+        WatsonxChatModelConnection(url="https://us-south.ml.cloud.ibm.com";)
 
     with pytest.raises(ValueError, match="project or space"):
         WatsonxChatModelConnection(
-            name="watsonx",
             url="https://us-south.ml.cloud.ibm.com";,
             api_key="fake-key",
         )
 
     connection = WatsonxChatModelConnection(
-        name="watsonx",
         url=" https://us-south.ml.cloud.ibm.com ",
         api_key=" fake-key ",
         space_id=" fake-space ",
@@ -343,7 +337,6 @@ def test_configuration_contract(monkeypatch: 
pytest.MonkeyPatch) -> None:
 
     with pytest.raises(ValueError, match=r"cannot both be provided.*exactly 
one"):
         WatsonxChatModelConnection(
-            name="watsonx",
             url="https://us-south.ml.cloud.ibm.com";,
             api_key="fake-key",
             project_id="fake-project",
@@ -352,7 +345,6 @@ def test_configuration_contract(monkeypatch: 
pytest.MonkeyPatch) -> None:
 
     with pytest.raises(ValueError, match=r"api_key and token.*exactly one"):
         WatsonxChatModelConnection(
-            name="watsonx",
             url=" https://us-south.ml.cloud.ibm.com ",
             api_key=" fake-key ",
             token=" fake-token ",

Reply via email to