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: any): Promise

Description

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.

Parameters

NameTypeRequired?Description
paramsanyThe parameters for saving

Returns

Promise

Examples

// 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