Decision Tree Prompt Builder

Build a conditional decision-tree prompt for multi-branch LLM behavior

Ad placeholder (leaderboard)

Decision tree prompt builder

When an assistant needs to behave differently depending on what the user asks, leaving the logic implicit invites inconsistency. This tool builds a prompt with explicit if / else-if / else branching so the model first classifies the input and then follows the matching path — with a defined fallback for anything that does not fit. You assemble the branches visually; the prompt is generated locally in your browser.

How it works

You optionally name the assistant role for context, then add branches: each is a condition (“the input is a refund request”) and the action to take (“collect the order number, apologize, route to billing”). You can add, remove, and order branches, and set a fallback for unmatched input. The builder renders these as a top-to-bottom if/else-if/else chain and appends rules: evaluate in order and take the first match, never blend two branches, and use the fallback when nothing fits.

Tips and notes

Order your branches from most specific to most general — like a real if/else-if chain, the first match wins, so a broad condition placed early can shadow a narrow one below it. Keep each action concrete and self-contained; “route to billing” is clearer than “handle appropriately.” The default fallback asks a clarifying question instead of guessing, which is almost always the safer behavior for a routing assistant. Once deployed, test each branch with a representative input to confirm the model classifies it as you intended, and adjust the condition wording if any case lands on the wrong path.

Ad placeholder (rectangle)