0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/packages/rag
History 2026-11-12 21:12:29 +00:00
..
src feat: pass the authenticated user to DynamicArgument callbacks (#28612) 2026-11-12 10:55:12 -05:00
.gitignore pinecone test 2024-11-19 17:43:42 -06:00
AGENTS.md chore: enforce AGENTS.md token limits (#15464) 2026-04-18 19:12:37 -07:00
CHANGELOG.md chore: version - exit prerelease mode 2026-11-12 21:12:29 +00:00
docker-compose.yaml Chroma integration 2024-12-10 23:37:09 -08:00
lint-staged.config.js refactor(lint): replace ESLint with type-aware oxlint (#27476) 2026-10-18 10:38:35 -07:00
package.json chore: version - exit prerelease mode 2026-11-12 21:12:29 +00:00
README.md chore(*): Update/unify/add READMEs (#22858) 2026-09-02 14:36:59 +02:00
tsconfig.build.json chore: fix go-to-definition using tsc declaration maps (#6089) 2025-07-30 15:41:00 -07:00
tsconfig.json chore: migrate package builds to tsdown (#19829) 2026-07-28 12:32:21 +02:00
tsdown.config.ts chore: migrate package builds to tsdown (#19829) 2026-07-28 12:32:21 +02:00
turbo.json chore: migrate package builds to tsdown (#19829) 2026-07-28 12:32:21 +02:00
vitest.config.ts fix: repair test failures surfaced by the full release-PR test run (#28116) 2026-10-22 13:15:26 +02:00

@mastra/rag

@mastra/rag provides document chunking, reranking, and graph-based retrieval utilities for retrieval-augmented generation. Use it to prepare source material for embedding and select the most relevant context before an agent generates a response.

Installation

npm install @mastra/rag

Usage

Create a document and split it into chunks before embedding or indexing the content.

import { MDocument } from '@mastra/rag';

const document = MDocument.fromText(`
# Product guide

Mastra provides agents, workflows, memory, and retrieval tools.
`);

const chunks = await document.chunk({
  strategy: 'recursive',
  maxSize: 512,
  overlap: 50,
});

Documentation

Changelog

See the package changelog for version history and release notes.

Support

We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.