branch-4.1: [Enhance](ai_func) Support dedicate embed properties in AI RESOURCE (#67673) - #68384
Merged
Merged
Conversation
…pache#67673) Issue Number: close #xxx Related PR: #xxx Problem Summary: - Add dedicated embedding properties to AI resources: - `ai.embed.endpoint` - `ai.embed.provider_type` - `ai.embed.model_name` - `ai.embed.api_key` - Require at least one complete property group when creating an AI resource: - the general `ai.*` group, or - the `ai.embed.*` group - Use `ai.embed.*` when executing the `EMBED` function if the embed property group is configured. - Fall back to the general `ai.*` properties otherwise. - Mask `ai.embed.api_key` when displaying resource properties. - Keep other AI functions using the general `ai.*` properties. ```text Doris> CREATE RESOURCE 'default_combine_resource' -> PROPERTIES ( -> 'type' = 'ai', -> -> 'ai.provider_type' = 'QWEN', -> 'ai.endpoint' = 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions', -> 'ai.model_name' = 'qwen-plus', -> 'ai.api_key' = '<general-api-key>', -> 'ai.effort' = 'high', -> -> 'ai.embed.provider_type' = 'QWEN', -> 'ai.embed.endpoint' = 'https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings', -> 'ai.embed.model_name' = 'text-embedding-v4', -> 'ai.embed.api_key' = '<embedding-api-key>', -> -> 'ai.embed.mm.provider_type' = 'QWEN', -> 'ai.embed.mm.endpoint' = 'https://dashscope.aliyuncs.com/api/v1/services/embeddings/multimodal-embedding/multimodal-embedding', -> 'ai.embed.mm.model_name' = 'qwen3-vl-embedding', -> 'ai.embed.mm.api_key' = '<multimodal-api-key>', -> -> 'ai.dimensions' = '1024' -> ); Query OK, 0 rows affected (0.026 sec) Doris> set default_ai_resource = 'default_combine_resource'; Query OK, 0 rows affected (0.009 sec) Doris> SELECT array_size(EMBED('this is a test')); +-------------------------------------+ | array_size(EMBED('this is a test')) | +-------------------------------------+ | 1024 | +-------------------------------------+ 1 row in set (1.729 sec) Doris> EXPLAIN SELECT array_size(EMBED('this is a test')); +---------------------------------------------------------------------------+ | Explain String(Nereids Planner) | +---------------------------------------------------------------------------+ | PLAN FRAGMENT 0 | | OUTPUT EXPRS: | | array_size(EMBED('this is a test'))[#0] | | PARTITION: UNPARTITIONED | | | | HAS_COLO_PLAN_NODE: false | | | | VRESULT SINK | | MYSQL_PROTOCOL | | | | 0:VUNION(11) | | constant exprs: | | cardinality(embed('default_combine_resource', 'this is a test')) | | | | | | | | ========== STATISTICS ========== | +---------------------------------------------------------------------------+ 17 rows in set (0.030 sec) Doris> SELECT AI_TRANSLATE('this is a test', 'chinese'); +-------------------------------------------+ | AI_TRANSLATE('this is a test', 'chinese') | +-------------------------------------------+ | 这是一个测试 | +-------------------------------------------+ 1 row in set (1.269 sec) Doris> EXPLAIN SELECT AI_TRANSLATE('this is a test', 'chinese'); +--------------------------------------------------------------------------------+ | Explain String(Nereids Planner) | +--------------------------------------------------------------------------------+ | PLAN FRAGMENT 0 | | OUTPUT EXPRS: | | AI_TRANSLATE('this is a test', 'chinese')[#0] | | PARTITION: UNPARTITIONED | | | | HAS_COLO_PLAN_NODE: false | | | | VRESULT SINK | | MYSQL_PROTOCOL | | | | 0:VUNION(11) | | constant exprs: | | ai_translate('default_combine_resource', 'this is a test', 'chinese') | | | | | | | | ========== STATISTICS ========== | +--------------------------------------------------------------------------------+ 17 rows in set (0.010 sec) Doris> EXPLAIN SELECT EMBED( -> CAST( -> '{"content_type":"image/png","uri":"https://example.com/image.png"}' -> AS JSON -> ) -> ); +--------------------------------------------------------------------------------------------------------------------------------+ | Explain String(Nereids Planner) | +--------------------------------------------------------------------------------------------------------------------------------+ | PLAN FRAGMENT 0 | | OUTPUT EXPRS: | | EMBED( | | CAST( | | '{"content_type":"image/png","uri":"https://example.com/image.png"}' | | AS JSON | | ) | | )[#0] | | PARTITION: UNPARTITIONED | | | | HAS_COLO_PLAN_NODE: false | | | | VRESULT SINK | | MYSQL_PROTOCOL | | | | 0:VUNION(11) | | constant exprs: | | embed('default_combine_resource', CAST('{"content_type":"image/png","uri":"https://example.com/image.png"}' AS json)) | | | | | | | | ========== STATISTICS ========== | +--------------------------------------------------------------------------------------------------------------------------------+ ``` None
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Collaborator
Author
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
|
skip buildall |
yiguolei
approved these changes
Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pick: #67673