Constrained Prompting
A method of setting limits or rules for the model's answer. This approach lets you control the form, content or structure of the generated answer, making sure it matches specific criteria or formats.
| Advantages | Drawbacks |
|---|---|
| Gives you a high degree of control over the output | Can limit the model's creative potential |
| Useful for tasks that require a specific format or structure | Hard to balance the constraints against answer quality |
| Can improve the accuracy and relevance of answers | Requires you to think the constraints through carefully |
An example of Constrained Prompting:
Write a short description of the benefits of using renewable energy sources. Follow these constraints:
1. The text must consist of exactly three sentences.
2. Every sentence must start with a verb.
3. Use at least two numeric facts.
4. End the text with a call to action.
5. The total length of the text must not exceed 50 words.