Nodes/ComfyUI-NS-Util/Simple LLM: Chain of Thought
ComfyUI Node

Simple LLM: Chain of Thought

Chain of Thought here is a prompt factory — it doesn't think, it writes the script

By NakamuraShippo·Created about a year ago·Updated 4 months ago· 5
Simple LLM: Chain of Thought
    • cot_prompt
    problem
    steps3

    Chain-of-thought prompting is the trick where you tell a model to reason step by step instead of blurting an answer, and it reliably improves results on multi-step problems. This node's name makes it sound like the reasoning engine itself. It's not. Simple LLM: Chain of Thought builds the prompt that asks for step-by-step reasoning - the actual thinking happens later, when you feed that prompt into Simple LLM Run: Prompt and pay for an API call.

    That's an important expectation to set, because plenty of people wire this up, run it, and see... a string. No API key needed, no network call, no thinking. Just a well-structured template. Once you know that, it's a handy little tool - it guarantees your model actually gets the "think step by step" instruction plus a scaffold to fill in.

    How it works

    You give it a problem and a steps count (1 to 10). It assembles a prompt that states the problem, announces "Let's think through this in N steps", and lays out numbered step headings with placeholder text like Step 1: [Describe step 1 of your reasoning], ending with a Final Answer: line. Your model then receives that and fills in each step in turn.

    The placeholders matter more than they look: they turn a vague "reason carefully" request into a fill-in-the-blank form, which is the difference between a model that rambles and one that walks the path you drew. You can also edit the output before running it - the node is just a string source, so pipe it through Simple LLM: String Viewer or Merge Text first if you want to add your own step instructions.

    The inputs that matter

    • problem - your question or scenario, multiline. This is the content that matters.
    • steps - integer, 1 to 10, default 3. Three is a good starting point; more steps help on genuinely multi-stage problems and mostly waste tokens on simple ones.

    Output is a single cot_prompt STRING. Wire it into Simple LLM Run: Prompt (with an agent built from any Simple LLM Config node) to actually get the reasoned answer.

    Installing the pack

    # ComfyUI Manager → Install via Git URL:
    https://github.com/NakamuraShippo/ComfyUI-NS-Util
    
    # or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/NakamuraShippo/ComfyUI-NS-Util
    pip install pyyaml watchdog
    

    Restart ComfyUI, and you're done - this node has zero dependencies beyond the pack itself and never touches the network.

    Common issues

    The one real gotcha is expecting output where there is none. If your cot_prompt is empty, check your problem input - that's the only content source. And if the final answers feel wooden, remember the prompt your model sees is the generated template; models love to echo "Step 1: [Describe step 1...]" literally if you leave the bracket text in, so feel free to strip or rewrite those placeholders in a merge node upstream of the run. Like the rest of the SimpleLLM family, this is still in the pack's testing phase, so treat it as a convenience rather than a reasoning guarantee.

    CategoryNS/LLM/Advanced

    Inputs (2)

    NameTypeDefaultDescription
    problemSTRING
    stepsINT31–10

    Outputs (1)

    NameTypeDescription
    cot_promptSTRING