The Scenario
A global e-commerce platform wants to improve search relevance. When a customer types a conversational query like "find a laptop under $1000 with good battery life", standard keyword search fails. They want an LLM-based query-rewriter to transform the input into: (1) a clean semantic search string, and (2) structured metadata filter parameters (price limit in USD, product category).
The Brief
Develop a prompt template that acts as a middleware query translation step. It must convert user queries into a structured JSON query object containing refined search terms and vector search filter arguments.
Deliverables
- System prompt containing the query rewriting rules, classification hierarchy, and target format instructions.
- JSON payload schema definition mapping incoming queries to vector database filter syntax (e.g., Pinecone/Milvus metadata filter syntax).
- Five diverse user queries (ranging from straightforward to vague/conversational) along with the expected rewritten JSON payloads.
- Performance guidelines explaining how to minimize query translation latency and optimize token usage.
Submission Guidance
Deliver the complete solution in Markdown. Ensure your system prompt is thoroughly documented, and provide the query-to-payload examples in clear JSON blocks.
Submit Your Work
Your submission is graded against the rubric on the right. If you pass, you get a public Badge URL you can share on LinkedIn. There is no draft save, so work offline first and paste your finished response here.