Nodes/ComfyUI Griptape Nodes/Griptape Create: Key Value Pair
ComfyUI Node

Griptape Create: Key Value Pair

The Building Block of {{ template }} Replacement

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape Create: Key Value Pair
    • DICT
    key
    value

    Griptape Create: Key Value Pair makes one dictionary entry: a key, a value, bundled into a tiny {key: value} dict. On its own it does almost nothing. But it's the atomic unit behind the pack's template-replacement feature - the thing that turns prompts with {{ placeholders }} into prompts with real text. Almost every agent and task node in ComfyUI-Griptape has a key_value_replacement input, and this is the node that feeds it.

    What it's for

    Griptape prompts support Jinja-style placeholders. Write Describe {{ subject }} in the style of {{ artist }} in an agent's STRING field, and those keys get filled from a context dictionary. The workflow for doing that is:

    1. Create Key Value Pair per variable - one node with key = subject, value = "a black cat", another with key = artist, value = "Van Gogh".
    2. Griptape Combine: Merge Dictionary merges them into one dict.
    3. That dict goes into key_value_replacement on the agent/task node.

    Result: a reusable template prompt where the variables come from nodes - which means they can be driven by other nodes, loaded from files, or changed without touching the prompt text. That's the entire appeal: prompts become templates, data stays data.

    How it works

    It's a two-field form that returns a one-entry dict:

    return ({key: value},)
    

    There's no validation, no type handling, no magic. Empty key? You get {"": "..."}. The value field is multiline, so multi-paragraph values work fine - useful when injecting whole passages into a prompt.

    Inputs and output

    • key (STRING) - the placeholder name, minus the braces. Use the same word you put inside {{ }} in your prompt.
    • value (STRING, multiline) - the text that replaces the placeholder.
    • Output: DICT - a single key-value dict, for Merge Dictionary or straight into any DICT input.

    Installation

    Part of ComfyUI Griptape Nodes:

    • ComfyUI Manager: search "Griptape" → install.
    • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/griptape-ai/ComfyUI-Griptape, restart ComfyUI.

    Pure data node - no API key, no LLM, no network. Installing the pack is the only setup.

    Gotchas

    • The key must match the placeholder exactly (case-sensitive). {{ Subject }} won't be filled by a key of subject. This is the #1 way people think the feature is broken when it isn't.
    • One node = one pair. For several variables you'll want several of these plus a Merge Dictionary - that's the intended pattern, not a workaround.
    • Values are strings. If you want a number or a list injected, you're stringifying it - fine for prompts, wrong for data you need typed.

    Small, boring, and quietly essential. Every "prompt template with variables" workflow in this pack runs on these nodes.

    CategoryGriptape/Text

    Inputs (2)

    NameTypeDefaultDescription
    keyoptSTRING
    valueoptSTRING

    Outputs (1)

    NameTypeDescription
    DICTDICT