Nodes/Ollama Prompt Encode/Ollama Prompt Generator
ComfyUI Node

Ollama Prompt Generator

Just the prompt, thanks — Ollama's generator as a plain text node

By ScreamingHawk·Created 2 years ago·Updated 2 years ago· 17
Ollama Prompt Generator
    • prompt
    ollama_urlhttp://localhost:11434
    ollama_modelorca-mini
    seed0
    prepend_tags
    text
    comma_separated_responsetrue

    OllamaPromptGenerator is the other half of the comfyui-ollama-prompt-encode pack, and it's the honest version: no CLIP, no conditioning, no magic. You give it one lazy sentence, it hands you back a STRING prompt written by a local Ollama model, and you decide what to do with it. Same author, same pack, MIT license - think of it as the sibling of Ollama CLIP Prompt Encode with the encoder stripped off.

    Why would you want that? Because generated prompts are genuinely useful in more places than the positive input. Feed the string into a stock CLIP Text Encode (Prompt) and it behaves exactly like the all-in-one node - this is the path if you already have a workflow wired around the default node and want to swap in generated text without touching the graph's shape. Or wire the string to your negative encode, so the LLM tells the model what to push away from while your positive stays hand-written. Or just dump it into rgthree's Display Any and mine it for ideas you'd never have typed. One node, one output, a hundred uses.

    How it works

    Mechanically it's identical to the CLIP node's generator, which the source literally inherits from. Every run it pings your Ollama server at http://localhost:11434, makes sure the model exists (auto-pull on first use), then sends your text to a chat completion with a system prompt and seven canned example pairs so the model knows the shape you want back. Two shapes, actually: comma_separated_response on (the default) pushes for dense, comma-delimited tags - right for Pony and Illustrious-style checkpoints - and off produces long descriptive sentences that Flux-class models understand better. The output gets its periods swapped for commas, and your prepend_tags get stuck on the front, which is how you sneak score_9, score_8_up into a Pony prompt without trusting the LLM to know it.

    The inputs and output

    Everything except clip from the big node:

    • text - your brief. "an astronaut riding a horse, dramatic"
    • ollama_model - defaults to orca-mini; anything you've pulled works, small is faster
    • comma_separated_response - tags vs. sentences; match it to your checkpoint
    • prepend_tags - always prepended to the result, for quality tags or a style seed
    • seed - nonzero = reproducible with temperature pinned to 0; 0 = fresh prompt every run
    • ollama_url - leave it alone unless your Ollama isn't on the default port

    The single output is prompt (STRING), which plugs into any text input in your graph.

    Installing and the gotchas

    Same as the whole pack: install Ollama and have it running, then ComfyUI Manager → search "Ollama Prompt Encode" → Install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ScreamingHawk/comfyui-ollama-prompt-encode
    

    restart, done. One Python dependency (ollama==0.4.2), tested against Ollama 0.4.6.

    And the failure modes you'll actually hit, all grounded in the source: Ollama not running (connection error the moment you queue - start the app or ollama serve); a 60-second hard timeout on every generation, which a slow or cold-starting model will blow past, so keep models small; the first-run pull that downloads your model before generating; and seed 0 meaning random, not deterministic. Also bear in mind the prompt this hands you can be long, and whatever encoder you feed it into will truncate at its own token limit - tag mode keeps things compact, which is one more reason it's the default. It's not a node you'll build a workflow around; it's a node you'll forget you have until writer's block hits, and then it quietly earns its keep.

    CategoryOllama

    Inputs (6)

    NameTypeDefaultDescription
    ollama_urlSTRINGhttp://localhost:11434
    ollama_modelSTRINGorca-mini
    seedINT00–18446744073709550000
    prepend_tagsSTRING
    textSTRING
    comma_separated_responseBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    promptSTRING