Define observed cost values and aggregation
This commit is contained in:
17
internal/domain/cost.go
Normal file
17
internal/domain/cost.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package domain
|
||||
|
||||
type CostSource string
|
||||
|
||||
const (
|
||||
CostSourceNone CostSource = ""
|
||||
CostSourceProvider CostSource = "provider"
|
||||
CostSourceConfiguredZero CostSource = "configured_zero"
|
||||
CostSourceMixed CostSource = "mixed"
|
||||
)
|
||||
|
||||
type ObservedCost struct {
|
||||
Value float64
|
||||
Known bool
|
||||
Complete bool
|
||||
Source CostSource
|
||||
}
|
||||
@@ -99,6 +99,7 @@ type RunResult struct {
|
||||
EffectiveModelParams ExecutionTarget
|
||||
InputHashes map[string]string
|
||||
Usage TokenUsage
|
||||
CostUSD ObservedCost
|
||||
StartTime time.Time
|
||||
EndTime time.Time
|
||||
Duration time.Duration
|
||||
@@ -328,6 +329,7 @@ type GenerateResponse struct {
|
||||
Content string
|
||||
Usage TokenUsage
|
||||
UsagePresence *TokenUsagePresence
|
||||
CostUSD *float64
|
||||
}
|
||||
|
||||
// TokenUsagePresence records which token fields a provider reported.
|
||||
|
||||
@@ -76,6 +76,7 @@ type ExecutionGroupSummary struct {
|
||||
TransientRetries uint64
|
||||
RepairCalls uint64
|
||||
Usage ObservedTokenUsage
|
||||
CostUSD ObservedCost
|
||||
}
|
||||
|
||||
// ExecutionEvent contains metadata only; it carries no mutable containers or
|
||||
@@ -101,6 +102,7 @@ type ExecutionEvent struct {
|
||||
StatusCode int
|
||||
RetriesExhausted bool
|
||||
Usage ObservedTokenUsage
|
||||
CostUSD ObservedCost
|
||||
Attempts uint64
|
||||
TransientRetries uint64
|
||||
RepairCalls uint64
|
||||
|
||||
Reference in New Issue
Block a user