Prepend/Append
The boring string node that keeps LLM prompts in shape
- text
Prepend/Append is the unglamorous utility in the YALLM pack, and it does exactly what it says: take one string, glue some text on the front, glue some on the back, hand the result along. No LLM involved, no API call, no sampling. It's a plain text node that happens to live in the same category as the LLM stuff because that's where it earns its keep.
Why you'd reach for it
LLM workflows are string workflows, and strings are never in the right shape. Your chat completion gives you a prompt, but you need it wrapped in a format the rest of the graph expects. Prepend/Append is for those cases: stick a fixed style prefix like "masterpiece, cinematic lighting," before a generated prompt, or append a negative-prompt reminder, or wrap an LLM-written tag list in brackets. It's also handy when the model emits bare output and you need to bolt on a suffix for a downstream text encoder. Boring, yes. That's the point - it's the kind of node you drop in and never think about again, which is high praise in this ecosystem.
How it works and what's on it
Three inputs, one output, no surprises in the source:
text_input(required) - the string to wrap; this is a forced input, so you can't type into it, it has to come from a wire. Usually that's thecompletionoutput of the pack'sLLM Chatnode or a text generator upstream.prefix(optional) - prepended verbatim. Empty if you leave it alone.suffix(optional) - appended verbatim.- Output:
text, which is literallyprefix + text_input + suffix, in that order.
The execution function is a three-line concatenation. That's the whole mechanism, and there's something to appreciate about a pack that says "I'm an exercise in node building" and still ships a string utility that's this cleanly done.
Installing it
It comes with the rest of ComfyUI-YALLM-node, so the install is the pack install - Manager searching "ComfyUI-YALLM-node", or:
cd ComfyUI/custom_nodes
git clone https://github.com/asaddi/ComfyUI-YALLM-node
cd ComfyUI-YALLM-node
pip install -r requirements.txt
Then restart. Dependencies are just openai and pydantic; this particular node uses neither, so if you only wanted the string wrapping you're still installing the whole pack.
Things to know
Since text_input is force-input, you can't hand-type the base text into the node - if you need a constant string as the middle, feed it from a String node instead. And remember the order of operations if you ever chain two of these: whatever comes out of the second node has the second node's prefix outside the first's. Prefixes nest left-to-right as you wire them, and when your output starts looking like [outer [inner raw]] you'll know you stacked them the wrong way. For a one-liner utility, that's the entire list of footguns.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text_input | STRING | — | |
| prefixopt | STRING | — | |
| suffixopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |