Gemini prompt enhance
Gemini Prompt Enhance
- generated_content
Gemini Prompt Enhance is what you reach for when your prompt is doing 20% of the work it could be. You wire in a rough description - maybe the output of a captioner node, maybe just a few words you typed - and it comes back from Gemini with the kind of texture a good prompt engineer would have typed by hand: quality descriptors, a lighting pass, a mood pass, skin detail if there's a person in frame. It's an LLM call embedded directly in your graph, not a static text template.
The mechanism is straightforward once you look at the default prompt field, which is really a system instruction disguised as a text input. It tells Gemini to add quality descriptors ("a high-quality photo, an 8K photo"), lighting description, scene mood, and skin realism if a person is present, then output only the rewritten text - no preamble, no explanation. You can leave that instruction as-is or rewrite it entirely; it's just a multiline string. The actual thing you want enhanced goes in text_input. The author credits this as a fork of ShmuelRonen's ComfyUI-Gemini_Flash_2.0_Exp, with gender-aware rewriting and better failure handling layered on top.
The inputs worth knowing: model defaults to gemini-2.5-flash-lite (fast, cheap) with gemini-2.0-flash and gemini-2.5-flash also selectable. temperature (0–1, default 0.4) and max_output_tokens (up to 8192) are the usual LLM knobs - keep temperature low if you want consistent, predictable rewrites across a batch. gender_prior (blank / M / F) plus gender_alternative let the rewrite adjust how it describes a person's gender, which shows up as a recurring theme across this pack - GenderControlOutput and the README's ModifyTextGender do the same thing at the text level without the LLM call. request_exception_handle is the one to actually think about: bypass (default) quietly swallows a failed API call and lets the graph keep running, raise_exception stops the queue dead, output_exception writes the error into the output string instead of your enhanced prompt. The single output, generated_content, is a plain string - wire it straight into a CLIPTextEncode or wherever your positive prompt normally lands.
Install: search "ComfyUI-utils-nodes" (or "Some Utils for ComfyUI") in ComfyUI Manager, or cd ComfyUI/custom_nodes && git clone https://github.com/zhangp365/ComfyUI-utils-nodes and restart. You need a Gemini API key - free from Google AI Studio (aistudio.google.com), drop it into the api_key input or a gemini_config.json file so you're not pasting it into every workflow you share.
Where this actually bites you:
- Leaving
request_exception_handleonbypassduring setup is the classic trap - a bad key or a network hiccup fails silently, and you won't notice until you're staring at a generation that used your raw, un-enhanced text instead of the rewrite you expected. Flip it toraise_exceptionwhile you're getting the node working, then decide whether you actually want silent failures in production. - Google's content filters are famously aggressive on the image side of its stack, and the text side isn't exempt - if your source caption or your
gender_priorchoice pushes into territory Gemini's safety layer doesn't like, you'll get a refusal or a mangled rewrite back. That's Google's policy, not a bug in the node. - Free-tier Gemini API keys have real rate limits. If you're running this inside a batch queue, expect throttling on anything beyond light, interactive use - there's no built-in retry/backoff beyond the exception-handling mode you pick.
enabled(default true) is the pack's standard bypass toggle. Turn it off and the node presumably skips the API call, which is handy for quickly A/B-testing enhanced vs. raw prompts without rewiring the graph.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | ### Instruction: 1.Edit and enhance the text description of the image. Add quality descriptors, like 'A high-quality photo, an 8K photo.' 2.Add lighting descriptions based on the scene, like 'The lighting is natural and bright, casting soft shadows.' 3.Add scene descriptions according to the context, like 'The overall mood is serene and peaceful.' 4.If a person is in the scene, include a description of the skin, such as 'natural skin tones and ensure the skin appears realistic with clear, fine details.' 5.Only output the result of the text, no others. ### Text: | — |
| text_inputopt | STRING | — | |
| api_keyopt | STRING | — | |
| proxyopt | STRING | — | |
| max_output_tokensopt | INT | 81921–8192 | — |
| temperatureopt | FLOAT | 0.40–1 | — |
| gender_prioropt | COMBO | 3 options: , M, F | |
| gender_alternativeopt | STRING | — | |
| enabledopt | BOOLEAN | true | — |
| request_exception_handleopt | COMBO | bypass | 3 options: bypass, raise_exception, output_exception |
| modelopt | COMBO | gemini-2.5-flash-lite | 3 options: gemini-2.0-flash, gemini-2.5-flash-lite, gemini-2.5-flash |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| generated_content | STRING | — |