Text

Text nodes allow you to write text to send as inputs to other nodes.

Variables

You can define variables in Text nodes using bracket notation: {{ variable }}. Ensure you usre two brackets.

Defining variables will add input handles to your Text node and serve as placeholders for textual information; information from the node that you connect to the handle associated with your Text node's variable will replace whatever {{ variable }} you define in the node's final output.

When to Use Text Nodes

Use a text node when you want to input raw text that does not change between runs into your pipeline.

Some examples or common use cases for Text nodes include:

  1. Composing instructions for the "system" input for LLMs

  2. Composing prompts for the "prompt" input for LLMs

  3. Include a link to a website to be connected to a URL data loader

  4. Include a link to a youtube video to be connected to a youtube data loader

Advanced Templating

Text nodes support more advanced templating using handlebars syntax. To iterate over a series of objects in a template use the following pattern:

In this example the template tells us to iterate over the input documents and store the "title" metadata field in a list.

A common use case is to select certain fields from the documents returned by a vector query node. For example we can query for the "title" metadata of each chunk returned from a wikipedia query.

If we run the pipeline with the query "Napoleon" we can see the list of titles for each returned chunk:

Use the "set" keyword instead of "list" to return unique elements only.

Last updated