Query Retriever

Finds document sections most relevant to a user query using semantic similarity search. Use when you need to locate specific information within processed documents for answering questions.

Praveen7287 Updated

File contents

Query Retrieval Instructions

Retrieval Methodology

  1. Embed document chunks using sentence-transformers model
  2. Embed user query using same model
  3. Calculate cosine similarity between query and chunk embeddings
  4. Return top-k results with similarity scores above threshold

Advanced Features

  • Hybrid search: Combine semantic and keyword matching
  • Query expansion: Add synonyms and related terms
  • Reranking: Use cross-encoder for better precision
  • Caching: Store embeddings to avoid recomputation

Implementation

def retrieve_relevant_chunks(query, chunks, top_k=5):
    # Implementation here
    pass

Praveen7287/DocumentQA_AgenticSkills/tree/main/skills/query_retriever commit 0ad2a62cb4

Frequently asked questions

npx skillmds@latest add praveen7287/query-retriever