Documentation
¶
Overview ¶
Package tutorstub is the stub of tutor in api's dev mode (R66; R146 spec): it stands behind the ports through which api calls tutor — the reading of a sheet and the tutor's words — so that a run of the path on the dev projects calls no provider and costs nothing. Admission and the prices stay tutor's own, on the real table, by the gate the dev mode builds with the stub's adapter (admission.StubAdapters); only the calls are the stub's.
The stub reads a sheet by the shape of its crop: wider than tall is the right value, taller than wide a wrong one — the slot's first trap value, or the first value its check holds not right —, and square is illegible. It finds the values by module-kit's verdict on the instance, the key with it, which the stub alone is given: tutor sees the open view (R67 spec). Its words are questions of its own, which pass the leak check and the form check. Each call spends what tutor expects a call of its kind to cost on its route, so that the quota runs out as on the models.
api takes the stub off a deployment alone: the configuration refuses it there, as R32 refuses the emulator of the sign-in service.
Index ¶
Constants ¶
const Model = "stub"
Model is the model the stub's usage names in the log's line ai_usage, so that no line of it is taken for a model's.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gate ¶
type Gate interface {
Words(withWork bool, category formatv0.AgeCategory, ownKeyProvider string) bool
Price(call tutor.Call, route tutor.Route) tutor.CallPrice
}
Gate is what the stub asks of the gate of admission: whether the tutor's words are admitted, and what a call is expected to cost.
type Stub ¶
type Stub struct {
// contains filtered or unexported fields
}
Stub reads sheets and words the tutor's words in place of tutor.
func (*Stub) ReadSheet ¶
func (s *Stub) ReadSheet(ctx context.Context, r tutor.SheetReading, task formatv0.Task) tutor.SheetRead
ReadSheet reads the crop of r by its shape, on task, the instance whose open view r holds: both readers read the same, so module-kit joins them as they are. A value stands with the crop box of the whole crop, in thousandths, and a reason with none, as an observation has them (R53 spec). A task with no answer slot bound anywhere, a crop that is no PNG, or a request whose context ended while the stub looked for a value, fails, as tutor's reading does.
func (*Stub) TellWords ¶
func (s *Stub) TellWords(_ context.Context, w tutor.WordsRequest) tutor.WordsAnswer
TellWords words a question of the stub's own in the language of w: the first one of its list that w has not asked yet, so "explain differently" gets other words, and, once all were asked, the list again from its start. A language the stub has no list of gets English, which the form check turns down into the rung's fallback text.