narrowingtest

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package narrowingtest holds the fixtures the narrowing tests share: the Chinook schema (11 tables) and a fake decision engine standing in for Jev (Scorer). It makes no network call and reads no clock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chinook

func Chinook() []api.CatalogRelation

Chinook returns the 11 relations of the Chinook sample database, as the chat's stored schema lists them.

func ChinookLinks() []narrowing.Link

ChinookLinks returns Chinook's foreign keys.

Types

type Clock

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

Clock is a fake clock: it moves only when told to, so a test sees exact latencies.

func NewClock

func NewClock() *Clock

NewClock starts a fake clock at a fixed instant.

func (*Clock) Advance

func (c *Clock) Advance(d time.Duration)

Advance moves the fake time forward.

func (*Clock) Now

func (c *Clock) Now() time.Time

Now returns the fake time.

type Scorer

type Scorer struct {
	// EngineName is Name(); default "fake-jev".
	EngineName string
	// Probabilities are the relevance probabilities by candidate id; a candidate
	// not listed scores Floor.
	Probabilities map[string]float64
	// ByText, when it has an entry for the question text, replaces Probabilities
	// for that question (a scripted conversation).
	ByText map[string]map[string]float64
	Floor  float64
	// Calibrated is the answer's flag; Jev's are calibrated, an LLM emulator's not.
	Calibrated bool
	// Model and Usage are reported back.
	Model string
	Usage decision.Usage
	// Err, when set, is returned instead of an answer.
	Err error
	// Block makes Score wait for its context to end and return that error, as an
	// engine that does not answer in time does.
	Block bool
	// Delay is how long Score takes on the Clock before it answers.
	Delay time.Duration
	// Clock, when set, is advanced by Delay so tests measure latency without
	// sleeping.
	Clock *Clock
	// Raw, when set, replaces the answers entirely (for malformed results).
	Raw map[string]decision.Answer
	// contains filtered or unexported fields
}

Scorer is a fake decision engine standing in for Jev: a decision.ScoredProvider whose answers, errors and delay are set by the test. It records every request it receives so a test can assert exactly what would have left the machine.

func (*Scorer) Name

func (s *Scorer) Name() string

Name implements decision.ScoredProvider.

func (*Scorer) Requests

func (s *Scorer) Requests() []decision.ScoreRequest

Requests returns a copy of every request received so far.

func (*Scorer) Score

Score implements decision.ScoredProvider.

Jump to

Keyboard shortcuts

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