routingquality

package
v0.10.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StampOutcome

func StampOutcome(rec *Record, outcome *Outcome)

StampOutcome copies outcome into rec's override payload.

Types

type Bucket

type Bucket struct {
	PromptFeatureBucket string
	Axis                string
	Match               bool
	Count               int

	SuccessOutcomes   int
	StalledOutcomes   int
	FailedOutcomes    int
	CancelledOutcomes int
	UnknownOutcomes   int
}

Bucket is one cell in the override-class pivot.

type Metrics

type Metrics struct {
	AutoAcceptanceRate       float64
	OverrideDisagreementRate float64
	OverrideClassBreakdown   []Bucket
	TotalRequests            int
	TotalOverrides           int
}

Metrics is the internal routing-quality aggregate.

func ComputeMetrics

func ComputeMetrics(totalRequests int, overrides []OverrideData) Metrics

ComputeMetrics aggregates routing-quality metrics from request and override counts.

func ComputeMetricsFromRecords

func ComputeMetricsFromRecords(records []*Record) Metrics

ComputeMetricsFromRecords aggregates the store-side record shape directly.

type Outcome

type Outcome struct {
	Status string
}

Outcome is the internal terminal outcome for an override.

type OverrideData

type OverrideData struct {
	AxesOverridden []string
	MatchPerAxis   map[string]bool
	PromptFeatures PromptFeatures
	Outcome        *Outcome
}

OverrideData is the internal representation of a service override event.

type PromptFeatures

type PromptFeatures struct {
	EstimatedTokens *int
	RequiresTools   bool
	Reasoning       string
}

PromptFeatures is the internal prompt-feature slice used for buckets.

type Record

type Record struct {
	// contains filtered or unexported fields
}

Record is one entry in the in-process routing-quality store.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a bounded in-memory ring of routing-quality records. It is safe for concurrent use.

func NewStore

func NewStore(cap int) *Store

NewStore returns an empty store with the given record cap.

func (*Store) RecordRequest

func (s *Store) RecordRequest(at time.Time, override *OverrideData) *Record

RecordRequest appends a request to the store and returns the freshly allocated record. override may be nil for the no-override case.

func (*Store) SnapshotRecent

func (s *Store) SnapshotRecent(maxN int, since time.Time) []*Record

SnapshotRecent returns up to maxN of the most recent records, optionally filtered by since.

func (*Store) SnapshotWindow

func (s *Store) SnapshotWindow(start, end time.Time) []*Record

SnapshotWindow returns records whose timestamps fall within [start, end).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL