QVAC Logo

ragChunk( )

Chunks documents into smaller pieces for embedding. Part of the segregated flow: ragChunk() → embed() → ragSaveEmbeddings()

function ragChunk(params: infer): Promise

Description

Chunks documents into smaller pieces for embedding. Part of the segregated flow: ragChunk() → embed() → ragSaveEmbeddings()

Parameters

NameTypeRequired?Description
paramsinferThe parameters for chunking

Returns

Promise

Examples

const chunks = await ragChunk({
  documents: ["Long document text here..."],
  chunkOpts: {
    chunkSize: 256,
    chunkOverlap: 50,
    chunkStrategy: "paragraph",
  },
});

On this page