context-retrieval
SolidRetrieve 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
Quality Score: 87/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
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
AI & Automation Solid
context-ranking
Rank an existing set of context chunks by relevance, diversity, freshness, and utility. Use when retrieval has already produced candidates that must be scored or reranked; use context-retrieval when the source corpus still needs to be searched.
161 Updated 1 weeks ago
seb1n AI & Automation Featured
retrieval
Retrieval - vector DBs, embeddings, hybrid search, reranking.
944 Updated today
sipyourdrink-ltd AI & Automation Listed
rag-knowledge-base
Use when building, indexing, or querying vector databases for Retrieval-Augmented Generation (RAG).
0 Updated 2 weeks ago
Drvivek34