ragChunk( )
Chunks documents into smaller pieces for embedding. Part of the segregated flow: ragChunk() → embed() → ragSaveEmbeddings()
function ragChunk(params: { chunkOpts?: { chunkOverlap?: number; chunkSize?: number; chunkStrategy?: "character" | "paragraph"; splitStrategy?: "character" | "word" | "token" | "sentence" | "line" }; documents: string | string[] }, options?: { forceNewConnection?: boolean; profiling?: { enabled?: boolean; includeServerBreakdown?: boolean; mode?: "summary" | "verbose" }; timeout?: number }): PromiseParameters
| Name | Type | Required? | Description |
|---|---|---|---|
params | `{ chunkOpts?: { chunkOverlap?: number; chunkSize?: number; chunkStrategy?: "character" | "paragraph"; splitStrategy?: "character" | "word" |
options | `{ forceNewConnection?: boolean; profiling?: { enabled?: boolean; includeServerBreakdown?: boolean; mode?: "summary" | "verbose" }; timeout?: number }` | ✗ |
Returns
PromiseThrows
| Error | When |
|---|---|
When the operation fails |
Example
const chunks = await ragChunk({
documents: ["Long document text here..."],
chunkOpts: {
chunkSize: 256,
chunkOverlap: 50,
chunkStrategy: "paragraph",
},
});ping( )
Sends a ping request to the server and returns the pong response.
ragCloseWorkspace( )
Closes a RAG workspace, releasing in-memory resources (Corestore, HyperDB adapter, RAG instance). **Workspace lifecycle:** Workspaces are implicitly opened. This function explicitly closes them, releasing memory and file locks. The workspace data remains on disk unless `deleteOnClose` is set to true.