Skip to main content

LLM_GENERATE

Description​

Generates a response based on the input prompt text.

Syntax​

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

Parameters​

ParameterDescription
<resource_name>The specified resource name, optional
<prompt>The prompt text used to guide the LLM 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_llm_resource = 'resource_name';
SELECT LLM_GENERATE('Describe Apache Doris in a few words') AS Result;
+---------------------------------------------------------+
| Result |
+---------------------------------------------------------+
| "Apache Doris is a fast, real-time analytics database." |
+---------------------------------------------------------+
SELECT LLM_GENERATE('resource_name', 'What is the founding time of Apache Doris? Return only the date.') AS Result;
+--------+
| Result |
+--------+
| 2017 |
+--------+