workbook

package
v0.1.74 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package workbook is the measurement of the workbook: its pages, which code draws in memory from eval/workbook.json, and the crop of each filled box, which is all a reading of the page sees: the ink of the box's strokes alone, cut by the rule of the eval protocol, without the box's frame and the print of its line. A blank box gives no crop.

Index

Constants

View Source
const (
	Version         = 3
	MirroredVersion = 2
)

Version is the version of the prompt of the reading of the workbook, frozen before the test of the run that measures it; it has the rules of safety for children that every prompt of the platform has. MirroredVersion is the first version whose reader marks a digit written mirrored, and the box is then unreadable, so that the learner writes it again; an earlier one reads it as that digit, and Want judges its logs so.

View Source
const CallKind = "workbook"

CallKind is the kind of call of the reading of the workbook, as its log tells it (runner.CallKind).

View Source
const Plain = "plain"

Plain is the name of the reads of a run of admission, as Names and the log write it.

Variables

View Source
var Schema = map[string]any{
	"type":                 "object",
	"additionalProperties": false,
	"required":             []string{"cells"},
	"properties":           schemaProperties,
}

Schema is the answer every reader of a page returns.

Functions

func Fingerprint

func Fingerprint() string

Fingerprint names the prompt: the SHA-256 of every word a reader reads besides those of the crops and the lines of the items: the instructions with and without the captions, the labels, the text and the schema. The log of a run keeps it.

func Instructions

func Instructions(captioned bool) string

Instructions are the instructions of a request: base, and the block of the captions when it has them.

func Items

func Items(pg *sample.WorkbookPage, boxes []Box) []verdict.Verdict

Items are the verdicts of the items of a page, each made of the verdicts of its boxes (verdict.ItemOf), in the order of the page.

func ItemsOf added in v0.1.9

func ItemsOf(pr *PageRecord) []formatv0.Item

ItemsOf are the items of a page's task as its record tells them: each item's boxes, with their checks, as the line of a workbook holds them, without the text of the line, which no verdict reads. The report joins two readings of the page by them, with no file of the workbook.

func New

func New(part, file, dir string, seed uint64, pages []*evalsample.Page, readers []Reader, repeats int, reads Reads) (*runner.Run, error)

New plans a run of the reading over the pages of a part of the workbook, as their samples in the directory dir hold them, drawn from the seed, by the readers, repeated: it cuts the crops of every page once, from the strokes of its sample's boxes, and puts the calls in order, repeat by repeat, so that a run cut short has the same repeats of every page. A page with no filled box goes to no model: its boxes are blank, and their verdicts need no call. Of each page, by each reader, as reads says:

  • bare: the crops at 32 px, bare. A reader that reads once asks only in the first repeat;
  • captions: the crops at 32 px, bare and captioned, so too;
  • heights: the bare crops at 16, 24 and 48 px, in the first repeat, by the readers that do not read once;
  • plain: the crops at 32 px, bare, in every repeat, by every reader, the one that reads once too.

func Pages

func Pages(wb *sample.Workbook, part string) []*sample.WorkbookPage

Pages are the pages of a part of the workbook: dev or test, or every page for all.

func RecordObservation added in v0.1.9

func RecordObservation(pr *PageRecord, c *CallRecord) *observationv1.Observation

RecordObservation is the observation of a page that the record of a call tells, by the verdict, the reason and the text of each box the run wrote, so that what is made of it keeps the rules of the run that judged it: nil for a call that failed, or whose boxes are unchecked; each blank box UNREADABLE_BLANK, a reason of the reading the protocol's, and otherwise the text read.

func Request

func Request(pg *sample.WorkbookPage, cells []Cell, c Condition) provider.Request

Request is what a reading asks of a model about the filled boxes of a page of the measurement, in a condition: RequestOf of the crops of its cells, with the line of each item.

func RequestOf added in v0.1.24

func RequestOf(crops []Crop, c Condition) provider.Request

RequestOf is what a reading asks of a model about the crops of the filled boxes of a page, in a condition: the instructions, each crop after its label, and the text. The library asks it bare, as the learner's page shows the model no line, and the runner alike, so that eval measures the reading the platform asks. The model, its effort, whether it thinks and how many tokens it may write the caller sets.

