langchain-rag

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

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/flemx/salesforce-langgraph-agent --skill langchain-rag-flemx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: langchain-rag
Source: https://github.com/flemx/salesforce-langgraph-agent/tree/main/.agents/skills/langchain-rag
Command: npx skills add https://github.com/flemx/salesforce-langgraph-agent --skill langchain-rag-flemx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building a RAG system requires correctly wiring together document loading, text splitting, embedding, vector storage, and retrieval, and small mistakes like mismatched embedding models or missing persistence silently break results. ## Core Features & Use Cases - Complete RAG Pipeline: Load documents, split with RecursiveCharacterTextSplitter, embed with OpenAI, store in Chroma, FAISS, or Pinecone, and retrieve relevant chunks. - Retrieval Strategies: Similarity search with scores, MMR for diversity, and metadata filtering, plus using RAG as a tool inside a LangChain agent. - Common Pitfall Fixes: Guidance on chunk size and overlap, persistent vector stores, consistent embedding models, FAISS deserialization, and dimension mismatches. - Use Case: Build a documentation Q&A assistant that loads PDF and web pages, indexes them in Chroma, and answers user questions with retrieved context in Python or TypeScript. ## Quick Start Ask the AI to build a RAG pipeline that loads a PDF, splits it 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 document loader, split them with RecursiveCharacterTextSplitter, embed them with OpenAIEmbeddings, and store them in a vector store like Chroma. Then create a retriever and pass retrieved context to the LLM alongside the user query.

Which vector store should I use for RAG: Chroma, FAISS, or Pinecone?

Use in-memory stores for testing, FAISS for local high-performance search with disk persistence, Chroma for development with disk persistence, and Pinecone for managed production deployments in the cloud.

What chunk size should I use with RecursiveCharacterTextSplitter?

A chunk size of 500-1500 characters works well for most cases, with 1000 as a common default. Use an overlap of 10-20% of the chunk size, such as 200, to preserve context 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. 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 dimension mismatch errors.

How do I use RAG as a tool inside a LangChain agent?

Wrap the retriever call in a tool function that takes a query string and returns joined document content, then pass it to create_agent with your model. The agent will invoke the search tool when it needs external context to answer.