Step 1: Dimension Extract
Turn your prompt stash into structured JSON
- llm_config
- summary
- json_path
Step 1: Dimension Extract is the first tool in ComfyUI-PromptEngine's pipeline for building your own dictionaries. You hand it a plain text file of prompts you've collected, it hands each one to an LLM, and it gets back a structured JSON where every prompt is split across the pack's 21 visual dimensions - subject appearance, outfit, pose, lighting, and so on. That JSON is the raw material for Step 2's clustering and Step 3's dictionary generation.
It exists because hand-organizing a few thousand prompts is misery, and because the pack's whole bet is that your own prompts make a better dictionary than a stock one. The composition nodes (PromptEngineNode, PromptEngineFull) ship with bundled base dictionaries; this toolchain is how you grow them from your own data.
How it works
Read the source and the framing is clear: each line of the input file must be one complete prompt. The node sends it to an OpenAI-compatible chat endpoint with a strict system prompt ("You are a precise T2I prompt analyzer for portrait photography") that demands a fixed JSON shape with one field per dimension, and empty string when a dimension isn't mentioned. Output lands in the plugin's output/step1_json/ as a timestamped JSON file, with a checkpoint every 20 prompts so a crash doesn't lose everything.
The inputs you actually set:
- input_file - path to your
prompts.txt, one full prompt per line. Relative to your ComfyUI working directory. - llm_config - wire the pack's
LLMConfigNodehere to point at your LLM (base URL, key, model, temperature, concurrency). This is the input that matters. - test_mode - processes only the first 10 prompts. Use it on every new dataset; a bad parse pattern costs you far less at 10 lines than at 2,000.
Outputs are summary (a text summary: totals, errors, saved file path) and json_path (the actual file), which is what you'll feed into Step 2.
The critical setup: it needs an LLM
There's no bundled model here. Step 1 is an API call, full stop. The author's own tool header shows the intended setup - a local llama.cpp-style server, e.g. ./llama-server -m ... --host 0.0.0.0 --port 8080 - and if you don't wire an LLMConfigNode, it silently falls back to http://localhost:8080/v1 with model name local-model. That's the number one beginner gotcha: run the node with no LLM configured and you get a wall of connection errors. Either wire LLMConfigNode (works with any OpenAI-compatible endpoint, local or hosted - the README default key is literally not-needed) or point it at whatever local server you actually run.
Gotchas
- Full prompts, not keywords. The README is blunt: the input should be a prompt dataset, not a keyword list or fragments. Sparse prompts give sparse extraction, and downstream clustering and dictionaries get worse in lockstep. Prompts over 3000 characters are silently dropped.
- It costs tokens. Every line is one LLM call. Test mode exists for exactly this reason.
- Output is fixed to
output/step1_json/inside the plugin folder (an olderoutput_subdiroption was removed in v1.2.1).
Install
cd ComfyUI/custom_nodes
git clone https://github.com/jinxishe/ComfyUI-PromptEngine
pip install -r requirements.txt
Restart, then search "ComfyUI-PromptEngine" in ComfyUI Manager if you prefer. Core deps are openai and tqdm; the heavy Step 2 stack (torch, sentence-transformers, hdbscan) isn't needed just to run Step 1.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| input_file | STRING | prompts.txt | — |
| llm_configopt | LLM_CONFIG | — | |
| test_modeopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| summary | STRING | — |
| json_path | STRING | — |