Skip to main content

LLM_MASK

Description​

Used to mask sensitive information in text related to specified labels.

Syntax​

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

Parameters​

ParameterDescription
<resource_name>The specified resource name
<text>The text that may contain sensitive information
<labels>Array of labels to be masked, e.g., ARRAY('name', 'phone', 'email')

Return Value​

Returns the text with sensitive information masked. The masked parts are replaced with "[MASKED]".

If any input is NULL, returns NULL.

The result is generated by a large language model, so the output may vary.

Examples​

SET default_llm_resource = 'resource_name';
SELECT LLM_MASK('Wccccat is a 20-year-old Doris community contributor.', ['name', 'age']) AS Result;
+-----------------------------------------------------+
| Result |
+-----------------------------------------------------+
| [MASKED] is a [MASKED] Doris community contributor. |
+-----------------------------------------------------+
SELECT LLM_MASK('resource_name', 'My email is rarity@example.com and my phone is 123-456-7890',
['email', 'phone_num']) AS RESULT;
+-----------------------------------------------+
| RESULT |
+-----------------------------------------------+
| My email is [MASKED] and my phone is [MASKED] |
+-----------------------------------------------+