In Andrew Ng’s Lesson 1, he shows this prompt:
review_template = """\
For the following text, extract the following information:
gift: Was the item purchased as a gift for someone else? Answer True if yes, False if not or unknown.
delivery_days: How many days did it take for the product to arrive? If this information is not found, output -1.
price_value: Extract any sentences about the value or price, and output them as a comma separated Python list.
Format the output as JSON with the following keys:
gift
delivery_days
price_value
text: {text}
"""
Here the instructions come first, and the actual text goes at the end.
But in some Retrieval-Augmented Generation (RAG) courses I’ve taken, they suggest putting the retrieved text before the instructions, so the model “sees” the content first.
Which order usually works better—context first or instructions first—and why?