weiqingy commented on code in PR #962:
URL: https://github.com/apache/flink-agents/pull/962#discussion_r3709789499


##########
python/flink_agents/api/yaml/tests/test_aliases.py:
##########
@@ -127,6 +127,36 @@ def test_resolve_clazz_default_language_is_python() -> 
None:
     assert default == explicit
 
 
+def test_resolve_clazz_covers_chat_model_java_gemini_and_azure_openai() -> 
None:
+    assert resolve_clazz("gemini", ResourceType.CHAT_MODEL_CONNECTION, 
"java").endswith(
+        "GeminiChatModelConnection"
+    )
+    assert resolve_clazz("gemini", ResourceType.CHAT_MODEL, "java").endswith(
+        "GeminiChatModelSetup"
+    )
+    assert resolve_clazz(
+        "azure_openai", ResourceType.CHAT_MODEL_CONNECTION, "java"
+    ).endswith("AzureOpenAIChatModelConnection")

Review Comment:
   `AzureOpenAIChatModelConnection` is the simple name on both sides of the 
bridge:
   
   - Python: 
`...chat_models.azure.azure_openai_chat_model.AzureOpenAIChatModelConnection`
   - Java: `...integrations.chatmodels.openai.AzureOpenAIChatModelConnection`
   
   So this passes even if the java entry ever lost its `.Java` and resolved to 
the Python class, and the same goes for the `Setup` assertion two lines down. 
The Java mirror catches that case because `isEqualTo` compares the whole 
constant, so the two sides aren't guarding equally right now.
   
   `test_resolve_clazz_dispatches_on_language` above already pins the package 
for this reason. Would it be worth borrowing that here?
   
   ```python
   azure_conn = resolve_clazz("azure_openai", 
ResourceType.CHAT_MODEL_CONNECTION, "java")
   assert azure_conn.startswith("org.apache.flink.agents")
   assert azure_conn.endswith("AzureOpenAIChatModelConnection")
   ```
   
   `azure_openai` is the only one of the six where the names collide, so it 
would just be these two.



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