Bernini Prompt Result Parser
The small node that makes your LLM reply usable
- enhanced_prompt
Bernini Prompt Result Parser is the quiet second half of the pack's prompt-enhancement pair, and it's about as simple as a node gets: feed it whatever your external LLM node returned, get back one clean string you can hand to the text encoder. No model, no API call, no weights - it's pure string wrangling, which makes it one of the more reliable nodes in any Bernini workflow.
Why it exists: Bernini, ByteDance's Wan-2.2-based editing and reference-to-video model, wants long, detailed, instruction-style prompts, and the recommended ComfyUI graph runs them through an enhancement LLM first (that's the sibling Bernini Prompt Enhancer's job - it builds the request, this node cleans up the answer). Real LLMs don't reply in tidy plain text. They wrap answers in markdown code fences, or return JSON objects, or throw in a "Sure! Here's your enhanced prompt:" preamble. If you fed that straight into a text encoder you'd be conditioning on the wrapper noise. This node exists to strip it.
How it works
The logic is refreshingly honest (it's about twenty lines): strip surrounding ``` code fences, then if JSON mode is on - or the response simply starts with { - try parsing it as JSON and pull the rewritten_text field (with prompt and text as fallback keys). If the LLM returned nothing at all, it falls back to your original_prompt. Whatever survives comes out the single enhanced_prompt output, ready to wire into your CLIP text encode.
The inputs
- api_response - the raw text from your external LLM node. This is the one you must connect.
- original_prompt - the fallback returned when the LLM comes back empty. Keep your original prompt in here; it's the difference between "slightly worse prompt" and "silent failure" when a provider hiccups.
- json_mode - a string, default
"false". Set it to"true"when your LLM is asked for JSON, and wire it straight from the enhancer'sjson_modeoutput. Handy detail: the parser also accepts truthy strings like"1","yes", or"json", so most "true"-ish inputs just work.
That's the whole list, and there's only the one output, enhanced_prompt. Hook it into the text-encode side of your Wan 2.2 / Bernini workflow.
Install and notes
It ships in the ComfyUI-RH-Bernini pack, so:
cd ComfyUI/custom_nodes
git clone https://github.com/RH-RunningHub/ComfyUI-RH-Bernini
then restart ComfyUI (or grab it via ComfyUI Manager as "ComfyUI-RH-Bernini"). No Python dependencies, no model downloads for this node. One thing worth knowing: the pack uses ComfyUI's newer V3 node API, so a stale ComfyUI install won't load it - update ComfyUI first if the nodes never show up.
Troubleshooting
If enhanced_prompt comes out as your original_prompt, the LLM returned an empty string - check that the LLM node actually executed and that you connected its text output, not its status or token-count output. If it comes out as raw JSON, json_mode wasn't enabled and the JSON parse fallback didn't kick in, usually because the response didn't start with { (some providers prefix JSON with explanatory text - enable strict JSON mode on the LLM side if it has one). And if you're building a non-Bernini workflow, don't skip this node just because it says "Bernini": it's a perfectly good generic LLM-response cleaner for any pipeline that asks an external model to rewrite text.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| api_response | STRING | Raw text returned by the external LLM node. JSON responses are supported when json_mode is true. | |
| original_prompt | STRING | Fallback prompt returned when the external LLM response is empty. | |
| json_mode | STRING | false | Set to true when the external LLM is expected to return a JSON object containing rewritten_text. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| enhanced_prompt | STRING | — |