Attribute to Text
The node that turns your LLM's structured answers back into an actual prompt
- attributes
- text_out
The payoff node
Attribute nodes define the schema, the Structured Output node gets gpt-4o to fill it in - and then what? A bundle of named values sitting in an ATTRIBUTE wire isn't a prompt you can feed a checkpoint. The Attribute to Text node is the step that closes the loop: it takes your format string and slots the values into it, producing the actual text you'll send to a CLIP encoder.
This is where the whole pipeline becomes worth it. Instead of hand-writing "A vector art drawing of a forest, set against a minimalistic light background," you write "A vector art drawing of {foreground}, set against a minimalistic light {background}" once, and the LLM fills the blanks differently on every run. Same workflow, endless variation - which is exactly what LLM-assisted prompting was supposed to get you.
How it works
Nothing fancy, and that's the appeal. It takes the structured values, flattens them into name → value pairs, and runs your template through Python's .format(), replacing every {name} with its value. The mechanism is visible and predictable: whatever the LLM said for foreground is what lands in the text, verbatim.
The inputs and output
- attributes (required) - the
ATTRIBUTEoutput from the Structured Output node. - format_text (required, multiline) - your template, e.g.
The sky is {sky_color}or the multi-line vector-art example above. Reference any attribute name you declared with{braces}.
The output is text_out (STRING), which you wire into the prompt input of a CLIP Text Encode node (the positive one). Because the node is marked as an output node, it also renders its result right in the UI - handy for sanity-checking what the LLM actually produced before you burn a generation on it.
Installing it
It's part of the same pack, so the install is identical to the other two:
cd ComfyUI/custom_nodes
git clone https://github.com/tigeryy2/comfyui-structured-outputs
or install "ComfyUI Structured Outputs" via ComfyUI Manager and restart. A quirk worth knowing: because this node's input is a Structured Output result, using it meaningfully does require the OpenAI key setup described on the Structured Output page - the key isn't for this node, it's for the one feeding it.
Where people get burned
Three small traps, all in the template:
- Names must match exactly.
{foreground}in your format string must match the Attribute node's name. A typo throws aKeyErrorinstead of a helpful message, because.format()can't fill in a placeholder it doesn't have a value for. - Braces are special. This is Python's format syntax, so a literal brace in your prompt needs doubling (
{{and}}). A stray single{will break the whole thing. - Booleans render as
True/False. Youris_coolattribute shows up in the prompt as "True", not "cool" or "yes". For a bool that reads awkwardly mid-sentence, describe it in the Attribute node'sdescriptioninstead ("What the image looks like", not "is it cool") or plan the template around it.
Keep names clean, keep templates simple, and this node is the quietest, most reliable step in the whole pack - the one that never calls out, never spends money, and just formats your prompt the way you asked.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| attributes | ATTRIBUTE | — | |
| format_text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text_out | STRING | — |