Use LLM(使用 LLM)¶
Supported in: Batch, Faster
Call an LLM with a configurable prompt.
Expression categories: String
Declared arguments¶
- Model: The LLM model to use.
Model - Prompt: The user prompt for an LLM model. Media items can also be used as prompts. Images and PDFs are supported. PDFs will be converted to a list of images before being passed to the LLM. If the entire prompt is empty or null, the output will be null. However, if individual columns in the prompt are null, they will be treated as
.
List\> - System prompt: The system prompt to pass to an LLM model. Media references are not supported in the system prompt.
List\> - optional Output mode: Choose to output as a simple output where the output is the type of the output type parameter and errors are returned as null, or output a struct with the output the output type and error as fields.
Enum\ - optional Output type: The output type LLM responses should adhere to.
Type\| Boolean | Date | Decimal | Double | Float | Integer | Long | Short | String | Struct | Timestamp>
Output type: Array\
Examples¶
Example 1: Base case¶
Argument values:
- Model:
gpt4ChatModel(
temperature: 0.0,
) - Prompt:
prompt - System prompt: [In the context of a food delivery app, your job is to rate reviews given in the following user promp...]
- Output mode: null
- Output type: null
| prompt | Output |
|---|---|
| The food was great! | 5 |
Example 2: Base case¶
Argument values:
- Model:
gpt4ChatModel(
temperature: 0.0,
) - Prompt: [
prompt,mediaRef] - System prompt: [You are a highly advanced AI designed to assist healthcare professionals by interpreting medical ima...]
- Output mode: null
- Output type: null
| prompt | mediaRef | Output |
|---|---|---|
| Patient: John Doe, Age: 45, Symptoms: Persistent cough, shortness of breath, and chest pain. Please analyze the attached chest X-ray for any signs of pneumonia or other abnormalities. | {"mimeType":"image/jpeg","reference":{"type":"mediaSetViewItem","mediaSetViewItem":{"mediaSetRid":"r... | Diagnostic Report: Patient: John Doe Age: 45 Symptoms: Persistent cough, shortness of b... |
Example 3: Null case¶
Argument values:
- Model:
gpt4ChatModel(
temperature: 0.0,
) - Prompt:
prompt - System prompt: null
- Output mode: null
- Output type: null
| prompt | Output |
|---|---|
| null | null |
Example 4: Null case¶
Description: Only MediaSet Reference, without a prompt, should have a null output.
Argument values:
- Model:
gpt4ChatModel(
temperature: 0.0,
) - Prompt:
mediaRef - System prompt: null
- Output mode: null
- Output type: null
| mediaRef | Output |
|---|---|
| {"mimeType":"image/jpeg","reference":{"type":"mediaSetViewItem","mediaSetViewItem":{"mediaSetRid":"r... | null |
Example 5: Edge case¶
Description: Empty input string should have a null output.
Argument values:
- Model:
gpt4ChatModel(
temperature: 0.0,
) - Prompt:
prompt - System prompt: null
- Output mode: null
- Output type: null
| prompt | Output |
|---|---|
| empty string | null |
Example 6: Edge case¶
Description: Input prompt surpassing model limits should have a null output.
Argument values:
- Model:
gpt4ChatModel(
temperature: 0.0,
) - Prompt:
prompt - System prompt: null
- Output mode: null
- Output type:
WITH_ERRORS
| prompt | Output |
|---|---|
| What is the capital of France? | { error: null, ok: Paris, } |
| a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ... | { error: Context limit exceeded., ok: null, } |
Example 7: Edge case¶
Description: Input prompt surpassing model limits should have a null output.
Argument values:
- Model:
gpt4ChatModel(
temperature: 0.0,
) - Prompt:
prompt - System prompt: null
- Output mode: null
- Output type: null
| prompt | Output |
|---|---|
| a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ... | null |
中文翻译¶
使用 LLM¶
支持模式:批处理(Batch)、快速(Faster)
通过可配置的提示词(prompt)调用大语言模型(LLM)。
表达式类别: 字符串(String)
声明参数¶
- 模型(Model): 要使用的 LLM 模型。
Model - 提示词(Prompt): 提供给 LLM 模型的用户提示词。媒体项也可用作提示词。支持图片和 PDF 文件。PDF 文件在传递给 LLM 前会转换为图片列表。如果整个提示词为空或 null,输出将为 null。但如果提示词中的单个列为 null,它们将被视为
。
List\> - 系统提示词(System prompt): 传递给 LLM 模型的系统提示词。系统提示词中不支持媒体引用。
List\> - 可选 输出模式(Output mode): 选择以简单输出方式输出(输出类型为输出类型参数指定的类型,错误返回 null),或以结构体方式输出(包含输出类型和错误字段)。
Enum\ - 可选 输出类型(Output type): LLM 响应应遵循的输出类型。
Type\| Boolean | Date | Decimal | Double | Float | Integer | Long | Short | String | Struct | Timestamp>
输出类型: Array\
示例¶
示例 1:基本用例¶
参数值:
- 模型:
gpt4ChatModel(
temperature: 0.0,
) - 提示词:
prompt - 系统提示词: [在食品配送应用的上下文中,你的任务是对以下用户提示词中的评论进行评分...]
- 输出模式: null
- 输出类型: null
| prompt | 输出 |
|---|---|
| 食物太棒了! | 5 |
示例 2:基本用例¶
参数值:
- 模型:
gpt4ChatModel(
temperature: 0.0,
) - 提示词: [
prompt,mediaRef] - 系统提示词: [你是一个高度先进的人工智能,专门协助医疗专业人员解读医学影像...]
- 输出模式: null
- 输出类型: null
| prompt | mediaRef | 输出 |
|---|---|---|
| 患者:张三,年龄:45岁,症状:持续咳嗽、气短、胸痛。请分析所附胸部X光片,检查是否有肺炎或其他异常迹象。 | {"mimeType":"image/jpeg","reference":{"type":"mediaSetViewItem","mediaSetViewItem":{"mediaSetRid":"r... | 诊断报告: 患者:张三 年龄:45岁 症状:持续咳嗽、气短、胸痛... |
示例 3:空值用例¶
参数值:
- 模型:
gpt4ChatModel(
temperature: 0.0,
) - 提示词:
prompt - 系统提示词: null
- 输出模式: null
- 输出类型: null
| prompt | 输出 |
|---|---|
| null | null |
示例 4:空值用例¶
描述: 仅有媒体集引用(MediaSet Reference)而无提示词时,输出应为 null。
参数值:
- 模型:
gpt4ChatModel(
temperature: 0.0,
) - 提示词:
mediaRef - 系统提示词: null
- 输出模式: null
- 输出类型: null
| mediaRef | 输出 |
|---|---|
| {"mimeType":"image/jpeg","reference":{"type":"mediaSetViewItem","mediaSetViewItem":{"mediaSetRid":"r... | null |
示例 5:边界用例¶
描述: 空输入字符串应输出 null。
参数值:
- 模型:
gpt4ChatModel(
temperature: 0.0,
) - 提示词:
prompt - 系统提示词: null
- 输出模式: null
- 输出类型: null
| prompt | 输出 |
|---|---|
| 空字符串 | null |
示例 6:边界用例¶
描述: 输入提示词超出模型限制时,应输出 null。
参数值:
- 模型:
gpt4ChatModel(
temperature: 0.0,
) - 提示词:
prompt - 系统提示词: null
- 输出模式: null
- 输出类型:
WITH_ERRORS
| prompt | 输出 |
|---|---|
| 法国的首都是哪里? | { error: null, ok: 巴黎, } |
| a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ... | { error: 上下文长度超出限制。, ok: null, } |
示例 7:边界用例¶
描述: 输入提示词超出模型限制时,应输出 null。
参数值:
- 模型:
gpt4ChatModel(
temperature: 0.0,
) - 提示词:
prompt - 系统提示词: null
- 输出模式: null
- 输出类型: null
| prompt | 输出 |
|---|---|
| a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ... | null |