linrrzqqq commented on code in PR #67673:
URL: https://github.com/apache/doris/pull/67673#discussion_r3978872272


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/AIProperties.java:
##########
@@ -53,29 +58,31 @@ public class AIProperties extends BaseProperties {
     public static final String VALIDITY_CHECK = "ai.validity_check";
 
     public static final List<String> REQUIRED_FIELDS = Arrays.asList(ENDPOINT, 
PROVIDER_TYPE, MODEL_NAME);
+    public static final List<String> EMBED_REQUIRED_FIELDS =
+            Arrays.asList(EMBED_ENDPOINT, EMBED_PROVIDER_TYPE, 
EMBED_MODEL_NAME);
     public static final List<String> PROVIDERS
             = Arrays.asList("OPENAI", "LOCAL", "GEMINI", "DEEPSEEK", 
"ANTHROPIC",
             "MOONSHOT", "QWEN", "MINIMAX", "ZHIPU", "BAICHUAN", "VOYAGEAI", 
"JINA");
+    public static final List<String> EFFORT_LEVELS =
+            Arrays.asList("none", "minimal", "low", "medium", "high", "xhigh", 
"max");
 
     public static void requiredAIProperties(Map<String, String> properties) 
throws DdlException {
-        // Check required field
-        for (String field : REQUIRED_FIELDS) {
-            if (Strings.isNullOrEmpty(properties.get(field))) {
-                throw new DdlException("Missing [" + field + "] in 
properties.");
-            }
+        boolean hasGeneralProperties = hasAnyProperty(properties, 
REQUIRED_FIELDS, API_KEY);
+        boolean hasEmbedProperties = hasAnyProperty(properties, 
EMBED_REQUIRED_FIELDS, EMBED_API_KEY);
+        if (!hasGeneralProperties && !hasEmbedProperties) {
+            throw new DdlException("At least one complete AI property group 
must be configured.");
         }
 
-        // Check the provider is valid
-        properties.put(PROVIDER_TYPE, 
properties.get(PROVIDER_TYPE).toUpperCase());
-        if (PROVIDERS.stream().noneMatch(s -> 
s.equals(properties.get(PROVIDER_TYPE).toUpperCase()))) {
-            throw new DdlException("Provider must be one of " + PROVIDERS);
+        if (hasGeneralProperties) {
+            validatePropertyGroup(properties, REQUIRED_FIELDS, PROVIDER_TYPE, 
API_KEY);
+        }
+        if (hasEmbedProperties) {
+            validatePropertyGroup(properties, EMBED_REQUIRED_FIELDS, 
EMBED_PROVIDER_TYPE, EMBED_API_KEY);

Review Comment:
   dismiss



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to