ClickAI Docs
ClickAI Docs En
ClickAI Docs En
  • Welcome
  • GETTING STARTED
    • Sign up
    • Personal Setting
  • FUNCTION
    • AI Assistant
    • Creative
    • Community
      • Community User Guide
        • Post
        • Course
        • Event
        • Member
          • Leaderboard
        • Comunity Description
        • AI Avatar
      • Create Community
        • Create About Page
        • Create Course
        • Create Leaderboard
        • Create Bot Store
    • Academy
    • Studio
      • Create Chatbot
      • Create ChatFlow
        • Key Concepts
        • Variables
        • Node Description
          • Start
          • Trả Lời Trực Tiếp
          • Large Language Model (LLM)
          • Knowledge Retrieval
          • Question Classifier
          • Conditional Branch IF/ELSE
          • Code Execution
          • Template
          • Doc Extractor
          • List Operator
          • Variable Aggregator
          • Variable Assigner
          • Iteration
          • Parameter Extraction
          • HTTP Request
          • Tools
        • Shortcut Key
        • Orchestrate Node
        • File Upload
        • Additional Features
        • Debug and Preview
          • Preview and Run
          • Step Run
          • Conversation/Run Logs
          • Checklist
          • Run History
        • Application Publishing
      • Create Agent
      • Create Workflow
  • PAYMENT
    • Subscription Plans
    • Upgrade
    • Community subscription
    • Course subscription
  • POLICIES
    • Privacy Policy
    • ClickAI Community Guidelines
    • Affiliates Policy
Powered by GitBook
On this page
  1. FUNCTION
  2. Studio
  3. Create ChatFlow
  4. Node Description

Template

PreviousCode ExecutionNextDoc Extractor

Last updated 5 months ago

Template lets you dynamically format and combine variables from previous nodes into a single text-based output using Jinja2, a powerful templating syntax for Python. It's useful for combining data from multiple sources into a specific structure required by subsequent nodes. The simple example below shows how to assemble an article by piecing together various previous outputs:

Beyond naive use cases, you can create more complex templates as per Jinja's for a variety of tasks. Here's one template that structures retrieved chunks and their relevant metadata from a knowledge retrieval node into a formatted markdown:

Copy

{% for item in chunks %}
### Chunk {{ loop.index }}. 
### Similarity: {{ item.metadata.score | default('N/A') }}

#### {{ item.title }}

##### Content
{{ item.content | replace('\n', '\n\n') }}

---
{% endfor %}

This template node can then be used within a Chatflow to return intermediate outputs to the end user, before a LLM response is initiated.

The Answer node in a Chatflow is non-terminal. It can be inserted anywhere to output responses at multiple points within the flow.

documentation