Skip to main content

Module cost

Module cost 

Source
Expand description

What a run has cost, and how much of a context window it has used.

§An unlabelled estimate cannot be built

Quantity has no constructor that takes a number on its own. Every one of them names the Basis in the same call — Quantity::measured or Quantity::estimated — and the wording is derived from that basis, so a number reaches a screen with the fact that it was estimated attached or it does not reach a screen at all. The label is in the drawn text, in the mark beside it, and in the node’s published value, because a reader who saw the number on one surface and not the other would draw the wrong conclusion on the second one.

§Unavailable is not zero

Reading::Unavailable is a state, not a quantity. Nothing about it is drawn as a number, no proportion is computed from it, and the node publishes the refusal rather than a value.

§An unknown limit draws no proportion

Limit::Unknown means nobody stated a ceiling. A proportion of an unknown total is invented, so ContextGauge draws no fill and publishes no range, exactly as ProgressBar refuses to claim a position for work whose extent is unknown. It does not fall back to the indeterminate sweep either: that sweep means “in flight”, and a reading of what has been used so far is not in flight.

§Numbers are the caller’s

Currency, token counts, grouping and the position of a unit are locale work, which this crate does not do — the same reason Timeline takes times as finished strings. A Quantity therefore carries both the caller’s already-formatted wording and, separately, the bare number, which is used for one thing only: working out the proportion of a known limit. Nothing here ever turns a number into text.

Structs§

ContextGauge
How much of a context window a run has used.
CostLine
One line of a CostMeter.
CostMeter
What a run has cost so far, line by line.
LastVerified
When a reading was last verified, for a reading that is no longer current.
Quantity
A number, the caller’s wording for it, and how it was arrived at.

Enums§

Basis
How a number was arrived at.
Limit
The ceiling a gauge measures against.
Reading
What is known about a number right now.