github-actions[bot] commented on code in PR #67673:
URL: https://github.com/apache/doris/pull/67673#discussion_r4059077622
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ai/Embed.java:
##########
@@ -119,11 +124,19 @@ private static String requireStringLiteral(Expression
arg, String argName, Strin
return value;
}
- private static void validateAIResource(String resourceName) {
+ private static void validateAIResource(String resourceName, boolean
isMultimodal) {
Resource resource =
Env.getCurrentEnv().getResourceMgr().getResource(resourceName);
if (!(resource instanceof AIResource)) {
throw new AnalysisException("AI resource '" + resourceName + "'
does not exist");
}
+ AIResource aiResource = (AIResource) resource;
+ boolean hasSupportedProperties =
aiResource.hasCompleteEmbedProperties()
Review Comment:
[P2] Require a multimodal-capable group for JSON EMBED. An embed-only OPENAI
resource passes here because its regular `ai.embed.*` group is complete; with
no `ai.embed.mm.*` group, BE selects that OPENAI group and JSON execution calls
`OpenAIAdapter::build_multimodal_embedding_request()`, which unconditionally
returns `NotSupported`. OPENAI is valid for STRING embeddings, so the existing
text-provider capability check cannot fix this case. Make JSON fallback
capability-aware (or require a complete multimodal group) and add a negative
OPENAI JSON test.
##########
be/src/exprs/function/ai/embed.h:
##########
@@ -94,6 +108,14 @@ class FunctionEmbed : public AIFunction<FunctionEmbed> {
static FunctionPtr create() { return std::make_shared<FunctionEmbed>(); }
private:
+ static bool _has_complete_resource_properties(std::string_view endpoint,
+ std::string_view
provider_type,
+ std::string_view model_name,
+ std::string_view api_key) {
+ return !endpoint.empty() && !provider_type.empty() &&
!model_name.empty() &&
+ (provider_type == "LOCAL" || !api_key.empty());
Review Comment:
[P2] Preserve JSON headers for no-key LOCAL embed groups. This new
completeness rule deliberately selects LOCAL without an API key, but
`AIFunction::do_send_request()` invokes `set_authentication()` only when the
key is nonempty. For `LocalAdapter` that hook is not authentication--it is the
only place that adds `Content-Type: application/json`--so the newly accepted
embed-only LOCAL path posts JSON with curl's default form content type and
JSON-only local endpoints can reject it. Run adapter header setup
unconditionally (or separate it from credential setup) and cover the full
no-key LOCAL send path.
--
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]