بنقرة واحدة
crag-corrective-rag
Dynamically evaluate and correct retrieval quality using relevance scores and web search.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Dynamically evaluate and correct retrieval quality using relevance scores and web search.
التثبيت باستخدام 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 | crag-corrective-rag |
| title | CRAG - Corrective RAG |
| description | Dynamically evaluate and correct retrieval quality using relevance scores and web search. |
| allowed-tools | ["Read","Grep","Glob","Bash"] |
| category | retrieval-strategies |
| tags | ["crag","corrective","web-search","relevance-evaluation","dynamic-correction"] |
Corrective RAG (CRAG) extends standard retrieval by dynamically evaluating document relevance and correcting the retrieval process when needed. It combines local knowledge bases with web search, using relevance scores to determine whether to use retrieved documents, supplement with web results, or rely entirely on external sources.
Traditional RAG systems have limitations when retrieved information is insufficient:
Score each retrieved document for its relevance to the query.
Why: Relevance evaluation provides a quantitative measure of retrieval quality, enabling data-driven decisions about correction strategies.
Use an LLM to score each retrieved document on a scale from 0 to 1 based on how well it addresses the query.
Determine correction strategy based on relevance scores.
Why: Different relevance levels require different approaches - high relevance uses local content, low relevance triggers web search, ambiguous cases combine both.
Optimize queries for web searching when external knowledge is needed.
Why: Web search engines respond better to properly formatted queries. Rewriting improves web search results.
Rewrite the query to be more suitable for web search engines while maintaining the original intent.
Extract key information from documents for use in response generation.
Why: Raw documents may contain excessive detail. Refinement extracts the most relevant information for efficient response generation.
Extract bullet points or key information from documents to focus on the most relevant content.
Fetch and process web search results when needed.
Why: Web search provides up-to-date information and can supplement or replace insufficient local retrieval.
Integrate with web search APIs (e.g., DuckDuckGo, Bing) to fetch external information when local retrieval is insufficient.
Generate responses using appropriate knowledge sources based on correction strategy.
Why: The response generator must handle different knowledge sources - local documents, web results, or combined information - with appropriate attribution.
Generate responses conditioned on the correction strategy: using local content, web results, or combined sources.
Combine all components into a cohesive corrective system.
Why: A complete pipeline with evaluation, decision logic, web search, and response generation provides a robust retrieval system that adapts to information quality.
For implementation patterns, see the CRAG paper, LangChain tools documentation, and the Self-RAG paper for related concepts.