Skip to Content
SdkReactInternalFunctionschunkAndEmbedAllMessages

chunkAndEmbedAllMessages

chunkAndEmbedAllMessages(ctx: StorageOperationsContext, options: MemoryRetrievalEmbeddingOptions & ChunkingOptions, filter?: object): Promise<number>

Defined in: src/lib/memoryRetrieval/embeddings.ts:331 

Chunk and embed all messages without embeddings/chunks in the database. Uses chunking for long messages, whole-message embedding for short ones.

Parameters

ParameterTypeDescription

ctx

StorageOperationsContext

Storage operations context

options

MemoryRetrievalEmbeddingOptions & ChunkingOptions

Embedding and chunking options

filter?

object

Optional filter for which messages to embed

filter.conversationId?

string

Only embed messages from this conversation

filter.minContentLength?

number

Minimum content length to embed (default: 30). Shorter messages are skipped.

filter.rechunkExisting?

boolean

Re-chunk messages that have whole-message embeddings but no chunks

filter.roles?

("user" | "assistant")[]

Only embed messages with these roles

Returns

Promise<number>

Number of messages embedded

Last updated on