LLM Widget:
LLMWidget lets you ask a configured local or remote language model for help while working in ComfyUI. You can use it to explore prompt ideas, discuss a visual concept, or ask about connected visual material. Its main workflow is editor-based: you can request an answer without executing the graph, then make that answer available to other nodes when the graph runs. You can also choose to generate a fresh answer during execution. The node is intended as a tool you call when needed, rather than a step that runs automatically in every queued prompt.
LLM Widget Input Parameters:
system_prompt
A STRING field for instructions that guide how the model should respond, such as the role it should take or the style of answer you want. It is multiline, so you can write more than one sentence. It affects a new generation but does not rewrite an answer already stored in the node. Default: the node’s predefined system prompt; its text is not included in the provided source. Minimum and maximum length: not specified.
generate_on_execute
A BOOLEAN switch that determines what happens when the graph executes. Default: False. Options: False passes the stored answer downstream without making a new model request; True generates a new answer using the current question and configured model, then passes that new reply downstream. With True, the node requires valid model settings and a nonempty question.
answer
A multiline STRING field containing the answer saved in the node. Default: an empty string. When generate_on_execute is False, this field supplies the result: if it contains a conversation log, the node extracts the last model reply rather than passing along the whole log. When execution generates a new answer, the editor is notified so it can update this field; in continue-chat mode, that update contains the conversation log. Minimum and maximum length: not specified.
question
A multiline STRING field for what you want to ask the model. Default: an empty string. It is used when generating an answer, including generation during graph execution. With generate_on_execute set to True, a blank or whitespace-only question causes an error. If execution is only passing through a stored answer, the question does not change that result. Minimum and maximum length: not specified.
image
An optional IMAGE connection for the first visual input. It can be included in a new model request when media reading is enabled in the node’s settings. If you leave it unconnected, it contributes no image content. Default: no connection; numeric minimum and maximum values do not apply.
image2
An optional IMAGE connection for a second visual input. It is identified separately from image when the node prepares media for a new request, which helps distinguish connected images. It contributes no content when unconnected or when media reading is disabled. Default: no connection; numeric minimum and maximum values do not apply.
image3
An optional IMAGE connection for a third visual input. When connected and media reading is enabled, its image content can accompany a newly generated question. It does not alter an answer that is merely being passed through from the answer field. Default: no connection; numeric minimum and maximum values do not apply.
image4
An optional IMAGE connection for a fourth visual input. Use it when your question needs another image considered alongside the other connected images; the node identifies it by its socket number. It is unused if unconnected or if media reading is disabled. Default: no connection; numeric minimum and maximum values do not apply.
image5
An optional IMAGE connection for a fifth visual input. Its content can be prepared for a new model request when the connection is present and media reading is enabled. Connecting it does not, by itself, cause generation during graph execution. Default: no connection; numeric minimum and maximum values do not apply.
image6
An optional IMAGE connection for a sixth visual input. It provides another separately identified image for questions about visual material. It has no effect on pass-through of an already stored answer. Default: no connection; numeric minimum and maximum values do not apply.
image7
An optional IMAGE connection for a seventh visual input. When used in a new request with media reading enabled, it adds visual material for the model to consider. Leave it unconnected when your question does not need it. Default: no connection; numeric minimum and maximum values do not apply.
image8
An optional IMAGE connection for an eighth visual input. It is handled as its own numbered image connection during media preparation for a new request. It is ignored when unconnected or when media reading is disabled. Default: no connection; numeric minimum and maximum values do not apply.
image9
An optional IMAGE connection for a ninth visual input. It lets you supply another image for a newly generated answer without combining it with the other image connections. It does not change a stored answer being passed downstream. Default: no connection; numeric minimum and maximum values do not apply.
image10
An optional IMAGE connection for a tenth visual input and the last image connection listed by this node. Its content can be included when the node generates with media reading enabled. Leave it unconnected if it is not relevant to your question. Default: no connection; numeric minimum and maximum values do not apply.
video
An optional VIDEO connection for asking about a connected clip during a new generation. The node reads frames from the connected video and prepares sampled visual material according to its video-sampling setting; it uses a 24 fps fallback if the clip provides no frame rate, so associated timing may be approximate. It is not read when media reading is disabled and does not affect pass-through of a stored answer. Default: no connection; numeric minimum and maximum values do not apply.
LLM Widget Output Parameters:
text
A STRING containing the answer available to downstream nodes. When generate_on_execute is False, it comes from the stored answer field. If that field holds a marked conversation, text is the final model reply, not the complete exchange; otherwise, it is the stored answer. When generate_on_execute is True, text is the newly generated reply. This makes the output suitable for a downstream node that needs the response itself rather than the chat history.
LLM Widget Usage Tips:
- Keep
generate_on_executeoff when you want to ask questions in the editor and reuse the saved answer in a workflow. Turn it on only when each graph execution should request a fresh reply. - Write a specific
questionthat tells the model what you need, such as a description, comparison, or prompt revision. Usesystem_promptfor instructions you want to apply across questions. - Check the configured model before enabling execution-time generation. The settings require a selected model for the chosen backend; HTTP-based formats also require an API URL, and Gemini requires an API key.
- Enable media reading in the settings when you expect connected images or video to inform a new answer. If the task is text-only, leave unnecessary media connections unused.
- For a conversation that should build on earlier exchanges, enable continue-chat in the settings. The saved answer field can then hold the conversation, while the output still carries only the latest model reply.
- For video questions, choose a video-sampling setting appropriate to the clip and describe the event or detail you want examined. Sampling means the model receives selected visual material, not necessarily every frame.
LLM Widget Common Errors and Solutions:
The answer is empty. Click the run button on the node, or enable generate_on_execute.
- Explanation: Execution was set to pass through the stored answer, but the
answerfield contained no usable text. This is logged as a warning rather than raised as an error. - Solution: Generate an answer from the node in the editor, enter an answer in its field, or turn on
generate_on_executeto request a new one during execution.
Type a question first
- Explanation:
generate_on_executeis on, butquestionis empty or contains only spaces. - Solution: Enter a question before running the graph, or turn off execution-time generation if you intend to use the stored answer.
Unsupported API format
- Explanation: The API format saved in the node’s settings is not one the node recognizes.
- Solution: Open the settings and select a supported format for the model service you intend to use.
Select a GGUF model in the settings
- Explanation: The GGUF backend is selected, but no GGUF model has been chosen.
- Solution: Select a GGUF model in the settings, then try again.
Select a text encoder in the settings
- Explanation: The text-encoder backend is selected, but no encoder model has been chosen.
- Solution: Select a text encoder in the settings, then try again.
The settings are incomplete: API URL, model required
- Explanation: An HTTP-based format needs an API URL and a model name, and both are missing.
- Solution: Enter the endpoint URL and model name in the settings. For an OpenAI-shaped local server, an API key may be left blank if that server does not require one.
The settings are incomplete: API key required
- Explanation: Gemini is selected without an API key. The incomplete-settings message can also name
API URLormodelif those fields are missing. - Solution: Add the missing values shown in the message. For Gemini, supply an API key as well as the required URL and model.
Could not read the connected video
- Explanation: The node logs a warning if it cannot obtain frames or frame-rate information from the connected VIDEO object. The request may then have no usable video frames.
- Solution: Check that the video-producing node provides a valid VIDEO connection and that its clip loads correctly; reconnect or replace the clip before retrying.
The describe pass produced no descriptions; attaching the media to the question instead.
- Explanation: During a GGUF media-description pass, none of the media could be described. The node logs a warning and falls back to attaching the prepared media to the question.
- Solution: Check that the selected GGUF model and connected media work with your setup. If this warning persists, review the GGUF media-description setting and try a supported image or clip.
