Prompt Generator (Dictionary)
Random Prompts From Your Own Dictionary Files
- STRING
Random prompt assembly is one of those ideas that looks trivial until you need it. Batch a character sheet across 32 generations, shuffle lighting and camera styles between runs, or just stop typing "masterpiece, best quality" by hand. The Prompt Generator (Dictionary) node (class IntegratedRandomPromptGenerator) does exactly the wildcard thing without any wildcard syntax to learn: you drop .txt dictionary files in a folder, and it picks one random item from each enabled file and joins them into a prompt string.
How it works
The node scans ComfyUI/input/Dictionaries - note input, not custom_nodes - recursively at load time and lists every .txt file it finds in the dropdowns. Each file is a bag of prompt fragments separated by a delimiter, ; by default. For every dictionary you enable, it picks one random item and joins the winners with the output delimiter (default , ). The pack ships a sample file with 1,000 prebuilt prompts if you want to see the intended format.
There's a real seed input, and it's honest about it: random.seed(seed) runs before the picks, so the same seed, dictionaries, and delimiters give the same combination every time. That's the difference between "random generator" and "I can't reproduce anything" - set a seed you like and keep it.
The inputs that matter
You get up to four dictionary slots, and the only ones you'll actually touch most days:
dict1_file..dict4_file- the dropdowns, populated frominput/Dictionaries(subfolders appear asfolder/file.txt). Set a slot tononeto ignore it.enable_dict1..enable_dict4- handy when you want to keep a file loaded but switch it off without re-selecting.dict1_delimiter..dict4_delimiter- per-file item separators,;by default. This is where people get burned (below).output_delimiter- what goes between the selected items;,keeps prompt fragments readable.seed- the reproducibility knob.
Output is a single STRING - the joined prompt - which you wire straight into a CLIP Text Encode positive input.
Installing it
It ships in the Switchblade Pack, so install the pack once and you get this plus the other nodes:
- ComfyUI Manager → search MilitantHitchhiker-SwitchbladePack (or "Switchblade") → Install → restart. Or clone manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MilitantHitchhiker/MilitantHitchhiker-SwitchbladePack
Restart ComfyUI. No models to download, no Python dependencies - this node is pure standard-library.
Where people get burned
The delimiter mismatch is the classic failure. If your file is separated by commas but the node splits on ;, you get one giant "item" and the node just picks the whole file. Match the delimiter to what's actually in your file, or reformat the file to use ;.
The other trap is placement: the dropdown list builds from ComfyUI/input/Dictionaries at node-creation time. Drop in a new .txt file and you won't see it until you refresh the node list or restart - don't go hunting for a typo in your workflow when the file simply isn't registered yet. And remember every enabled dictionary contributes an item, so a file that fails to load silently contributes nothing: your "random" prompt can quietly stop varying.
One honest caveat for a node called a "prompt generator": it only picks and joins. There's no weighting, no __ wildcard syntax, no conditioning logic. If you want per-item weights and dynamic interpolation, the dedicated wildcard/dynamic-prompt packs do more - but for "give me a different prompt each run from my own files," this is about as simple as it gets.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| dict1_file | COMBO | 1 options: none | |
| dict2_file | COMBO | 1 options: none | |
| dict3_file | COMBO | 1 options: none | |
| dict4_file | COMBO | 1 options: none | |
| enable_dict1 | BOOLEAN | true | — |
| enable_dict2 | BOOLEAN | true | — |
| enable_dict3 | BOOLEAN | true | — |
| enable_dict4 | BOOLEAN | true | — |
| dict1_delimiter | STRING | ; | — |
| dict2_delimiter | STRING | ; | — |
| dict3_delimiter | STRING | ; | — |
| dict4_delimiter | STRING | ; | — |
| output_delimiter | STRING | , | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |