ComfyUI Node

Prompt Enricher

Append Mood Data to a Prompt, Deterministically, With Zero LLM Calls

By andrea-spoldi·Created 4 months ago·Updated 3 months ago· 0
Prompt Enricher
    • enriched_prompt
    prompt
    mood_json
    fields_to_injectcolor_palette lighting_implications texture_implications

    Here's the thing nobody tells you about prompt-engineering LLM nodes: sometimes you don't want the LLM to touch your prompt at all. The main Audio Mood Analyzer already did the creative work - it turned the song into mood_json and then into full image prompts. Prompt Enricher exists for the moments when you want the mood data bolted onto a prompt without another language-model call deciding what's important. It's deterministic, it's instant, and it does exactly one thing.

    This is the node in the pack you'd reach for when you're iterating. You've got a merge_prompt or environment_prompt from the analyzer, you've got the mood_json sitting right there, and you want to force the color palette, lighting, and texture fields into the prompt text so the sampler can't drift away from them. Prompt Enricher takes a base prompt, reads the selected fields out of mood_json, and appends them comma-separated. No Ollama call, no token budget, no hallucination risk - same input, same output, every time.

    Inputs and the one that does the work

    • prompt - the base prompt, typically merge_prompt or environment_prompt from Audio Mood Analyzer. Multiline.
    • mood_json - the JSON string from Audio Mood Analyzer's mood_json output.
    • fields_to_inject - this is the whole node. One field name per line, appended in the order you list them. Default is color_palette, lighting_implications, texture_implications. Want the composition cues instead? Swap the lines. Want everything? List them all.

    The output is enriched_prompt, a single STRING you can wire straight into CLIPTextEncode or a string-concat node.

    Two behaviors worth knowing about, straight from the source:

    • The avoid field gets special treatment. Instead of a plain comma append, it's prefixed as avoid: .... That's a deliberate hint: pipe a prompt enriched with avoid into your negative CLIPTextEncode and you get a mood-aware negative prompt for free. The avoid list from the mood analysis is the node's way of telling you what not to generate.
    • Unknown field names and empty values are silently skipped, and if mood_json is malformed the base prompt passes through unchanged. It never crashes, never throws. You can stick it in a workflow and forget about it.

    Why you'd use it over just pasting

    You could hand-copy the palette into the prompt - you won't, though, because the whole point of ComfyUI is that the graph does the glueing. And you could feed the mood JSON to an LLM and ask it to rewrite the prompt, but that's slow and non-reproducible, and it's exactly the thing this node is the alternative to. When you're batch-generating and want mood data attached with surgical predictability - same fields, same order, same result - Prompt Enricher is the honest tool. It's the "no LLM" companion to this pack's LLM-heavy core, and that role is more useful than it sounds.

    Install

    Same as the rest of the pack. ComfyUI Manager → search AudioMoodAnalyzer, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/andrea-spoldi/ComfyUI-AudioMoodAnalyzer.git
    pip install -r ComfyUI-AudioMoodAnalyzer/requirements.txt
    

    Restart, and it lives under audio/mood. Note that this node itself needs no Ollama and no extra models - only the mood_json you're already producing. The whole pack's install (librosa, soundfile, transformers for CLAP) is what you're pulling in to get to it.

    Categoryaudio/mood

    Inputs (3)

    NameTypeDefaultDescription
    promptSTRING
    mood_jsonSTRING
    fields_to_injectSTRINGcolor_palette lighting_implications texture_implications

    Outputs (1)

    NameTypeDescription
    enriched_promptSTRING