Nodes/Chaosaiart-Nodes/🔶 Prompt - Deepseek <think> Fix
ComfyUI Node

🔶 Prompt - Deepseek <think> Fix

Strip the reasoning block before it reaches your prompt

By chaosaiart·Created 2 years ago·Updated about a year ago· 117
🔶 Prompt - Deepseek <think> Fix
    • STRING
    • INFO
    ◄deepseek_str—►

    If you've wired a DeepSeek-R1 (or another reasoning model) node into a ComfyUI graph to write or expand a prompt for you, you've almost certainly hit this: the raw text comes back wrapped in a <think>...</think> block full of the model's internal reasoning, followed by the actual answer you wanted. Feed that straight into a CLIPTextEncode and your "prompt" now includes a paragraph of the model second-guessing itself before it ever gets to describing your image. This node's whole job is stripping that block out so only the real content survives.

    It's a small, single-purpose node, but it's solving a genuinely common annoyance - reasoning models that emit visible chain-of-thought by default trip up anyone piping their output straight into a downstream text field, and people have been solving it ad hoc with regex nodes from other packs before a purpose-built fix existed. If you're already committed to Chaosaiart's node family for your prompt chain, this saves you from bolting on a separate regex/string-replace node just for this one quirk.

    Inputs and outputs

    • deepseek_str - required, multiline STRING. Paste or wire in the raw output from your LLM node, <think> tags and all.
    • Outputs: STRING - the cleaned text with the <think>...</think> block removed, ready to feed into a CLIPTextEncode or one of Chaosaiart's own prompt nodes, and INFO - a STRING, presumably useful for confirming what got stripped, though the node ships without a tooltip explaining its exact contents.

    Installing it

    ComfyUI Manager: Install via Git URL → https://github.com/chaosaiart/Chaosaiart-Nodes - the exact method the README documents. A title search for "Chaosaiart" should also find it.

    Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chaosaiart/Chaosaiart-Nodes
    

    Linux (activate your venv first, if you use one):

    pip install opencv-python
    pip install tqdm
    

    Windows: run the Install_windows script in the cloned folder instead. Restart ComfyUI. This node doesn't need any model downloads itself - it's a text filter, not an LLM. You'll need your own reasoning-model node (a DeepSeek API node, a local llama.cpp bridge, whatever you're using) upstream of it to actually generate the text in the first place.

    Common issues

    The model still shows <think> even after you told it not to. This is a known quirk with reasoning models - asking DeepSeek nicely not to show its reasoning often doesn't work reliably, because the instruction itself gets reasoned about inside the block you're trying to suppress. That's exactly why a dedicated stripping node is the more reliable fix than a system-prompt instruction.

    Only part of the reasoning gets removed. If the model's output has multiple <think> blocks, or an unclosed tag because the response got cut off mid-generation (hit a token limit, for instance), a simple strip can leave stray tags or leftover fragments behind. Check the raw output for exactly one clean <think>...</think> pair before assuming the node is misbehaving - a truncated response is a generation-length problem, not something this node can fix.

    Whole-pack import failures. All Chaosaiart nodes share a single Python module - if opencv-python or tqdm failed to install, the entire pack (this node included) won't appear in ComfyUI. Check the startup console for an import error first.

    Category🔶Chaosaiart/LLM

    Inputs (1)

    NameTypeDefaultDescription
    deepseek_strSTRING—

    Outputs (2)

    NameTypeDescription
    STRINGSTRING—
    INFOSTRING—