langchain-rag

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

Updated Jan 10, 2026
One-click install
npx skills add https://github.com/orezek/monorepo_template --skill langchain-rag-orezek
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: langchain-rag
Source: https://github.com/orezek/monorepo_template/tree/main/.agents/skills/langchain-rag
Command: npx skills add https://github.com/orezek/monorepo_template --skill langchain-rag-orezek

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building a RAG system requires correctly wiring together document loading, text splitting, embedding generation, vector storage, and retrieval, and small mistakes like mismatched embedding models or poor chunk sizes silently degrade answer quality. ## Core Features & Use Cases - End-to-End RAG Pipeline: Complete load, split, embed, store, retrieve, and generate workflows in both Python and TypeScript. - Vector Store Guidance: Selection table and setup examples for InMemory, FAISS, Chroma, and Pinecone with persistence patterns. - Retrieval Techniques: Similarity search with scores, MMR for diversity, metadata filtering, and RAG-as-a-tool agent integration. - Common Pitfall Fixes: Concrete corrections for chunk sizing, missing overlap, non-persistent stores, inconsistent embeddings, FAISS deserialization, and dimension mismatches. - Use Case: You are building a documentation Q&A assistant. Use this Skill to load PDF and web pages, split them into 1000-character chunks with overlap, embed them with OpenAI text-embedding-3-small, persist them in Chroma, and expose retrieval as a tool to a LangChain agent. ## Quick Start Use the langchain-rag skill to build a RAG pipeline that loads my PDF documents, stores embeddings in Chroma, and answers questions with an OpenAI chat model.

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 with OpenAIEmbeddings, store in a vector store such as Chroma, then create a retriever and pass retrieved context to a chat model like ChatOpenAI.

Chroma vs FAISS vs Pinecone for vector storage?▼

Use InMemory for testing, FAISS for local high-performance search with disk persistence, Chroma for development with disk persistence, and Pinecone for production managed cloud storage. The choice depends on persistence and deployment needs.

What chunk size should I use for text splitting?▼

A chunk size of 500-1500 characters is typically good, with 1000 being a common default. Use an overlap of 10-20% of chunk size, such as 200 characters, to maintain context continuity across chunk boundaries.

Why does FAISS load_local raise a deserialization error?▼

FAISS requires explicitly passing allow_dangerous_deserialization=True when calling load_local, because loading pickled indexes can execute arbitrary code. Without this flag, the load call raises an error by design.

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 with the vector store index causes errors or meaningless search results.

How do I use RAG as a tool in a LangChain agent?▼

Wrap the retriever invocation in a tool function that returns joined document content, then pass it to create_agent along with the model. The agent calls the search tool when it needs external knowledge to answer a question.