Types

type Box

type Box struct {
	Item    int             `json:"item"`
	Slot    int             `json:"slot"`
	Text    *string         `json:"text,omitempty"`
	Verdict verdict.Verdict `json:"verdict"`
	Reason  Reason          `json:"reason,omitempty"`
	Trap    string          `json:"trap,omitempty"`
}

Box is the verdict of a box of a page: its place, the answer read in it, and its verdict with the reason or the trap.

func ObservationOf added in v0.1.24

func ObservationOf(places []Place, read []Reading) (*observationv1.Observation, []Box)

ObservationOf is the observation of a page from what a model read in its boxes, over every box of the page in the task's order (observationOf): a blank box is unreadable, blank, without a cell; a filled one takes what its one cell read; an answer with no cell for a filled box, or two, is no observation. The library makes it of the open view, and the runner of its page, alike.

func Verdicts

func Verdicts(pg *sample.WorkbookPage, read []Reading) []Box

Verdicts are the program's verdicts on the boxes of a page, in its order, from what a model read in them, nil for a failed call: module-kit's, on the observation of the page as the eval protocol writes it, each with the reason in the reading's own words, which the log keeps:

  • a blank box, which no model is shown, is unreadable, blank;
  • a box read blank is unreadable, blank; one with a digit read mirrored, unreadable, mirrored, ambiguous to the protocol; one read illegible or with other readings, unreadable;
  • otherwise the box's check judges the answer: correct, not yet right with its trap, or unreadable when the answer is not in the notation of its kind;
  • a failed call is no observation, and neither is an answer with no cell for a filled box, or two: every box of the page is then unchecked, the blank ones too, and a box without its cell, or with two, is missing, or twice.

A cell of a place the page has no filled box for is passed over: it judges nothing.

type BoxRecord

type BoxRecord struct {
	Item     int                     `json:"item"`
	Slot     int                     `json:"slot"`
	Kind     sample.CheckKind        `json:"check"`
	Form     formatv0.CheckForm      `json:"form,omitempty"`
	Key      string                  `json:"key"`
	Scenario sample.BoxScenario      `json:"scenario"`
	Written  *string                 `json:"written"`
	Crossed  *string                 `json:"crossed,omitempty"`
	Fraction *sample.FractionWriting `json:"fraction,omitempty"`
	Verdict  verdict.Verdict         `json:"verdict"`
	Reason   Reason                  `json:"reason,omitempty"`
	Trap     string                  `json:"trap,omitempty"`
	// TrapValues are the trap values of its check, by which the report joins two readings of
	// the page as module-kit would, with no file of the workbook.
	TrapValues []sample.TrapValue `json:"trap_values,omitempty"`
	Width      int                `json:"width,omitempty"`
	Height     int                `json:"height,omitempty"`
}

BoxRecord tells a box as code wrote it: its place, its check — kind, form and key — its scenario, what is written in it and crossed out, how a fraction is written, the verdict the box's check gives the value written, with its reason or trap, and the size of its crop at 32 px, none for a blank box. The verdict a right reading comes to by the prompt of the run is Want of it. They are the texts of the file of the workbook, not the handwriting.

type Call

type Call struct {
	Page      int       `json:"page"`
	Condition Condition `json:"condition"`
	Reader    string    `json:"reader"`
	Repeat    int       `json:"repeat"`
	Digit     int       `json:"digit"`
}

Call is one call of a run: a page by its number, a condition, a reader by its name, the repeat, from 1, and the height of digits of its crops.

type CallRecord

type CallRecord struct {
	Kind string `json:"kind"`
	Call
	NotAsked bool              `json:"not_asked,omitempty"`
	Answer   string            `json:"answer,omitempty"`
	Boxes    []Box             `json:"boxes"`
	Items    []verdict.Verdict `json:"items"`
	Error    string            `json:"error,omitempty"`
	// Invalid is set when the answer is off the schema, which the report of the protocol names
	// unchecked, UNCHECKED_CAUSE_INVALID.
	Invalid bool `json:"invalid,omitempty"`
	runner.Usage
}

