rag-implementation

Build RAG systems with vector databases and semantic search.

1|Updated Mar 7, 2026
One-click install
npx skills add https://github.com/karrtik159/ContextFlow --skill rag-implementation-karrtik159
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rag-implementation
Source: https://github.com/karrtik159/ContextFlow/tree/main/.agents/skills/rag-implementation
Command: npx skills add https://github.com/karrtik159/ContextFlow --skill rag-implementation-karrtik159

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires langgraph, langchain_anthropic, langchain_voyageai, langchain_pinecone, langchain_core, langchain_text_splitters, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill unit addresses the challenge of building Retrieval-Augmented Generation (RAG) systems for AI applications, enabling knowledge-grounded AI and accurate document Q&A systems.

Core Features & Use Cases

  • RAG Implementation: Build LLM applications with vector databases and semantic search for grounded responses.
  • Vector Databases: Utilize vector databases like Pinecone, Weaviate, Milvus, and pgvector for efficient retrieval.
  • Embeddings: Employ embeddings from models like voyage-3-large, voyage-code-3, text-embedding-3-large, and bge-large-en-v1.5.
  • Retrieval Strategies: Implement dense, sparse, hybrid search, multi-query, and HyDE for optimal retrieval.
  • Reranking: Enhance retrieval quality with cross-encoders, Cohere Rerank, MMR, and LLM-based reranking.
  • Document Chunking: Split documents using Recursive Character Text Splitter, Token Text Splitter, Semantic Chunker, and Markdown Header Splitter.
  • Vector Store Configurations: Set up vector stores for Pinecone, Weaviate, Chroma, and pgvector.
  • Retrieval Optimization: Apply metadata filtering, MMR, cross-encoder reranking, Cohere Rerank, and contextual compression.
  • Prompt Engineering: Design contextual prompts with citations and structured output for RAG.
  • Evaluation Metrics: Assess retrieval precision, recall, answer relevance, faithfulness, and context relevance.

Quick Start

Execute the following Python code to start using the RAG implementation:

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 and build RAG graph
# ...
# Use
result = await rag_chain.ainvoke({"question": "What are the main features?"})
print(result["answer"])

Frequently Asked Questions about rag-implementation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a RAG system with vector databases for document Q&A?

Build a RAG system for document Q&A by integrating LLMs with vector databases like Pinecone, applying text chunking, generating vector embeddings, and configuring semantic search to retrieve and ground responses. This Skill provides the implementation graph for that pipeline.

What is the best way to implement hybrid search and reranking in a RAG pipeline?

Implement hybrid search and reranking in a RAG pipeline by combining dense and sparse retrieval, then applying cross-encoders, Cohere Rerank, or MMR to enhance retrieval quality and optimize the contextual relevance of fetched documents.

Can I use LangGraph and Pinecone together for knowledge-grounded AI applications?

Yes, you can use LangGraph and Pinecone together for knowledge-grounded AI. This implementation utilizes LangGraph for orchestration, Pinecone as the vector store, and Anthropic models to structure the retrieval and generation workflow.

Which document chunking strategies work best for semantic search retrieval?

Effective document chunking strategies for semantic search include the Recursive Character Text Splitter, Token Text Splitter, Semantic Chunker, and Markdown Header Splitter to segment documents before generating vector embeddings.

How do I evaluate retrieval precision and answer faithfulness in RAG systems?

Evaluate retrieval precision and answer faithfulness in RAG systems by applying specific evaluation metrics to assess context relevance, answer relevance, and the accuracy of the knowledge-grounded responses generated by the LLM.