inferencetest

package
v0.7.45-dev.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package inferencetest is a fake registry's credits sessions for tests: it opens, renews and ends sessions as a SecureAgentry registry does, and records each call.

Index

Constants

View Source
const (
	SignIn = "agy_fakesigninfortestsonly0000000000000000000000000"
	Token  = "agym_fakesessiontokenfortestsonly"
	Model  = "fake-model-1"
)

SignIn is the registry sign-in the fake accepts; Token prefixes the session tokens it answers. Both are fake values of the real shapes.

Variables

This section is empty.

Functions

func TokenFor

func TokenFor(n int) string

TokenFor is the token the n-th session opened (from 1) was answered.

Types

type Registry

type Registry struct {
	*httptest.Server

	NoCredits bool
	// RenewEverySeconds is what an open answers (0: 900).
	RenewEverySeconds int64
	// Usage is the tokens and credits each session's view reports.
	InputTokens, OutputTokens, Credits int64
	// EndRenewals makes every renewal answer 410, as for a session ended.
	EndRenewals bool
	// contains filtered or unexported fields
}

Registry is the fake. Set NoCredits before a call to answer 402.

func New

func New(t *testing.T) *Registry

New starts a fake registry, closed when the test ends.

func (*Registry) Ended

func (r *Registry) Ended() []string

func (*Registry) EndedAt

func (r *Registry) EndedAt(id string) time.Time

EndedAt is when session id was ended (zero if it was not).

func (*Registry) Opened

func (r *Registry) Opened() []string

Opened, Renewed and Ended are the calls so far.

func (*Registry) Renewed

func (r *Registry) Renewed() []string

func (*Registry) RenewedAt

func (r *Registry) RenewedAt() []time.Time

RenewedAt is when each renewal arrived.

func (*Registry) SetEndRenewals

func (r *Registry) SetEndRenewals(v bool)

SetEndRenewals sets EndRenewals while the fake is serving.

Jump to

Keyboard shortcuts

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