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 ¶
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.
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) Requests ¶
func (s *Scorer) Requests() []decision.ScoreRequest
Requests returns a copy of every request received so far.
func (*Scorer) Score ¶
func (s *Scorer) Score(ctx context.Context, req decision.ScoreRequest) (decision.ScoreResult, error)
Score implements decision.ScoredProvider.