QVAC Logo

ragSaveEmbeddings( )

Saves pre-embedded documents to the RAG vector database. Part of the segregated flow: chunk() → embed() → saveEmbeddings() **Workspace lifecycle:** This operation implicitly opens (or creates) the workspace. The workspace remains open until closed.

function ragSaveEmbeddings(params: RagSaveEmbeddingsParams, options?: { forceNewConnection?: boolean; profiling?: { enabled?: boolean; includeServerBreakdown?: boolean; mode?: "summary" | "verbose" }; timeout?: number }): Promise

Parameters

NameTypeRequired?Description
paramsRagSaveEmbeddingsParamsThe parameters for saving
options`{ forceNewConnection?: boolean; profiling?: { enabled?: boolean; includeServerBreakdown?: boolean; mode?: "summary""verbose" }; timeout?: number }`

Returns

Promise

Throws

ErrorWhen
When the operation fails
When streaming ends unexpectedly (only when using onProgress)

Example

// Segregated flow
const chunks = await ragChunk({ documents: ["text1", "text2"] });
const embeddings = await embed({ modelId, text: chunks.map(c => c.content) });
const embeddedDocs = chunks.map((chunk, i) => ({
  ...chunk,
  embedding: embeddings[i],
  embeddingModelId: modelId,
}));
const result = await ragSaveEmbeddings({
  documents: embeddedDocs,
  workspace: "my-workspace",
});

On this page