recorder

package
v1.23.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache added in v0.0.2

type Cache interface {
	IncrementCounter(keyId string, rateLimitUnit key.TimeUnit, incr int64) error
}

type CostEstimator

type CostEstimator interface {
	EstimatePromptCost(model string, tks int) (float64, error)
	EstimateCompletionCost(model string, tks int) (float64, error)
}

type EventsStore added in v0.0.9

type EventsStore interface {
	InsertEvent(e *event.Event) error
}

type Recorder

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

func NewRecorder

func NewRecorder(s, us Store, c, uc Cache, ce CostEstimator, es EventsStore) *Recorder

func (*Recorder) RecordEvent added in v0.0.9

func (r *Recorder) RecordEvent(e *event.Event) error

func (*Recorder) RecordKeySpend

func (r *Recorder) RecordKeySpend(keyId string, micros int64, costLimitUnit key.TimeUnit) error

func (*Recorder) RecordUserSpend added in v1.18.0

func (r *Recorder) RecordUserSpend(userId string, micros int64, costLimitUnit key.TimeUnit) error

type Store

type Store interface {
	IncrementCounter(keyId string, incr int64) error
}

Jump to

Keyboard shortcuts

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