Class StoredEmailEmbeddingGenerator
- Namespace
- MailFathom.Application.Emails.Embeddings.Generation
- Assembly
- MailFathom.Application.dll
Gives every passage of one stored message a vector under the profile this instance embeds into.
public sealed class StoredEmailEmbeddingGenerator
- Inheritance
-
StoredEmailEmbeddingGenerator
- Inherited Members
Remarks
The operation reads committed state and writes committed state, and the provider call between the two happens with no transaction open. That ordering is the whole reason this is a separate unit of work from synchronization: an embedding request that took a minute would otherwise hold a database transaction open for a minute, and a provider outage would stall the mailbox fetch behind it.
It is idempotent at the granularity of a passage. What is outstanding is decided by the store rather than remembered by the caller, so a message offered twice, a run interrupted mid-message, and a process that crashed after committing half of one all resume by asking the same question and re-embedding only what is genuinely missing.
Nothing here retries a provider call. The adapter behind ITextEmbeddingGenerator runs every call under a named resilience pipeline with its own bounded, jittered attempts, and a second layer around it would multiply the two attempt counts against a provider that is already refusing.
Constructors
- StoredEmailEmbeddingGenerator(IActiveEmbeddingProfileReader, IEmailEmbeddingStore, ITextEmbeddingGenerator, OptimisticConcurrencyRetryPolicy)
Initializes a new generator of one message's embeddings.
Methods
- EmbedAsync(StoredEmailId, CancellationToken)
Embeds whatever of one message is not yet embedded under the active profile.