一键导入
adaptive-retrieval
Dynamically select retrieval strategies based on query type and characteristics.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Dynamically select retrieval strategies based on query type and characteristics.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use this skill when building, debugging, or improving Retrieval-Augmented Generation systems, including chunking, vector database selection, hybrid search, reranking, multimodal RAG, code documentation RAG, retrieval latency, and production RAG architecture.
Chunk nested documents into parent-child levels so retrieval can move from broad sections to fine-grained passages.
Use semantic boundaries and embedding similarity to chunk text for higher-relevance retrieval.
Route RAG chunking decisions across semantic, hierarchical, sliding-window, contextual-header, and framework-selection strategies.
Use overlapping windows to preserve context across chunk boundaries while controlling retrieval size.
Reduce retrieval latency with caching, batching, and index-level optimization.
| name | adaptive-retrieval |
| title | Adaptive Retrieval |
| description | Dynamically select retrieval strategies based on query type and characteristics. |
| allowed-tools | ["Read","Grep","Glob","Bash"] |
| category | retrieval-strategies |
| tags | ["adaptive","query-classification","dynamic-strategy","multi-strategy"] |
Adaptive retrieval classifies queries into types (factual, analytical, opinion, contextual) and applies different retrieval strategies optimized for each type. This dynamic approach ensures that each query receives the most appropriate treatment for optimal results.
One-size-fits-all retrieval has inherent limitations:
Use an LLM to classify queries into types.
Why: Accurate classification is the foundation of adaptive retrieval - the right strategy depends on correctly identifying the query type.
Direct the LLM to classify queries into categories: factual, analytical, opinion, or contextual.
Enhance queries for precision and rank results by relevance.
Why: Factual queries benefit from query enhancement that adds relevant terminology and precise ranking that identifies the most authoritative sources.
Rewrite the query to be more specific, retrieve more candidates, and re-rank by relevance to the original query.
Generate sub-queries and ensure diversity in results.
Why: Analytical queries need coverage of multiple aspects. Sub-query decomposition and diversity selection ensure comprehensive information gathering.
Break down the query into sub-questions, retrieve for each, and select a diverse set of results.
Identify viewpoints and select diverse opinions.
Why: Opinion queries require multiple perspectives. Viewpoint identification ensures retrieval represents different stances on the topic.
Identify distinct viewpoints on the topic, retrieve for each viewpoint, and select diverse opinions.
Incorporate user context into the query.
Why: Contextual queries depend on user-specific information. Incorporating context ensures retrieval matches the user's situation and needs.
Reformulate the query to include user context, then retrieve and rank results considering both relevance and context.
Combine all strategies into a unified system.
Why: A unified adaptive retriever provides a single interface that automatically selects the optimal strategy for each query.
Route queries to the appropriate strategy based on classification, then execute retrieval using the selected method.
For implementation patterns, see LangChain router architecture, LlamaIndex RouterQueryEngine, and the Self-RAG paper for related concepts.