Prompt LibraryEngineering

RAG Query Rewriter & Expansion Prompt

Rewrite a user query for better retrieval.

The prompt

Rewrite the user query below to improve retrieval.
Produce:
1. A cleaned version (fix typos, expand abbreviations).
2. Two sub-queries that cover different facets of the intent.
3. One hypothetical answer (HyDE) the retriever can match against.
4. Any stop-words to remove before embedding.

User query: {{query}}

Replace the {{fields}} with your own context and tighten the rules to match your domain.

Share this prompt