context-retrieval

Solid

Retrieve relevant information from a knowledge base using semantic, keyword, or hybrid search to ground a query. Use when the task starts with a corpus or index that must be searched; use context-ranking when candidate chunks already exist and only need ordering.

AI & Automation 161 stars 32 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 87/100

Stars 20%
74
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Context Retrieval Context retrieval is the process of finding and assembling the most relevant pieces of information from a knowledge base to ground an AI agent's responses in factual, up-to-date data. It is the backbone of Retrieval Augmented Generation (RAG) and ensures that generated outputs are accurate and verifiable rather than hallucinated. ## Workflow 1. **Embed the Query**: Convert the user's natural-language query into a dense vector representation using an embedding model (e.g., OpenAI `text-embedding-3-small`, Cohere `embed-v3`, or an open-source model like `bge-large`). The embedding captures the semantic meaning of the query so it can be compared against stored documents. 2. **Search the Vector Store**: Send the query embedding to a vector database (Pinecone, Weaviate, Qdrant, Chroma, etc.) and perform an approximate nearest-neighbor (ANN) search. Request the top-k candidate chunks, typically k = 10–20 to give the reranker enough material to work with. 3. **Rerank the Results**: Pass the candidate chunks through a cross-encoder reranker (e.g., Cohere Rerank, `bge-reranker-large`, or a ColBERT model). The reranker scores each chunk against the original query with full attention, producing much more accurate relevance scores than cosine similarity alone. Keep the top-n results (typically n = 3–5). 4. **Assemble the Context Window**: Concatenate the selected chunks into a single context block, ordered by relevance score descending. Prepend source metadata (...

Details

Author
seb1n
Repository
seb1n/awesome-ai-agent-skills
Created
6 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category