The prompt
{query}
Rephrase and expand the question, and respond. What it is
Adds one line that asks the model to rephrase and expand the question before responding, to help it work out what an ambiguous request means. The docs say this template comes from the paper Rephrase and Respond. The prompt text comes from the Instructor documentation (MIT licence, Copyright (c) 2023 Jason Liu). Only the Python quotes were removed and the backslash-n escape is shown as a line break. The placeholder keeps the source syntax. Original author: Jason Liu and contributors (567-labs/instructor).
Who it's for
- Anyone writing prompts
- Developers
يضيف سطرًا واحدًا يطلب من النموذج إعادة صياغة السؤال وتوسيعه قبل الإجابة، ليفهم المقصود من الطلب الغامض.
Examples
Example from the docs
pythonif __name__ == "__main__":
query = "Take the last letters of the words in 'Edgar Bob' and concatenate them."
response = rephrase_and_respond(query)
print(response.rephrased_question)
"""
What are the last letters of each word in the name 'Edgar Bob', and what do you get when you concatenate them?
"""
print(response.answer)
"""
To find the last letters of each word in the name 'Edgar Bob', we look at 'Edgar' and 'Bob'. The last letter of 'Edgar' is 'r' and the last letter of 'Bob' is 'b'. Concatenating these letters gives us 'rb'.
"""What it does: The usage code and printed output from the Instructor docs. Output as printed in the docs, not re-run by us.
Tips
- The docs say this can also run as two steps: ask the model to rephrase the question, then pass the rephrased question back for the final response.
- The docs pass a Pydantic response model with this prompt, so the printed output follows that schema.