Nodes/ComfyUI-LLMNodes/Caption Select Node
ComfyUI Node

Caption Select Node

Pick one caption from a list, on purpose

By LatentGEN·Created 9 months ago·Updated 9 months ago· 0
Caption Select Node
    • captions
    captions
    seed0

    Caption Select Node is the tiny node you put between a list of captions and whatever wants one of them. Feed it the caption list from the pack's Caption Load Node, give it a number, and it hands back exactly one caption as a plain string.

    The seed input is the whole story - and the name is a bit of a lie. It's not a random seed. It's a plain index into the list. seed = 0 returns the first caption, seed = 4 returns the fifth, and it's fully deterministic: same index, same caption, every single run. That's usually the right behavior, because it means you can iterate over a dataset in a controlled way rather than gambling on which prompt you get. The node does exactly captions[seed] under the hood - there's no RNG anywhere in the file.

    The two inputs that matter

    • captions - the list you got from Caption Load Node (or from the pack's batch captioning nodes, which also emit lists).
    • seed - the index. Keep it inside the list length, or the node raises a hard error with a message like "N captions found. Keep index within list length."

    Output is captions (again, a slightly cheeky name - it's a single string, not the list). Wire it into a CLIP text encoder, a prompt enhancer, or anywhere a single prompt string is wanted.

    How it behaves

    The node caches its state and resets it whenever the incoming list changes, so a different caption set from upstream gets picked up cleanly instead of reusing stale indices. The error-on-out-of-range behavior is worth highlighting because it's unusual: this node would rather crash loudly than silently give you a wrong or empty caption. Annoying when it happens, but it beats quietly generating on a prompt you didn't mean.

    The natural pairing is the pack's own CaptionLoad → CaptionSelect → text encoder, which turns a folder of caption files into a browseable set of prompts for batch generation. If you want random selection - say, for prompt variety - don't reach for this node's seed input expecting randomness; wire a random INT node (or a fixed seed you change between runs) into seed instead. The node itself stays deterministic, which is the point.

    Installing the pack

    ComfyUI Manager: Custom Nodes Manager → search ComfyUI-LLMNodes → install. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/LatentGEN/ComfyUI-LLMNodes
    

    Restart ComfyUI afterward. Pure-Python node, no dependencies, nothing extra to pip install. Same pack-level caveat as the rest: brand-new repo, empty README, no real community footprint behind the author yet - this node is small enough to read in full if you're going to depend on it.

    Troubleshooting

    • "N captions found. Keep index within list length." - your seed is past the end of the list. Lower it or check that Caption Load actually read all your files (remember it dedupes).
    • Same caption every time no matter what you do - you may have the index fixed and a short list, or you're hitting Caption Load's cache. Change the index, and if the list itself is stale, force Caption Load to reload by changing its path.

    It's a one-trick node, but the trick is useful: deterministic, error-checked, single-caption extraction from a list. There's something nice about a node that does exactly what its name says.

    CategoryImage/ Utils

    Inputs (2)

    NameTypeDefaultDescription
    captionsSTRING
    seedINT0

    Outputs (1)

    NameTypeDescription
    captionsSTRING