Table of Contents

Method SaveEmbeddingsAsync

Namespace
MailFathom.Application.Emails.Embeddings
Assembly
MailFathom.Application.dll

SaveEmbeddingsAsync(IPersistenceSession, ActiveEmbeddingProfile, IReadOnlyList<GeneratedChunkEmbedding>, CancellationToken)

Stores the vectors one generation produced, inside the caller's open session.

Task SaveEmbeddingsAsync(IPersistenceSession session, ActiveEmbeddingProfile profile, IReadOnlyList<GeneratedChunkEmbedding> embeddings, CancellationToken cancellationToken)

Parameters

session IPersistenceSession

The session whose transaction this write joins.

profile ActiveEmbeddingProfile

The profile the vectors belong to, whose dimension is written beside each of them.

embeddings IReadOnlyList<GeneratedChunkEmbedding>

The passage and vector pairs to store.

cancellationToken CancellationToken

Propagates caller cancellation.

Returns

Task

A task that completes when the writes have been staged.

Remarks

The write is an upsert over the passage and profile together, so embedding a passage twice under one profile replaces its vector rather than adding a second one, and a run interrupted mid-message re-embeds only the passages it never reached. Committing the vectors together is what keeps a crash from leaving a message that looks embedded and is not: either the whole batch is durable or none of it is.

Exceptions

ArgumentNullException

Thrown when any reference argument is null.