Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
wshobson avatar

Rag Implementation

  • 11.1k installs
  • 38.3k repo stars
  • Updated July 22, 2026
  • wshobson/agents

Retrieval-Augmented Generation (RAG) is an LLM architecture pattern that retrieves relevant external documents in response to a query and passes them as context to an LLM for grounded answer generation.

About

RAG Implementation teaches developers to build Retrieval-Augmented Generation systems that combine LLMs with external knowledge sources to reduce hallucinations and provide grounded, factual responses. Covers vector database selection (Pinecone, Weaviate, Milvus, Chroma, Qdrant, pgvector), embedding models (Voyage, OpenAI, open-source), retrieval strategies (dense, sparse, hybrid, multi-query, HyDE), and reranking techniques. Includes a complete LangGraph-based code example demonstrating async retrieve-then-generate workflows with Claude and Anthropic embeddings, enabling developers to implement Q&A over proprietary documents, chatbots with current information, semantic search, documentation assistants, and research tools with source citation.

  • Vector database options: Pinecone (managed), Weaviate (hybrid), Milvus (on-premise), Chroma (local), Qdrant (fast), pgve
  • Embedding models: Voyage-3-large for Claude, text-embedding-3-large for OpenAI, open-source options for local deployment
  • Retrieval strategies: dense, sparse, hybrid search, multi-query, HyDE for different accuracy/latency tradeoffs
  • Reranking methods: cross-encoders, Cohere API, MMR for diversity, LLM-based scoring
  • Production-ready LangGraph example with async retrieve + generate nodes and state management

Rag Implementation by the numbers

  • 11,069 all-time installs (skills.sh)
  • +214 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #70 of 16,659 AI & Agent Building skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

rag-implementation capabilities & compatibility

Depends on embedding API (Voyage, OpenAI) and vector database (Pinecone serverless, self-hosted options).

Capabilities
vector database selection and configuration · embedding model evaluation and deployment · retrieval strategy implementation · reranking and result filtering · langgraph workflow composition · async retrieval and generation pipelines
Works with
anthropic · openai · postgres
Use cases
code review · documentation · api development · web search · web scraping
Platforms
macOS · Windows · Linux
Runs
Local or remote
Pricing
Freemium
From the docs

What rag-implementation says it does

Build Retrieval-Augmented Generation (RAG) systems for LLM applications with vector databases and semantic search.
skill description
npx skills add https://github.com/wshobson/agents --skill rag-implementation

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs11.1k
repo stars38.3k
Security audit3 / 3 scanners passed
Last updatedJuly 22, 2026
Repositorywshobson/agents

What it does

Build document Q&A systems and chatbots that ground LLM responses in external knowledge bases using vector databases and semantic search.

Who is it for?

Q&A systems over proprietary documents, knowledge-grounded chatbots, semantic search, reducing hallucinations, domain-specific LLM applications, research tools with source attribution.

Skip if: Real-time streaming responses with minimal latency, simple fact lookup without context, applications where retrieval overhead is unacceptable.

When should I use this skill?

Building LLM applications that need access to external knowledge, implementing document Q&A, adding current information to LLMs, requiring cited sources.

What you get

Developers build Q&A systems, chatbots, and documentation assistants that provide accurate, cited answers grounded in proprietary or current knowledge bases.

  • hybrid retriever code
  • ensemble fusion configuration
  • production RAG pattern reference

By the numbers

  • 6 vector database options documented (Pinecone, Weaviate, Milvus, Chroma, Qdrant, pgvector)
  • 6 embedding models compared with dimensions and use cases
  • 5 retrieval strategies (dense, sparse, hybrid, multi-query, HyDE)

Files

SKILL.mdMarkdownGitHub ↗

RAG Implementation

Master Retrieval-Augmented Generation (RAG) to build LLM applications that provide accurate, grounded responses using external knowledge sources.

When to Use This Skill

  • Building Q&A systems over proprietary documents
  • Creating chatbots with current, factual information
  • Implementing semantic search with natural language queries
  • Reducing hallucinations with grounded responses
  • Enabling LLMs to access domain-specific knowledge
  • Building documentation assistants
  • Creating research tools with source citation

Core Components

1. Vector Databases

Purpose: Store and retrieve document embeddings efficiently

