Skip to main content

AI_GENERATE

Description

Generates a response based on the input prompt text.

Syntax

AI_GENERATE([<resource_name>], <prompt>)

Parameters

ParameterDescription
<resource_name>The specified resource name, optional
<prompt>The prompt text used to guide the AI generation

Return Value

Returns the text content generated based on the prompt.

If any input is NULL, returns NULL.

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

Examples

SET default_ai_resource = 'resource_name';
SELECT AI_GENERATE('Describe Apache Doris in a few words') AS Result;
+---------------------------------------------------------+
| Result |
+---------------------------------------------------------+
| "Apache Doris is a fast, real-time analytics database." |
+---------------------------------------------------------+
SELECT AI_GENERATE('resource_name', 'What is the founding time of Apache Doris? Return only the date.') AS Result;
+--------+
| Result |
+--------+
| 2017 |
+--------+