Documentation
¶
Overview ¶
Package streamtiming measures arrival of streamed model output at the receiver.
Index ¶
Constants ¶
const ( StatusMeasured = "measured" StatusBufferedBurst = "bufferedBurst" StatusHiddenReasoning = "hiddenReasoning" StatusInsufficientEvidence = "insufficientEvidence" StatusInterrupted = "interrupted" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FinalizeInput ¶
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer belongs to one stream. Its owner calls the methods serially.
func NewObserver ¶
NewObserver starts timing now. Pass nil to use time.Now.
func (*Observer) Finalize ¶
func (o *Observer) Finalize(in FinalizeInput) Snapshot
Finalize returns a detached snapshot. DecodeTokens and DecodeWindowMs describe the candidate interval even when its speed is rejected as a burst.
func (*Observer) MarkHeader ¶
func (o *Observer) MarkHeader()
func (*Observer) ObserveFrame ¶
ObserveFrame accepts the JSON data of one SSE event (or Gemini chunk). Multiple signals in a frame share one arrival and one gap observation.
func (*Observer) ObserveSignal ¶
func (o *Observer) ObserveSignal(kind SignalKind)
ObserveSignal observes a preclassified event. Without payload sizes the concentration check weights each content event equally.
type SignalKind ¶
type SignalKind uint8
const ( SignalReasoningStart SignalKind = 1 << iota SignalReasoningDelta SignalHiddenReasoning SignalReasoningSummary SignalTextDelta SignalToolDelta )
type Snapshot ¶
type Snapshot struct {
HeaderMs *int64 `json:"headerMs"`
FirstReasoningMs *int64 `json:"firstReasoningMs"`
FirstTextMs *int64 `json:"firstTextMs"`
LastContentMs *int64 `json:"lastContentMs"`
MaxContentGapMs *int64 `json:"maxContentGapMs"`
ReasoningEvidence string `json:"reasoningEvidence"`
DecodeTokens int64 `json:"decodeTokens"`
DecodeWindowMs *int64 `json:"decodeWindowMs"`
DecodeTPS *float64 `json:"decodeTps"`
DecodeStatus string `json:"decodeStatus"`
}
Snapshot owns its values. Missing observations marshal as null, including the maximum gap before two content frames have arrived.