Overview

The Populate Template Block is a powerful tool that combines pre-built templates with AI capabilities to generate comprehensive, context-aware documents. This block takes a template created in our template editor and uses a connected AI model to intelligently fill in the content based on the supplied context and the structure of the document itself.

Inputs

systemPrompt
string

The system prompt to send to the model. This provides high-level instructions or context for the AI model.

context
string
required

The context to support the population of the template. This can include background information, specific requirements, or any other relevant details.

images
image[]

Any images to be used to populate the template. These can be referenced and incorporated into the final document.

Outputs

document
file

The completed template document with all fields populated.

duration
number

The time taken to generate the document in milliseconds.

Editor Settings

templateId
dropdown

The template you wish to populate. Select from available templates in your workspace.

model
dropdown

The AI model to use for generating content. Options are dynamically populated based on available models.

temperature
number
default:0.3

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

maxTokens
number
default:16384

The maximum number of tokens to generate in the chat completion.

Example: Generating a Business Report

  1. Create a template in the template editor with placeholders for your content
  2. Add a Populate Template block to your flow
  3. Select your template from the Templates dropdown
  4. Configure the AI Model and parameters as needed
  5. Connect your context and any images to the corresponding inputs
  6. Run your flow to generate the populated document

Error Handling

The block will retry failed attempts with the following behavior:

  • Maximum retry time of 2 minutes
  • Exponential backoff starting at 500ms up to 5000ms
  • Traces failed attempts for debugging
  • Aborts if the process is cancelled

Common errors include:

  • Missing template provider
  • Missing LLM provider
  • Missing file provider
  • No template ID selected
  • Failed to populate template fields

Always ensure you have the necessary providers configured and a template selected before running the block.

FAQ

See Also