All Products
Search
Document Center

ApsaraDB for SelectDB:AI_EXTRACT

Last Updated:Mar 28, 2026

Extracts information corresponding to specific labels from text using a Large Language Model (LLM).

Syntax

AI_EXTRACT([<resource_name>], <text>, <labels>)

Parameters

ParameterDescriptionRequired
<resource_name>The name of the resource. This parameter is optional.No
<text>The text to extract information from.Yes
<labels>An array of labels to extract.Yes

Return value

Returns a string containing all extracted labels and their corresponding values, in the format label="value", label="value".

  • If any input value is NULL, the function returns NULL.

  • Because results are generated by an LLM, the returned content may vary across calls.

Example

SET default_ai_resource = 'resource_name';
SELECT AI_EXTRACT('SelectDB is an MPP-based real-time data warehouse known for its high query speed.',
                  ['product_name', 'architecture', 'key_feature']) AS Result;

Output:

+---------------------------------------------------------------------------------------+
| Result                                                                                |
+---------------------------------------------------------------------------------------+
| product_name="SelectDB", architecture="MPP-based", key_feature="high query speed" |
+---------------------------------------------------------------------------------------+