Nodes/ComfyUI-llama-multimodal/[llama.cpp] Build Question (Prefill)
ComfyUI Node

[llama.cpp] Build Question (Prefill)

Build a Question Your llama.cpp Decide Node Can Actually Answer

By craftingmod·Created 3 months ago·Updated 18 days ago· 3
[llama.cpp] Build Question (Prefill)
    • question
    ◄question►
    ◄answer—►

    There's no model in this node. It doesn't call anything, doesn't load anything, and takes a fraction of a millisecond. It exists for one reason: the pack's Decide nodes (the multiple-choice ones) refuse to accept a hand-built question, and this is the node that builds one in the shape they want.

    What the Decide nodes actually do

    The llama.cpp side of this pack has two families. The Generate family asks the model to write prose. The Decide family asks it to pick one label - internally the request is constrained to a single answer letter, and the model is told to return exactly one choice label with no explanation. That's how you get a router inside a ComfyUI graph: "which prompt template fits this image", "is this shot a wide or a close-up", "which of these six captions survives".

    To do that, the Decide nodes need two things packaged together: the question text, and the menu of answers. This node is the packaging.

    What you actually wire

    Two inputs, both declared as forced inputs in the ComfyUI API - meaning the graph treats them as sockets, so plan on connecting string sources (a primitive string node works fine) rather than expecting to type into the widgets.

    • question - the ask, multiline. It has to resolve to exactly one string. If you feed it a list of three questions, you get a normalization error, not a guess.
    • answer - a single flat ComfyUI STRING list. This is the menu. Nesting is fatal: a list of lists errors with "answer must be one flat ComfyUI STRING list".

    That flat-list requirement is the thing beginners trip on. Build the menu in a node that emits one flat string list and let this node pass it through.

    The output is a single typed value, question, of type OLLAMA_IMAGE_LIST_LLAMA_CPP_QUESTION. It plugs into Decide, Decide (Prompt Sequential), and Decide (Media Sequential) - those are the only things that accept it.

    The rules it enforces

    This node validates hard on purpose, because a malformed menu would otherwise show up as nonsense probabilities three nodes later:

    • the question must be a non-empty string
    • between 2 and 26 answers - one per letter, A through Z, because the decision backend constrains output to a single label token
    • every answer unique and non-empty

    Break any of those and you get a clear InputNormalizationError at graph start. Annoying for five seconds, much better than silently getting the letter "B" back for a question the model couldn't parse.

    You can't cheat your way around this node either. The Decide nodes re-validate the payload and reject anything that didn't come from here - question must come from a [llama.cpp] Create Question From Input node. A JSON string or a text node wired straight in won't work.

    Installing the pack

    Nothing extra here, but you need the pack itself, and it ships under three names - worth knowing before you conclude it's missing. ComfyUI Manager: search llama multimodal and install ComfyUI-llama-multimodal. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/craftingmod/ComfyUI-llama-multimodal.git
    

    Then restart. The repo was renamed, so you'll also see this listed as ComfyUI-Ollama-ImageList / ollama-image-list - same pack. It requires ComfyUI 0.19.3 or later (the node schemas use the newer comfy_api io module), and if you're on anything older the node simply won't appear in the menu at all.

    To actually run a decision you also need a GGUF model in ComfyUI/models/LLM, plus its mmproj projector file if you want the media in the question. Model loading is the business of Create Native Session, not this node.

    Where it breaks

    Almost always on the menu. Two duplicate answers, an empty string hiding in a list of eight, or 30 options instead of 26 - all hard errors, all with messages that name the problem. And if your answer list comes from a list-producing node, check whether it emits a flat list of strings or a list of lists; that's the one error you'll stare at blankly because the data looks fine in the node's output tooltip.

    Categoryllama_cpp/decision/prefill

    Inputs (2)

    NameTypeDefaultDescription
    questionSTRING—
    answerSTRING—

    Outputs (1)

    NameTypeDescription
    questionOLLAMA_IMAGE_LIST_LLAMA_CPP_QUESTION—