Skip to content

LLM Node

The LLM node calls a language model to generate text, analyze content, or transform data. It can use upstream variables, chat memory, file variables, and custom messages.

Quick Understanding

The LLM Node takes upstream data, combines it into a prompt, and asks AI for a response. A common pattern is to include the user question, Dataset retrieval results, and system rules in the prompt.

Configurable Fields

FieldDescription
LabelNode name.
ModelModel profile used by the node.
Enable Chat MemoryWhether to include recent conversation memory.
Memory MessagesNumber of recent messages to include when memory is enabled, from 1 to 50.
Context VariableSelects an upstream output as context.
Files VariableSelects a file variable. Defaults to sys.files.
MessagesConfigures system, user, and assistant messages.

LLM node settings panel

Messages

The LLM node includes by default:

  • system message: defines the model role and behavior.
  • user message: references {{#sys.query#}} and {{#sys.files#}} by default.

You can add user or assistant messages and insert upstream variables in the content. If a Context Variable is selected, include {{#context#}} in the prompt; otherwise, the context is not explicitly placed into the model input.

Common Outputs

The LLM node provides these fields to downstream nodes:

FieldDescription
textText generated by the model.
usageToken usage data.
modelModel used by the node.

Recommendations

  • Write stable rules in the system message, such as tone, format, and prohibited actions.
  • Clearly reference {{#sys.query#}} or upstream variables in the user message.
  • To use knowledge retrieval results, first get documents from a Knowledge Retrieval node and set them as the context variable.
  • When chat memory is enabled, too many history messages can increase cost and distract the answer.