Document invocation observation and cost reporting
This commit is contained in:
28
cost.go
28
cost.go
@@ -6,19 +6,31 @@ import "go.maximumdirect.net/promptkit/internal/domain"
|
||||
type CostSource string
|
||||
|
||||
const (
|
||||
CostSourceNone CostSource = ""
|
||||
CostSourceProvider CostSource = "provider"
|
||||
// CostSourceNone denotes no known sourced contribution.
|
||||
CostSourceNone CostSource = ""
|
||||
// CostSourceProvider denotes a reported provider or injected-client amount.
|
||||
CostSourceProvider CostSource = "provider"
|
||||
// CostSourceConfiguredZero denotes an explicitly configured zero fallback.
|
||||
CostSourceConfiguredZero CostSource = "configured_zero"
|
||||
CostSourceMixed CostSource = "mixed"
|
||||
// CostSourceMixed denotes both provider and configured-zero contributions.
|
||||
CostSourceMixed CostSource = "mixed"
|
||||
)
|
||||
|
||||
// ObservedCost reports an available USD subtotal and its coverage and source.
|
||||
// Complete describes coverage of dispatched attempts, not billing verification.
|
||||
// Known means at least one contribution is available. Complete means all
|
||||
// included dispatched attempts have an amount under the selected policy; it
|
||||
// does not verify billing. A completed run with no dispatched attempts, or an
|
||||
// empty group, has known complete zero with no source. A group with members but
|
||||
// no terminals has unknown cost. Amounts are unrounded binary floating point.
|
||||
type ObservedCost struct {
|
||||
Value float64 `json:"value"`
|
||||
Known bool `json:"known"`
|
||||
Complete bool `json:"complete"`
|
||||
Source CostSource `json:"source"`
|
||||
// Value is the known USD subtotal.
|
||||
Value float64 `json:"value"`
|
||||
// Known reports whether a subtotal is available.
|
||||
Known bool `json:"known"`
|
||||
// Complete reports whether all included dispatched attempts are covered.
|
||||
Complete bool `json:"complete"`
|
||||
// Source summarizes the known contributions.
|
||||
Source CostSource `json:"source"`
|
||||
}
|
||||
|
||||
func fromDomainCost(value domain.ObservedCost) ObservedCost {
|
||||
|
||||
Reference in New Issue
Block a user