Skip to Content
Anuma SDKReactInternalFunctionschunkAndEmbedAllMessages

chunkAndEmbedAllMessages

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

Defined in: src/lib/memoryEngine/embeddings.ts:438 

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

MemoryEngineEmbeddingOptions & 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?

("assistant" | "user")[]

Only embed messages with these roles

Returns

Promise<number>

Number of messages embedded

Last updated on