QVAC Logo

ragSaveEmbeddings( )

Saves document embeddings in the RAG vector database.

function ragSaveEmbeddings(params): Promise<{
  droppedIndices: number[];
  processed: object[];
}>;

Parameters

NameTypeRequired?Description
paramsobjectThe parameters for saving embeddings

params

FieldTypeRequired?DefaultDescription
modelIdstring-The identifier of the embedding model to use
documentsstring or string[]-The documents to embed and save (string or array of strings)
chunkboolean-Whether to chunk the documents before embedding
chunkOptsobject-Options for chunking documents
workspacestring-Optional workspace for isolated storage

chunkOpts

FieldTypeRequired?DefaultDescription
chunkSizenumber512Size of each chunk
chunkOverlapnumber0Overlap between chunks
chunkStrategy"character" | "paragraph""character"Strategy for chunking
splitStrategy"token" | "character" | "word" | "sentence" | "line""character"Strategy for splitting text

Returns

Promise<object> — The processed results and dropped indices

FieldTypeDescription
droppedIndicesnumber[]Indices of documents that were dropped
processedobject[]Processed document information

Throws

When the response type is invalid or when the operation fails

On this page