Table of Contents

Method EmbedAsync

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

EmbedAsync(StoredEmailId, RegisteredEmbeddingProfile, CancellationToken)

Embeds whatever of one message is not yet embedded under one generation.

public Task<StoredEmailEmbeddingRun> EmbedAsync(StoredEmailId storedEmailId, RegisteredEmbeddingProfile profile, CancellationToken cancellationToken)

Parameters

storedEmailId StoredEmailId

The message to bring up to date.

profile RegisteredEmbeddingProfile

The generation the vectors belong to, which the caller decides and this never reads.

cancellationToken CancellationToken

Cancels the turn between calls and between commits.

Returns

Task<StoredEmailEmbeddingRun>

How the turn ended, and how many passages it committed vectors for.

Remarks

The generation is a parameter rather than something read here, because the live path and a reindex write into different ones at the same moment: mail arriving is embedded into the generation serving searches, and the sweep fills the one being built. A generator that resolved it itself could only ever serve one of the two.

Exceptions

ArgumentNullException

Thrown when profile is null.

PersistenceConcurrencyConflictException

Thrown when a competing writer wins a race the bounded retries could not resolve. Vectors already committed stay durable and the passages they cover are no longer outstanding.

OperationCanceledException

Thrown when the caller cancels or the host is shutting down. Committed vectors stay durable.