Class EmbeddingSpendBudget
- Namespace
- MailFathom.Application.Emails.Embeddings.Limits
- Assembly
- MailFathom.Application.dll
The aggregate ceiling an instance is willing to spend on embedding, and the period it is counted over.
public sealed class EmbeddingSpendBudget
- Inheritance
-
EmbeddingSpendBudget
- Inherited Members
Remarks
Embedding is the first thing MailFathom does that costs money per unit of mail, so what bounds it is a figure an operator agreed to rather than one this system inferred. The unit is the characters actually sent to a provider, because that is what every provider prices from — approximately, since a token is not a character — and because it is the one quantity this deployment can count exactly without carrying a model's own tokenizer.
The period is a fixed window anchored at the Unix epoch rather than a rolling one. A fixed window has a start an operator can name, a roll-over instant work can wait for, and one row per period to count against; a rolling window would need every spend event retained for the length of the window and would never give a paused worker a moment to wake up at.
Configuration alone, and deliberately never part of an embedding profile. ADR 0006 keeps the profile row to what a stored vector means; a ceiling decides how many vectors exist and changes the meaning of none of them, so raising it re-embeds nothing.
Properties
- IsUnbounded
Gets whether this budget refuses nothing.
- MaxInputCharactersPerPeriod
Gets the characters one period may send to a provider, or zero where the operator declared no ceiling.
- Period
Gets the length of the window the ceiling is counted over.
- Unbounded
Gets a budget that bounds nothing, which is what an operator writing a ceiling of zero asked for.
Methods
- Create(long, TimeSpan)
Builds a budget from what a deployment declared.
- PeriodEndAt(DateTimeOffset)
Finds when the period an instant falls in rolls over, which is when paused work resumes.
- PeriodStartAt(DateTimeOffset)
Finds the start of the period an instant falls in, which is the key the consumed total is counted under.