langchain-rag

Build retrieval-augmented generation pipelines with LangChain document loaders, text splitters, embeddings, and vector stores.

Updated May 1, 2026
One-click install
npx skills add https://github.com/ricardoo022/4dill --skill langchain-rag-ricardoo022
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: langchain-rag
Source: https://github.com/ricardoo022/4dill/tree/main/.gemini/skills/langchain-rag
Command: npx skills add https://github.com/ricardoo022/4dill --skill langchain-rag-ricardoo022

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building a RAG system requires correctly wiring together document loading, chunking, embedding, vector storage, and retrieval, and small mistakes like mismatched embedding models or poor chunk sizes silently degrade answer quality. ## Core Features & Use Cases - Complete RAG Pipeline: Load documents, split them with RecursiveCharacterTextSplitter, embed with OpenAI, store in a vector database, and retrieve context for LLM generation. - Vector Store Guidance: Compare InMemory, FAISS, Chroma, and Pinecone with persistence and production trade-offs, plus similarity search, MMR, and metadata filtering. - Common Pitfall Prevention: Avoid wrong chunk sizes, missing overlap, in-memory data loss, embedding model mismatches, and FAISS deserialization errors. - Use Case: Build a documentation Q&A agent that loads PDF and web pages, indexes them in Chroma, and answers user questions using retrieved context as a tool. ## Quick Start Ask the AI to build a RAG pipeline that loads your documents, splits them into chunks, stores embeddings in Chroma, and answers questions using retrieval.

Frequently Asked Questions about langchain-rag

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

FAQPage Schema
How do I build a RAG pipeline with LangChain?▼

Load documents with a loader like PyPDFLoader, split them with RecursiveCharacterTextSplitter, embed them with OpenAIEmbeddings, and store them in a vector store such as Chroma. Then create a retriever and pass retrieved context to the LLM with the user query.

What chunk size should I use for text splitting in RAG?▼

A chunk size between 500 and 1500 characters works well for most cases, with 1000 being a solid default. Use 10-20% overlap, such as 200 characters, to preserve context across chunk boundaries.

Chroma vs FAISS vs Pinecone for vector storage?▼

Chroma suits development with disk persistence, FAISS offers high-performance local search with save/load support, and Pinecone is a managed cloud option for production. InMemory stores are only appropriate for testing since data is lost on restart.

Why does FAISS load_local raise a deserialization error?▼

FAISS.load_local requires explicitly passing allow_dangerous_deserialization=True because loading pickled indexes can execute arbitrary code. Only enable it for indexes you created and trust.

Can I use different embedding models for indexing and querying?▼

No, you must use the same embedding model for both indexing and querying, since vectors from different models are incompatible. Mixing models or mismatched dimensions causes retrieval failures or errors.

How do I filter vector search results by metadata in LangChain?▼

Attach metadata when creating documents, then pass a filter dictionary to similarity_search, such as filter={"language": "python"}. This restricts results to documents matching the specified metadata properties.