Options:

  • Pinecone: Managed, scalable, serverless
  • Weaviate: Open-source, hybrid search, GraphQL
  • Milvus: High performance, on-premise
  • Chroma: Lightweight, easy to use, local development
  • Qdrant: Fast, filtered search, Rust-based
  • pgvector: PostgreSQL extension, SQL integration

2. Embeddings

Purpose: Convert text to numerical vectors for similarity search

Models (2026):

ModelDimensionsBest For
voyage-3-large1024Claude apps (Anthropic recommended)
voyage-code-31024Code search
text-embedding-3-large3072OpenAI apps, high accuracy
text-embedding-3-small1536OpenAI apps, cost-effective
bge-large-en-v1.51024Open source, local deployment
multilingual-e5-large1024Multi-language support

3. Retrieval Strategies

Approaches:

  • Dense Retrieval: Semantic similarity via embeddings
  • Sparse Retrieval: Keyword matching (BM25, TF-IDF)
  • Hybrid Search: Combine dense + sparse with weighted fusion
  • Multi-Query: Generate multiple query variations
  • HyDE: Generate hypothetical documents for better retrieval

4. Reranking

Purpose: Improve retrieval quality by reordering results

Methods:

  • Cross-Encoders: BERT-based reranking (ms-marco-MiniLM)
  • Cohere Rerank: API-based reranking
  • Maximal Marginal Relevance (MMR): Diversity + relevance
  • LLM-based: Use LLM to score relevance

Quick Start with LangGraph

from langgraph.graph import StateGraph, START, END
from langchain_anthropic import ChatAnthropic
from langchain_voyageai import VoyageAIEmbeddings
from langchain_pinecone import PineconeVectorStore
from langchain_core.documents import Document
from langchain_core.prompts import ChatPromptTemplate
from langchain_text_splitters import RecursiveCharacterTextSplitter
from typing import TypedDict, Annotated

class RAGState(TypedDict):
    question: str
    context: list[Document]
    answer: str

# Initialize components
llm = ChatAnthropic(model="claude-sonnet-4-6")
embeddings = VoyageAIEmbeddings(model="voyage-3-large")
vectorstore = PineconeVectorStore(index_name="docs", embedding=embeddings)
retriever = vectorstore.as_retriever(search_kwargs={"k": 4})

# RAG prompt
rag_prompt = ChatPromptTemplate.from_template(
    """Answer based on the context below. If you cannot answer, say so.

    Context:
    {context}

    Question: {question}

    Answer:"""
)

async def retrieve(state: RAGState) -> RAGState:
    """Retrieve relevant documents."""
    docs = await retriever.ainvoke(state["question"])
    return {"context": docs}

async def generate(state: RAGState) -> RAGState:
    """Generate answer from context."""
    context_text = "\n\n".join(doc.page_content for doc in state["context"])
    messages = rag_prompt.format_messages(
        context=context_text,
        question=state["question"]
    )
    response = await llm.ainvoke(messages)
    return {"answer": response.content}

# Build RAG graph
builder = StateGraph(RAGState)
builder.add_node("retrieve", retrieve)
builder.add_node("generate", generate)
builder.add_edge(START, "retrieve")
builder.add_edge("retrieve", "generate")
builder.add_edge("generate", END)

rag_chain = builder.compile()

# Use
result = await rag_chain.ainvoke({"question": "What are the main features?"})
print(result["answer"])

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Related skills

How it compares

Use rag-implementation for retrieval pipeline design; use langgraph-fundamentals when orchestration and graph state matter more than retriever fusion.

FAQ

Which vector database should I use?

Pinecone for managed/serverless, Weaviate for hybrid search, Milvus for on-premise, Chroma for lightweight local development, Qdrant for filtered search, pgvector for SQL integration.

What embedding model should I use?

Voyage-3-large (Anthropic-recommended for Claude), text-embedding-3-large (OpenAI, high accuracy), text-embedding-3-small (OpenAI, cost-effective), bge-large-en-v1.5 (open-source, local).

What are retrieval strategies?

Dense (semantic similarity), sparse (keyword matching), hybrid (combined), multi-query (generate variations), HyDE (hypothetical documents) for different accuracy/cost tradeoffs.

Is Rag Implementation safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.