ragIngest( )
Ingests documents into the RAG vector database. Full pipeline: chunk → embed → save **Workspace lifecycle:** This operation implicitly opens (or creates) the workspace. The workspace remains open until closed.
function ragIngest(params: RagIngestParams, options?: { forceNewConnection?: boolean; profiling?: { enabled?: boolean; includeServerBreakdown?: boolean; mode?: "summary" | "verbose" }; timeout?: number }): PromiseParameters
| Name | Type | Required? | Description |
|---|---|---|---|
params | RagIngestParams | ✓ | The parameters for ingestion |
options | `{ forceNewConnection?: boolean; profiling?: { enabled?: boolean; includeServerBreakdown?: boolean; mode?: "summary" | "verbose" }; timeout?: number }` | ✗ |
Returns
PromiseThrows
| Error | When |
|---|---|
When the operation fails | |
When streaming ends unexpectedly (only when using onProgress) |
Example
// Simple ingest
const result = await ragIngest({
modelId,
documents: ["Document 1", "Document 2"],
});
// With progress tracking
const result = await ragIngest({
modelId,
documents: ["Document 1", "Document 2"],
workspace: "my-docs",
onProgress: (stage, current, total) => {
console.log(`[${stage}] ${current}/${total}`);
},
});ragDeleteWorkspace( )
Deletes a RAG workspace and all its data. The workspace must not be currently loaded/in-use.
ragListWorkspaces( )
Lists all RAG workspaces with their open status. Returns all workspaces that exist on disk. The `open` field indicates whether the workspace is currently loaded in memory and holding active resources (Corestore, HyperDB adapter, and possibly a RAG instance).