CallRecord tells a call: the answer as the model gave it, the verdict of each box of the page and of each item, the failure if it failed, and what it took. A call whose request could not be built was not asked, and says so.

type Cell

type Cell struct {
	Item, Slot int
	Box        sample.WorkbookBox
	Crop       *render.Crop
	PNG        []byte
}

Cell is a filled box of a page as a reading sees it: the places of its item and of the box among the item's boxes, from 1, the box, and the crop of its strokes with its PNG.

func Cells

func Cells(pg *sample.WorkbookPage, seed uint64, digit int) ([]Cell, error)

Cells draws a page from the seed and cuts the crop of each filled box with its digits digit px high, in the order of the page: by item, then by box. A blank box is not among them.

func CellsOf

func CellsOf(drawn *synth.Page, pg *sample.WorkbookPage, digit int) ([]Cell, error)

CellsOf cuts the crop of each filled box of a page drawn, as Cells does: a page drawn once gives its cells at every height.

type Condition

type Condition string

Condition is what a reading of a page is given besides the crops: the bare crops, or each with the line of its item as the learner sees it, a caption.

const (
	Bare      Condition = "bare"
	Captioned Condition = "captioned"
)

The conditions of the reading of a page.

type Crop added in v0.1.24

type Crop struct {
	Item, Slot int
	PNG        []byte
	Line       string
}

Crop is the crop of a filled box as a request shows it: the places of its item and of the box among the item's boxes, from 1, its PNG, and the line of its item, which only a captioned request shows.

type Log

Log is a run's log read back: the run, its pages, in the field Sheets of the runner's records, its calls in the order they were made, and how the run ended, or nil when the log stops before the end.

func ReadLog

func ReadLog(r io.Reader) (*Log, error)

ReadLog reads the log of a run of the reading of the workbook back, as runner.ReadLog reads a log. A log of another kind of call is refused (runner.ReadRecords).

type PageRecord

type PageRecord struct {
	Kind  string      `json:"kind"`
	Page  int         `json:"page"`
	Part  string      `json:"part"`
	Boxes []BoxRecord `json:"boxes"`
	// Sample is the ID of the page's sample, and Truth the truth of each filled box, in the
	// task's order: for the runner's report.
	Sample string             `json:"sample,omitempty"`
	Truth  []evalsample.Truth `json:"truth,omitempty"`
}

PageRecord tells a page: its number and part, and its boxes.

type Place added in v0.1.24

type Place struct {
	Item, Slot int
	Filled     bool
}

Place is a box of a page in the task's order: the places of its item and of the box, from 1, and whether the learner filled it.

type Reader

type Reader = runner.Reader

Reader is a configuration of the reader: a configuration of the runner, the output tokens a call is expected to take, for the estimate, and whether it reads once whatever the repeats, as Opus does in the reduced matrix, without the other heights of digits.

func Readers

func Readers() []Reader

Readers are the readers, the configurations of the runner by their names. The cells of a page of ten filled boxes come to about 400 tokens; Haiku with thinking writes about 500 more, and Opus at high effort about 800. Opus reads each condition once, and not the other heights (runner.ReadersOf). The four the extended measurement adds are estimated so: Opus at medium as at high, Sonnet with thinking between Haiku and Opus, without thinking as Haiku without it, and Haiku at medium above Haiku at low.

type ReaderRecord

type ReaderRecord = runner.ReaderRecord

ReaderRecord is a reader as the run's record tells it: its model and prices, and whether it reads once.

type Reading

type Reading struct {
	Item          int      `json:"item"`
	Slot          int      `json:"slot"`
	Text          string   `json:"text"`
	Legible       bool     `json:"legible"`
	OtherReadings []string `json:"other_readings"`
	Mirrored      bool     `json:"mirrored"`
	Blank         bool     `json:"blank"`
}

Reading is what a model read in a box: its place, the answer as it is written, whether it is legible, how else it could be read, whether a digit of it is written mirrored, and whether the box is blank.

func Read

func Read(answer string) ([]Reading, error)

Read takes a model's answer apart as strictly as the schema: the cells and nothing else, every field of each. Which cells it holds, Verdicts weighs; the answer as the model gave it is the run's to keep.

