Back to templates
Query-refinement RAG
RAG workflow with query re-writing and time-weighted ranking.
Dynamiq Team
January 23, 2025
Chat
Search
Operations
Query-refinement RAG
RAG workflow with query re-writing and time-weighted ranking.
Dynamiq Team
January 23, 2025
Chat
Search
Operations
What is query-refinement RAG?
The Query Refinement RAG template combines information retrieval, text generation, and query enhancement to deliver more accurate and contextually relevant responses, even when the original query is imprecise or contains errors.
Key features of query-refinement RAG
- Refines users query for more accurate context retrieval.
- Allows accurate response generation.
- Enables personalized, domain-specific content generation.
Who can benefit from the query-refinement RAG template?
- Improve automated responses in customer services.
- Can assist legal professionals by retrieving relevant precedents, case law, and documents.
- Enrich company chats with access to internal knowledge.
- Quickly gather insights from previous campaigns, blogs, or market data for marketers.
How does the query-refinement RAG template operates?
- Refactor the query into an extended version, correcting errors.
- Convert the query into vector representations (embeddings).
- Use the generated embeddings to search a knowledge base.
- Generates response using gathered information.
Extending/customizing the query-refinement RAG template for Your needs
- Switch to alternative models for embedding or response generation. Use different storage solutions (such as PgVector, Pinecone, Qdrant, Chroma, Milvus).
- Add extra pre-processing steps for query refinement or file preprocessing.
- Any additional infrastructure can be easily built on top, such as integration with APIs and tools.
- Update prompts to ensure the tone and style remain accurate and aligned with your needs.
Performance metrics and monitoring
- Monitor the latency and accuracy of retrieved documents, as well as the tone and correctness of the final response, using both custom and prebuilt metrics.
- Monitor number of tokens and the cost of inference.
How to use the query-refinement RAG template
- Press the “Use Template” button
- Press the “Test” button
- Type your query into the “query” field.
- Press “Run”