Nodes/IF_LLM/IF Save Text📝
ComfyUI Node

IF Save Text📝

Log Every LLM Turn to CSV, JSON, or Plain Text

By if-ai·Created 2 years ago·Updated about a year ago· 157
IF Save Text📝
    • Question
    • Response
    • Negative
    • Turn
    question_input
    response_input
    negative_input
    save_filefalse
    file_format
    save_mode

    If you're running an LLM node in a loop - say, generating a batch of prompts for image generation - you quickly lose track of what question produced what answer. IF_LLM_SaveText is the pack's answer: it captures a full turn (question, response, negative prompt) and, when you ask it to, writes that turn to disk as CSV, TXT, or JSON.

    This is the node you want when you're building a dataset or auditing your prompt pipeline. A run produces dozens of LLM responses; without a log you have no way to trace "that weird prompt came from that weird input."

    How it works

    Three required inputs, all wired in: question_input, response_input, and negative_input - the natural match for the main IF_LLM node's question, response, and negative outputs. Every run, the node bundles them into a turn and stamps it with a fresh UUID.

    The save_file boolean controls whether anything touches disk. If it's off, the node just echoes its inputs back. Turn it on and file_format (csv, txt, or json) plus save_mode (create, overwrite, or append) decide how. create makes a new file, overwrite clobbers, append keeps growing it - which is what you want for a running log.

    Outputs are the four things you'd expect: Question, Response, and Negative passed through unchanged, plus Turn - a formatted string with the ID and all three fields, handy for a display node.

    Files land in custom_nodes/ComfyUI-IF_LLM/IF_AI/saved_outputs/, named output.csv / output.txt / output.json depending on the format you chose.

    Installing it

    Same pack, one install. ComfyUI Manager (search "IF_LLM") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/if-ai/ComfyUI-IF_LLM
    

    then restart. The README's standing warnings apply: conflicts with IF_AI_tools (uninstall it first), and the dependency list is substantial.

    Troubleshooting

    • The file isn't where you expect - it writes under the ComfyUI install's custom_nodes folder, not your working directory. If you're running a portable install, that's ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_LLM\IF_AI\saved_outputs\.
    • Nothing is saved even though save_file is on - check save_mode. If you picked create and output.csv already exists from an earlier run, the behavior you actually want is probably append or overwrite.
    • JSON mode looks odd on append - the JSON append path rewrites the file into a list. If you're mostly appending, CSV or TXT is the more forgiving format.

    The one design quirk worth knowing: negative_input is required, so if your LLM pipeline never produces a negative prompt, wire in an empty string and move on. A small thing to remember, but it'll save you a confused "why won't this node run" moment.

    CategoryImpactFrames💥🎞️/IF_LLM

    Inputs (6)

    NameTypeDefaultDescription
    question_inputSTRING
    response_inputSTRING
    negative_inputSTRING
    save_fileoptBOOLEANfalse
    file_formatoptCOMBO3 options: csv, txt, json
    save_modeoptCOMBO3 options: create, overwrite, append

    Outputs (4)

    NameTypeDescription
    QuestionSTRING
    ResponseSTRING
    NegativeSTRING
    TurnSTRING