ConsumptionMetricSerializer

Serializes ConsumptionMetric with min / max / avg-per-substage emitted as formatted strings ("N,NNN.NN tokens" / "N,NNN.NN credits") carrying the unit from totalConsumption. The kotlinx default would emit the aggregates as bare Doubles without a unit suffix and without thousand separators.

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Class descriptor with the total, per-substage aggregates, and optional withRetries fields.

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): ConsumptionMetric

Parses the JSON object back into a ConsumptionMetric, reading n/a aggregates as null. JSON only.

Link copied to clipboard
open override fun serialize(encoder: Encoder, value: ConsumptionMetric)

Encodes value as a JSON object, emitting aggregates as unit-suffixed formatted strings. JSON only.