Nodes/ComfyUI-llama-multimodal/Ollama Options (images)
ComfyUI Node

Ollama Options (images)

Ollama options without the guesswork — disabled means omitted

By craftingmod·Created 3 months ago·Updated 18 days ago· 3
Ollama Options (images)
    • options
    • options_json
    ◄use_num_ctxfalse►
    ◄num_ctx2048►
    ◄use_num_predictfalse►
    ◄num_predict-1►
    ◄use_temperaturefalse►
    ◄temperature0.80►
    ◄use_top_pfalse►
    ◄top_p0.90►
    ◄use_top_kfalse►
    ◄top_k40►
    ◄use_min_pfalse►
    ◄min_p0.00►
    ◄use_repeat_penaltyfalse►
    ◄repeat_penalty1.10►
    ◄use_repeat_last_nfalse►
    ◄repeat_last_n64►
    ◄use_seedfalse►
    ◄seed0►
    ◄use_stopfalse►
    ◄stop►
    ◄use_draft_num_predictfalse►
    ◄draft_num_predict4►

    Every Ollama options object is a dictionary of tuning parameters, and the fiddly part is that a parameter you leave at its default still gets sent - which can silently override whatever sensible default your model actually ships with. The Ollama Image List Options node fixes that the blunt way: each parameter has an Include/Ignore toggle in front of its value widget, and disabled parameters are simply omitted from the request. Nothing is sent with a displayed default you didn't ask for. That's more disciplined than the raw API.

    The node is a long grid of toggle-plus-value pairs, ordered exactly as num_ctx, num_predict, temperature, top_p, top_k, min_p, repeat_penalty, repeat_last_n, seed, stop, and draft_num_predict. Each use_* boolean controls whether that parameter lands in the output dictionary. The defaults are Ollama's documented ones - num_ctx 2048, temperature 0.8, top_p 0.9, repeat_penalty 1.1, repeat_last_n 64 - so the widget values are honest references rather than arbitrary starts.

    Two parameters deserve a closer look because they're easy to misuse. num_predict is capped at -1, which in Ollama means unlimited generation - set it with intent, or a long prompt plus an image can turn into a very long wait. And stop is a single string here, but the Ollama API wants an array; the node handles the conversion for you, encoding your one string into the required one-item array in both outputs.

    There are two outputs, and they serve different masters. options is a typed DICT you connect straight into the Generate node's options input - that's the normal path. options_json is the same content as a JSON string, for debugging, manual inspection, or feeding a string-based utility node. If you're ever confused about what actually went over the wire, look at options_json and it'll be obvious which toggles you left on.

    The one precedence rule matters more than it looks: in Generate, a connected options dictionary always wins over a hand-written options_json, including an empty dictionary. So if you connect this node and see output that ignores your options_json text elsewhere in the workflow, that's the design, not a bug - disconnect the DICT to fall back to the manual JSON.

    Wiring it up:

    # install the pack (or use Manager → search "Ollama Image List")
    cd ComfyUI/custom_nodes
    git clone https://github.com/craftingmod/ComfyUI-Ollama-ImageList
    

    Then restart ComfyUI, drop Options before Generate, and flip on only what you want to tune. My usual starting set is temperature, top_p, num_ctx (vision models want more than 2048 context), and seed when I want reproducibility.

    A genuinely thin node, this one - there's no hidden complexity. But the "disabled means omitted" philosophy is the reason it exists and the thing to remember: when you're chasing a weird response, first check which toggles you accidentally left on, because the value sitting in the widget is not the value being sent unless its toggle is on.

    CategoryOllama/images

    Inputs (22)

    NameTypeDefaultDescription
    use_num_ctxBOOLEANfalseInclude num_ctx in the generated Ollama options object.
    num_ctxINT20481–2147483647Context window size in tokens. Ollama documented default: 2048.
    use_num_predictBOOLEANfalseInclude num_predict in the generated Ollama options object.
    num_predictINT-1-1–2147483647Maximum generated tokens. -1 means unlimited generation.
    use_temperatureBOOLEANfalseInclude temperature in the generated Ollama options object.
    temperatureFLOAT0.800–10Sampling temperature. Ollama documented default: 0.8.
    use_top_pBOOLEANfalseInclude top_p in the generated Ollama options object.
    top_pFLOAT0.900–1Nucleus sampling probability. Ollama documented default: 0.9.
    use_top_kBOOLEANfalseInclude top_k in the generated Ollama options object.
    top_kINT400–2147483647Number of highest-probability tokens considered during sampling.
    use_min_pBOOLEANfalseInclude min_p in the generated Ollama options object.
    min_pFLOAT0.000–1Minimum token probability relative to the most likely token.
    use_repeat_penaltyBOOLEANfalseInclude repeat_penalty in the generated Ollama options object.
    repeat_penaltyFLOAT1.100–10Penalty applied to repeated tokens. Ollama documented default: 1.1.
    use_repeat_last_nBOOLEANfalseInclude repeat_last_n in the generated Ollama options object.
    repeat_last_nINT64-1–2147483647Lookback for repetition penalties. 0 disables; -1 uses num_ctx.
    use_seedBOOLEANfalseInclude seed in the generated Ollama options object.
    seedINT00–2147483647Random seed. A fixed value makes identical prompts reproducible.
    use_stopBOOLEANfalseInclude stop in the generated Ollama options object.
    stopSTRINGSingle stop sequence. The JSON output converts this string to the array required by the Ollama API.
    use_draft_num_predictBOOLEANfalseInclude draft_num_predict in the generated Ollama options object.
    draft_num_predictINT40–2147483647Maximum speculative draft tokens per step. 0 disables speculative drafting.

    Outputs (2)

    NameTypeDescription
    optionsDICT—
    options_jsonSTRING—