跳到主要内容

LLM_GENERATE

描述

基于输入的提示文本生成响应内容

语法

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

参数

参数说明
<resource_name>指定的资源名称,可空
<prompt>提示文本,用于指导大语言模型生成内容

返回值

返回基于提示生成的文本内容

当输入有值为 NULL 时返回 NULL

结果为大模型生成,所以返回内容并不固定

示例

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 fouding time of Apache Doris? Return only the date.') AS Result;
+--------+
| Result |
+--------+
| 2017 |
+--------+