func Right(cells []Cell) []Reading

Right is the answer of the reader who is always right, by what code wrote in the filled boxes of the page: each read as written, legible, with no other reading, and marked mirrored when code drew a digit of it mirrored.

type Reads

type Reads struct {
	Bare, Captions, Heights, Plain bool
}

Reads are what a run reads of its pages: the pages at 32 px, bare and captioned, captions; the bare pages at 32 px alone, bare, as the platform reads them, with no line of the item; and the bare pages at the other heights of digits, heights, read once, by the readers that do not read once. Plain is the run of admission: the bare pages at 32 px alone, by every reader in every repeat, Opus too, as the admission run of a sheet reads (reading.Plain); it goes with nothing else. A reader that reads once in a measurement keeps the mark in its record: it is the strong reader of the pair.

func ParseReads

func ParseReads(list string) (Reads, error)

ParseReads reads what a run reads from a list of bare, captions and heights, joined by commas, or of plain alone.

func (Reads) Names

func (r Reads) Names() []string

Names are what a run reads, by name, in their order.

type Reason

type Reason string

Reason is why a box is unreadable or unchecked: of the reading, or of the value as the check reads it.

const (
	Illegible Reason = "illegible"
	Ambiguous Reason = "ambiguous"
	// Mirrored is a box with a digit the reader says is written mirrored: ambiguous by the rule of
	// a digit written mirrored, and the learner writes it again.
	Mirrored Reason = "mirrored"
	// Missing is a filled box the answer has no cell for, and Twice one it has two cells for: either
	// makes the answer no valid observation, and every box of the page unchecked, a failure of the
	// reading.
	Missing Reason = "missing"
	Twice   Reason = "twice"
)

The reasons of the reading; the value's are module-kit's, verdict.Blank and verdict.Notation.

type RunRecord

type RunRecord struct {
	Kind          string          `json:"kind"`
	CallKind      string          `json:"call_kind"`
	Time          time.Time       `json:"time"`
	Part          string          `json:"part"`
	File          string          `json:"file"`
	Dir           string          `json:"dir,omitempty"`
	Seed          uint64          `json:"seed"`
	Readers       []ReaderRecord  `json:"readers"`
	Repeats       int             `json:"repeats"`
	Reads         []string        `json:"reads"`
	MaxUSD        float64         `json:"max_usd"`
	Estimate      runner.Estimate `json:"estimate"`
	Prompt        string          `json:"prompt"`
	PromptVersion int             `json:"prompt_version"`
	// Runner and ModuleKit are the versions of the build that ran, and Refused the samples it
	// refused: what the runner's report takes of the run.
	Runner    string           `json:"runner,omitempty"`
	ModuleKit string           `json:"module_kit,omitempty"`
	Refused   []runner.Refused `json:"refused,omitempty"`
	// Set names the set of the pages where they are not the samples of the file's directory, as
	// canvas's synthetic samples are not; "" names it by the file.
	Set string `json:"set,omitempty"`
}

RunRecord tells the run: its part, the file of the workbook, the directory of its pages' samples and the seed they were drawn from, its readers and repeats, what it reads, its cap and estimate, and the fingerprint and the version of its prompt.

type Slot added in v0.1.8

type Slot struct {
	Verdict verdict.Verdict
	Reason  Reason
	Trap    string
}

Slot is the verdict of a box as the log writes it: module-kit's verdict, why it is unreadable or unchecked, in the reading's words or module-kit's, and the trap of the value by its ID.

func SlotOf added in v0.1.8

func SlotOf(v verdict.SlotVerdict) Slot

SlotOf is module-kit's verdict of a box as the log writes it.

func Want

func Want(scenario sample.BoxScenario, of Slot, version int) Slot

Want is the verdict a right reading of a box of a scenario comes to by the prompt of a version, from the verdict of the value written in it (sample.WorkbookBox.Verdict): that verdict, but from MirroredVersion on, for a box with a digit written mirrored, unreadable, mirrored, so that the learner writes it again. The run and its report both judge a reading by it.

Jump to

Keyboard shortcuts

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