store

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelUsageSummary added in v1.12.0

type ModelUsageSummary struct {
	UserID  string
	ModelID string

	TruncatedTimestamp int64

	TotalRequests         int64
	TotalPromptTokens     int64
	TotalCompletionTokens int64
}

ModelUsageSummary is a struct that represents the usage summary for a specific model, user and truncated timestamp.

func ListModelUsageSummaries added in v1.12.0

func ListModelUsageSummaries(
	s *store.Store,
	tenantID string,
	startTime,
	endTime time.Time,
	interval time.Duration,
) ([]*ModelUsageSummary, error)

ListModelUsageSummaries returns the usage summaries for models grouped by user and truncated by the specified interval.

type Summary added in v0.10.0

type Summary struct {
	APIMethod       string
	TotalRequests   int64
	SuccessRequests int64
	FailureRequests int64
	AverageLatency  float64
}

Summary is a struct that represents the summary of the usage data.

func AggregatedUsage added in v1.8.0

func AggregatedUsage(s *store.Store, tenantID string, start, end int64) ([]Summary, error)

AggregatedUsage returns the aggregated usage data for the given tenant and time range.

type UsageByGroup added in v1.3.0

type UsageByGroup struct {
	APIKeyID string
	UserID   string
	ModelID  string

	TotalRequests           int64
	TotalPromptTokens       int64
	TotalCompletionTokens   int64
	AverageLatency          float64
	AverageTimeToFirstToken float64
}

UsageByGroup represents the aggregated usage data grouped by API key, user, and model.

func GetUsagesByGroups added in v1.8.0

func GetUsagesByGroups(s *store.Store, tenantID string, start, end int64) ([]*UsageByGroup, error)

GetUsagesByGroups returns the aggregated usage data by groups for the given tenant and time range.

Jump to

Keyboard shortcuts

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