LM Studio Sequential Prompt Advanced
LM Studio Sequential Prompt Advanced
- final_response
- previous_conv
- read_conv
Sequential Prompt Advanced is a prompt chain in a box. Instead of asking the LLM one question, you type a list of steps - separated by a delimiter - and the node runs them one at a time, feeding each step's answer into the next. It's the difference between a single chat turn and a real multi-step pipeline: summarize the text, then extract the keywords from your own summary, then turn that into a negative prompt. Each step is a full request to LM Studio, and the model sees its own previous answers by default, so the chain genuinely compounds.
Why you'd reach for it
Any time a single prompt would ask the model to do too much at once. Models follow "do A, then B, then C" instructions more reliably when each stage gets its own turn and its own output. That's exactly the workflow people build with this node: long-text summarization into a constrained format, multi-pass prompt refinement (rough draft → clean up → compress to tag form), or generating a description and then deriving a negative prompt from that same description. The Advanced in the name is the system prompt plus the sampler controls - if you need neither, the plain Sequential Prompt is the lighter twin.
How it works
The prompt_templates field holds all your steps, split by the delimiter string (default ---). Each chunk becomes a user turn. With send_as_chat off (default), every step sends the entire accumulated history - so step 3 sees steps 1 and 2's questions and answers. Flip send_as_chat on and each step is sent alone, making the steps independent and much cheaper. final_response is always the last step's answer, which is what you wire onward.
The Advanced additions: a system prompt (injected as the first system message, so it colors every step), and top_p, top_k, max_tokens on the sampling side. max_tokens defaults to -1, which means "no cap" - set it if a step is prone to rambling. debug prints each step's request and response to the console, which is invaluable when a chain goes sideways halfway through.
The inputs that matter
- prompt_templates - your steps, one per line, split by the delimiter. The default shows the pattern.
- delimiter - make sure this string never appears inside your actual prompts, or your steps will be silently chopped into more steps than you wrote.
- send_as_chat - the big behavioral lever: full context vs. independent steps.
- system - how you keep the model on-task across all steps.
- max_tokens - set it once you've seen a step run long.
The outputs
- final_response - last step's answer. Wire this into your text encoder or wherever the chain's result is needed.
- previous_conv - full thread as JSON, for continuing elsewhere.
- read_conv - the thread formatted for humans, good for a Preview Text node so you can watch the chain.
Installing
Standard for this pack: ComfyUI Manager → search "comfyui-lmstudio", or
cd ComfyUI/custom_nodes
git clone https://github.com/SiegeKeebsOffical/comfyui-lmstudio
restart ComfyUI, load a model in LM Studio, and start its local server on port 1234. No model downloads here; if you see ModuleNotFoundError: No module named 'httpx', pip install httpx and restart.
Where people get burned
The cost sneaks up on you: a five-step chain with full history is five sequential requests, each carrying the whole conversation, so a big model can make one chain take minutes. Keep chains short, or flip send_as_chat on when steps don't need each other. Debug output is your friend when a middle step produces garbage - the classic ComfyUI debugging rule applies: change one thing at a time with a fixed seed, or you can't tell which step broke what.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| url | STRING | http://localhost:1234 | — |
| model | COMBO | 0 options: | |
| system | STRING | You are a helpful assistant. | — |
| prompt_templates | STRING | Step 1: Summarize the following text: 'The quick brown fox jumps over the lazy dog.' --- Step 2: Explain the meaning of 'quick brown fox'. | — |
| delimiter | STRING | --- | — |
| debug | BOOLEAN | false | — |
| seed | INT | 13109819450–2147483648 | — |
| temperature | FLOAT | 0.800–1 | — |
| top_p | FLOAT | 0.900–1 | — |
| top_k | INT | 400–100 | — |
| max_tokens | INT | -1-1–4096 | — |
| send_as_chat | BOOLEAN | false | — |
| filter_thinking | BOOLEAN | true | — |
| previous_convopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| final_response | STRING | — |
| previous_conv | STRING | — |
| read_conv | STRING | — |