DaSiWa Wildcard & Preset Prompt Builder:
This node builds positive and negative image-generation prompts from a bundled library of wildcard and preset entries. You can choose which entries participate and assign weights to emphasize them. It supports both tag-oriented and natural-language wording, resolves choices within wildcard patterns, and combines generated text with prompt text you provide. Its budgeting step can remove lower-priority generated groups when they exceed the chosen limit, helping you assemble varied prompts while retaining control over their content.
DaSiWa Wildcard & Preset Prompt Builder Input Parameters:
style
Chooses how the node reads entries from the bundled library. Options are Booru and Natural Language; the default is Booru. Booru uses the library’s tag-oriented entries, while Natural Language uses its prose-oriented entries. Changing this setting can change the generated wording, but it does not rewrite text you provide through the optional prompt connections.
seed
Controls repeatable choices for wildcard alternatives and prompt variables. It is an integer from 0 to 4294967295, with a default of 0. Keeping the same seed and other relevant settings produces the same choices when auto_reroll is off. Changing the seed can change both generated wildcard choices and unpinned variable choices.
token_budget
Sets the maximum counted tokens for the generated positive prompt and, separately, the generated negative prompt before connected prompt text is added. It is an integer from 1 to 10000, with a default of 200. If generated groups exceed the budget, the node removes whole groups, starting with the lowest-weight group; among equal weights, later groups are removed first. The count uses the node’s own word-and-punctuation counting method, so it may differ from the token count reported by an image model. Connected prompt text is not constrained by this budget.
selection_state
Stores which library wildcard and preset groups are enabled and their weights. It is a multiline string with a default of {}; the interface specifies no minimum or maximum length. An empty state enables no groups, so the node generates no library text unless selections have been saved here. This state is normally maintained with the node’s library-selection controls. An invalid JSON value is treated as an empty state rather than producing a parsing error.
reroll
Changes the selected alternatives inside enabled wildcard patterns without requiring you to change seed. It is an integer from 0 to 2147483647, with a default of 0. With auto_reroll off, the same seed, reroll value, and selections give repeatable generated choices. This setting does not change selections for variables in connected prompt text.
auto_reroll
Determines whether the node chooses a fresh reroll value on each execution. Options are Off and On; the default is Off. When On, generated wildcard alternatives can change between executions even when the visible seed and reroll setting stay the same. Prompt-variable choices remain tied to the fixed seed, unless you pin them separately.
positive_input
An optional connected string containing positive prompt text to place before generated positive library entries. It has no interface default or stated length range and must be supplied through a connection. Any recognized prompt variables in this text are resolved first; when both supplied and generated text are present, the node joins them with a comma and space. This text remains in the result even if the generated entries are removed to meet token_budget.
negative_input
An optional connected string containing negative prompt text to place before generated entries from library categories whose names contain “negative prompt.” It has no interface default or stated length range and must be supplied through a connection. Recognized prompt variables are resolved before the text is combined with generated negative entries. Like positive_input, this connected text is not subject to the generated-text budget.
variables_json
Defines the choices available to variables written in connected prompt text. It is an optional JSON string with a default of {}; the interface specifies no minimum or maximum, but the implementation rejects a string longer than 1000000 characters. Use a JSON object whose names contain letters, digits, or underscores and begin with a letter or underscore; each name must have a non-empty list of non-blank strings. For example, {"color":["red","blue"]} lets you place $color or ${color} in connected prompt text. Without a matching library entry, a variable token remains unchanged.
variable_selections
Optionally pins individual occurrences of prompt variables to specific choices. It is a JSON string with a default of {}; the interface specifies no minimum or maximum, but the implementation rejects a string longer than 256000 characters. Keys use a variable name and a zero-based occurrence number, such as {"color:0":"red"} for the first recognized $color occurrence. A pinned value takes effect only if it exactly matches one of that variable’s choices; otherwise, the node chooses from the list using seed. Each recognized occurrence is counted independently, while $$ becomes a literal dollar sign.
DaSiWa Wildcard & Preset Prompt Builder Output Parameters:
positive_prompt
A string containing the final positive prompt. It begins with resolved positive_input text, when supplied, followed by enabled positive library entries that remain after budgeting. Selected entries are separated by commas; a group with a weight other than 1 is written in the form (text:weight). The string can be empty when there is no connected positive text and no enabled positive group contributes content.
negative_prompt
A string containing the final negative prompt. It begins with resolved negative_input text, when supplied, followed by enabled entries from library categories identified as negative-prompt categories that remain after their separate budgeting step. It uses the same comma joining and weight notation as positive_prompt. The string can be empty when neither connected negative text nor an enabled negative group contributes content.
DaSiWa Wildcard & Preset Prompt Builder Usage Tips:
- Start by enabling the library groups you need. The default
selection_stateof{}selects nothing, so an empty generated prompt does not necessarily mean the node failed. - Choose
Boorufor the library’s tag-oriented wording orNatural Languagefor its prose-oriented wording. Check the resulting prompt after switching, since the two styles draw from different entries. - Keep
auto_rerollOff while refining a composition. Holdseedsteady for repeatable results, and adjustrerollwhen you want to explore different wildcard alternatives without changing prompt-variable picks. - Turn
auto_rerollOn when you want fresh generated wildcard choices on successive executions. Pin important prompt-variable occurrences invariable_selectionsif those words must stay fixed. - Give essential generated groups higher weights when working with a tight
token_budget. The node removes entire lower-weight groups first; it does not shorten individual groups to fit. - Connect essential instructions through
positive_inputornegative_inputif they must remain present regardless of the generated-entry budget. Review the final prompt length separately because connected text is added after that budget is applied.
DaSiWa Wildcard & Preset Prompt Builder Common Errors and Solutions:
Variable library is not valid JSON: …
- Explanation: The text in
variables_jsoncannot be parsed as JSON. The message includes details about where parsing failed. - Solution: Check quotation marks, commas, and brackets. For example, use
{"color":["red","blue"]}, with double quotes around names and text choices.
The variable library must be a JSON object: …
- Explanation:
variables_jsoncontains valid JSON, but its top level is not an object of named variables. - Solution: Use an object such as
{"color":["red","blue"]}rather than a standalone list or string. Use{}when you do not need variables.
Invalid variable name: …
- Explanation: A name in
variables_jsondoes not follow the accepted pattern: it must begin with a letter or underscore and then contain only letters, digits, or underscores. - Solution: Rename entries such as
2colororhair-colorto names such ascolor2orhair_color, and update matching tokens in your connected prompt text.
$name must contain a non-empty list of strings.
- Explanation: A variable’s choices are not a list, the list is empty, or at least one choice is not a non-blank string. The message uses the affected variable’s actual name in place of
name. - Solution: Give that variable at least one text choice, such as
{"color":["red"]}, and remove empty or non-text choices.
Variable library exceeds 1000000 characters.
- Explanation: The
variables_jsonstring is longer than the implementation accepts. - Solution: Remove unused variables or shorten choice text until the JSON string falls within the limit.
Variable selections are not valid JSON: …
- Explanation: The
variable_selectionstext has a JSON syntax error. - Solution: Use an object such as
{"color:0":"red"}, or enter{}to leave every occurrence unpinned.
Variable selections must be a JSON object: …
- Explanation:
variable_selectionsparses successfully, but its top level is not an object. - Solution: Replace the value with an object of occurrence keys and text choices, or use
{}.
Variable selections exceed 256000 characters.
- Explanation: The
variable_selectionsstring exceeds the implementation’s length limit. - Solution: Remove obsolete occurrence pins and keep only the selections you need.
Wildcard library has no valid wildcard_library.categories object.
- Explanation: The bundled library file was read, but it does not contain the category object the node expects.
- Solution: Check that the installed extension includes the intended library data file and that it has not been replaced with incompatible data; restore the supplied file if necessary.
FileNotFoundError or another file-reading error for the bundled library
- Explanation: The node could not read its library file, so it cannot build prompts from library entries. The exact error text depends on the file problem and environment.
- Solution: Check that the extension’s data file is present and readable in the expected installation location, then restore or reinstall the extension files as needed.
No error message, but the generated prompt is empty
- Explanation: The default
selection_stateenables no groups. An invalid selection-state JSON string is also treated as empty, and a very smalltoken_budgetcan remove every generated group. These conditions do not themselves raise an error. - Solution: Enable the intended groups, check that the selection state was saved, and increase
token_budgetif the selected groups do not fit. Connected prompt text, if supplied, should still appear in the corresponding output.
No error message, but a variable remains as $name
- Explanation: An unknown variable token is deliberately left unchanged. Its name may be missing from
variables_jsonor may not match the defined name exactly. - Solution: Add a matching variable with a non-empty choice list, or correct the spelling of the token in the connected prompt text.
