Conditional prompting
Using if-then logic in prompts: "If X, do A. Else if Y, do B."
Think of it like
A decision tree: "Is it raining? If yes, wear a jacket. If no, wear sunscreen."
Example
"If the query is about math, solve step-by-step. If it's about creative writing, be imaginative. If it's about safety, refuse."
How it actually works
Conditional prompting can be done at prompt level (instructions) or at orchestration level (router). Models can follow conditional instructions, but orchestration-level routing (classifying input, selecting prompt) is often more reliable.
For product teams
Handles multiple use cases with one system.
For engineers
Implement branching at orchestration layer. Add a classifier to route to appropriate prompt.
Related
- Dynamic prompting — Related to dynamic prompting and routing.
Read anything AI without the jargon
Look up any term in plain English, or save terms as you read with the free Chrome extension.
Open DecoderAdd to Chrome