Zhuoxi2000 commented on code in PR #1454:
URL: https://github.com/apache/flink-agents/pull/1454#discussion_r4710040628


##########
api/src/main/java/org/apache/flink/agents/api/yaml/Aliases.java:
##########
@@ -209,18 +214,33 @@ public static String resolveEventType(String name) {
     }
 
     /**
-     * Look up a class alias for {@code (resourceType, language)}; return 
{@code name} unchanged on
-     * miss.
+     * Resolve a YAML {@code clazz} value for {@code (resourceType, language)}.
+     *
+     * <p>If {@code name} matches an alias, return the mapped class name. 
Otherwise, if it contains
+     * a dot, treat it as a fully-qualified custom class name and pass it 
through. Otherwise reject
+     * it as an unknown alias. This also rejects a short alias registered only 
for the other
+     * language. Java classes in the default package are not supported.
+     *
+     * @throws IllegalArgumentException if {@code name} is not a known alias 
and is not
+     *     package-qualified
      */
     public static String resolveClazz(String name, ResourceType resourceType, 
Language language) {
         Map<Language, Map<String, String>> byLang = 
CLAZZ_ALIASES.get(resourceType);
-        if (byLang == null) {
-            return name;
+        Map<String, String> bucket = byLang == null ? null : 
byLang.get(language);
+        String resolved = bucket == null ? null : bucket.get(name);
+        if (resolved != null) {
+            return resolved;
         }
-        Map<String, String> bucket = byLang.get(language);
-        if (bucket == null) {
+        if (name != null && name.indexOf('.') >= 0) {
             return name;
         }
-        return bucket.getOrDefault(name, name);
+        throw new IllegalArgumentException(

Review Comment:
   Merged with main, AliasesTest.clazzAliasCoversPythonMediaAndRerank now 
fails. Java dashscope_tts for media_model throws instead of passing through. 
Python test_resolve_clazz_covers_media_and_rerank_dashscope fails the same way.



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