agentskit.js
Packages

@agentskit/rag

Plug-and-play RAG. Chunk, embed, retrieve, rerank, hybrid — plus six document loaders.

When to reach for it

  • You want retrieval-augmented generation in a few lines.
  • You need rerankers (BM25 / Cohere / BGE) or hybrid vector+keyword search.
  • You want document loaders for URL / GitHub / Notion / Confluence / Google Drive / PDF.

Install

npm install @agentskit/rag

Hello world

import { createRAG } from '@agentskit/rag'
import { fileVectorMemory } from '@agentskit/memory'
import { openaiEmbedder } from '@agentskit/adapters'

const rag = createRAG({
  embed: openaiEmbedder({ apiKey: process.env.OPENAI_API_KEY! }),
  store: fileVectorMemory({ path: './kb.json' }),
})
await rag.ingest([{ content: 'AgentsKit is a toolkit for AI agents.', source: 'intro' }])
const hits = await rag.search('what is agentskit')

Surface

  • createRAG({ embed, store, chunkSize, chunkOverlap, topK, threshold }).
  • chunkText — standalone splitter.
  • createRerankedRetriever · createHybridRetriever · bm25Score · bm25Rerank.
  • Loaders: loadUrl · loadGitHubFile · loadGitHubTree · loadNotionPage · loadConfluencePage · loadGoogleDriveFile · loadPdf.

Recipes

Source

npm: @agentskit/rag · repo: packages/rag

✎ Edit this page on GitHub·Found a problem? Open an issue →·How to contribute →

On this page