AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Ai Rag

skill-awesome-ai-dev-awesome-ai-dev-rag · by awesome-ai-dev

RAG 系统 - LangChain/Vectara/向量数据库/文档分割

No reviews yet
0 installs
13 views
0.0% view→install

Install

$ agentstack add skill-awesome-ai-dev-awesome-ai-dev-rag

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-awesome-ai-dev-awesome-ai-dev-rag)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
4mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Ai Rag? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

RAG 系统

架构

用户问题 → 检索 → 向量库 → 相关文档 → LLM → 回答

LangChain

import { LangChain } from 'langchain';
import { OpenAIEmbeddings } from 'langchain/embeddings';
import { PineconeVectorStore } from 'langchain/vectorstores';

// 文档加载
import { PDFLoader } from 'langchain/document_loaders';
const loader = new PDFLoader('document.pdf');
const docs = await loader.load();

// 分割
import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter';
const splitter = new RecursiveCharacterTextSplitter({
  chunkSize: 1000,
  chunkOverlap: 200
});
const splitDocs = await splitter.splitDocuments(docs);

// 向量化
const embeddings = new OpenAIEmbeddings();
const vectors = await embeddings.embedDocuments(
  splitDocs.map(d => d.pageContent)
);

// 存储到向量库
const store = new PineconeVectorStore(embeddings, { pineconeIndex });
await store.addDocuments(splitDocs);

// 检索
const retriever = store.asRetriever();
const results = await retriever.getRelevantDocuments('问题');

文档分割策略

// 按标题分割
import { MarkdownTextSplitter } from 'langchain/text_splitter';
const splitter = new MarkdownTextSplitter({
  chunkSize: 1000,
  chunkOverlap: 200,
  stripHeaders: true
});

// 按代码块分割
const codeSplitter = new RecursiveCharacterTextSplitter({
  chunkSize: 500,
  chunkOverlap: 50,
  separators: ['\n\n', '\n', '```', ' ']
});

检索优化

// MMR (最大边际相关)
const retriever = vectorStore.asRetriever({
  searchType: 'mmr',
  searchArgs: {
    k: 5,
    fetchK: 20,
    lambda: 0.5
  }
});

// 混合搜索
const fusionRetriever = new FusionRetriever([keywordRetriever, semanticRetriever]);

最佳实践

  1. 合理选择 chunk size
  2. 混合搜索效果更好
  3. 重排序提升质量
  4. 成本与效果平衡

参考

  • ai-tools/08-ai-platforms-api.md

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.