Prompt Engineering: Cite Your Sources
A citation is a note that names where a fact came from. An answer with citations can be checked fact by fact.
No citations asked for
The question alone. The answer gives facts with no source.
Can I return the Willow Linen Cushion? I bought the wrong colour. How long does a refund take?Citations asked for
The same question, with the policies in the prompt and a rule to name the source of each fact.
ShopStack returns policy: 30 days, unused items, full refund to the original payment method. ShopStack refunds policy: refunds are processed within 3 to 5 business days after the returned item arrives.
Can I return the Willow Linen Cushion? I bought the wrong colour. How long does a refund take? Name the source of each fact in your answer.Example
ShopStack orders: Order 1044, Priya, Trailhead Canvas Tote plus Ember Pour-Over Set, placed 5 days ago, delivered. ShopStack returns policy: 30 days, unused items, full refund to the original payment method.
I want a refund for order 1044 but I already used the tote. Name the source of each fact in your answer.Key points
- A citation is a note that names where a fact came from.
- An answer with citations can be checked. Each fact is traced back to its source.
- The prompt names the sources. Returns policy. Order list. Product list.
- The model writes the source next to each fact. A fact with no source is a fact to check.
- Citations turn a wrong answer into a fixable one. The wrong fact points at the wrong source.
This example asks for a cited answer about a used item. The return rule needs unused items. The citation shows which fact the answer rests on.
Note
A citation to a source that does not exist is worse than no citation. The source must be real.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
What does a citation let a reader do?