langchain-rag
Build Retrieval Augmented Generation (RAG) systems with LangChain - includes embeddings, vector stores, retrievers, document loaders, and text splitting
npx skills add majiayu000/claude-skill-registry --skill langchain-rag --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# langchain-rag (JavaScript/TypeScript) ## 概述 检索增强生成(RAG)通过从外部知识源获取相关上下文来增强 LLM 响应。RAG 系统在查询时检索文档并使用它们来生成响应,而不是仅依赖训练数据。 **核心概念:** - **文档加载器(Document Loaders)**:从文件、Web、数据库摄取数据 - **文本分割器(Text Splitters)**:将文档分解为块 - **嵌入(Embeddings)**:将文本转换为向量 - **向量存储(Vector Stores)**:存储和搜索嵌入 - **检索器(Retrievers)**:为查询获取相关文档 ## RAG 流水线 1. **索引**:加载 → 分割 → 嵌入 → 存储 2. **检索**:查询 → 嵌入 → 搜索 → 返回文档 3. **生成**:文档 + 查询 → LLM → 响应 ## 决策表 ### 向量存储选择 | 存储 | 何时使用 | 原因 | |-------|-------------|-----| | MemoryVectorStore | 开发、测试 | 内存中、快速、临时 | | Chroma | 本地生产环境 | 持久化、开源 | | Pinecone | 云端、可扩展 | 托管、快速、可扩展 | | Faiss | 高性能 | 快速相似性搜索 | ### 嵌入模型选择 | 模型 | 何时使用 | 维度 | |-------|-------------|-----------| | text-embedding-3-small | 成本效益 | 1536 | | text-embedding-3-large | 最佳质量 | 3072 | | text-embedding-ada-002 | 旧版 | 1536 | ## 代码示例 ### 基本 RAG 设置 ```typescript import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { MemoryVectorStore } from "@langchain/classic/vectorstores/memory"; import { RecursiveCharacterTextSplitter } from "@langchain/textsplitters"; // 1. 加载文档(示例:内存中文本) const docs = [ { pageContent: "LangChain 是一个用于构建 LLM 应用程序的框架。", metadata: {} }, { pageContent: "RAG 代表检索增强生成。", metadata: {} }, ]; // 2
- 概述
- RAG 流水线
- 决策表
- 向量存储选择
- 嵌入模型选择
- 代码示例
- 基本 RAG 设置
- 加载网页
- 加载 PDF 文件
- 高级文本分割
- 使用 Chroma(持久化)
- 高级检索
- 元数据过滤
- RAG 与代理
What does the langchain-rag skill do?
Build Retrieval Augmented Generation (RAG) systems with LangChain - includes embeddings, vector stores, retrievers, document loaders, and text splitting
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill langchain-rag --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
