reading

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: 25 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 reading is the reading of a sheet into an observation: a model reads the work as it is written, part by part, and its final answer, without deciding whether it is right. The program gives the verdict on the observation, by the check of the kind number (internal/value), and tells what of it was read under a key. The measurement asks the reading in three conditions: without a key, with the right key and solution, and on correct sheets with a false one; the key goes in a block of data that says it is not what the learner wrote.

Index

Constants

View Source
const (
	KindText    = "text"
	KindDrawing = "drawing"
)

The kinds of a part of the observation: writing, or a drawing told in words.

View Source
const CallKind = "reading"

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

View Source
const MaxOutputTokens = 16000

MaxOutputTokens is the most a reading may write, thinking included: the bound of the runner's calls, runner.MaxOutputTokens, so that the reading the library makes is the one the run of admission measured.

View Source
const Plain = "plain"

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

View Source
const Version = 2

Version is the version of the reading's prompt, which the library reads with: it has the rules of safety for children that every prompt of the platform has.

Variables

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

Schema is the observation every reader returns.

Functions

func FalseKeyed

func FalseKeyed(sh sheets.Chosen) bool

FalseKeyed reports whether a sheet is read with false keys: a correct sheet whose task has them.

func Fingerprint

func Fingerprint() string

Fingerprint names the prompt: the SHA-256 of every word a reader reads besides those of the sheet, its task and its key: the instructions with and without the key, the label of the picture, the text round the task and the key, and the schema, whose names the model reads too. The log of a run keeps it.

func Instructions

func Instructions(withKey bool) string

Instructions are the instructions of a request: base and the rules of safety, and the block of the key when it has one.

func KeyOf

func KeyOf(key string) string

KeyOf is the key of the check of a task's key, or of a false key: its value (sample.KeyOf).

func New

func New(part string, sets []string, chosen []sheets.Chosen, readers []Reader, repeats int, reads Reads) (*runner.Run, error)

New plans a run of the reading over the sheets of a part of one or more sets, by the readers, repeated: it cuts the crops of every sheet and puts the calls in order, repeat by repeat, so that a run cut short has the same repeats of every sheet. Of each sheet, by each reader, as reads says:

  • keys: the finished sheet at 32 px, without a key and with the right key, and on a correct sheet with each false key of its task. A reader that reads once asks only in the first repeat;
  • heights: the finished sheet without a key at 16, 24 and 48 px, a height whose crop is drawn at the height of one before it, 32 px first, left out;
  • states: each state of the sheet, without a key, at 32 px;
  • plain: the finished sheet without a key at 32 px alone, by every reader in every repeat: the run of admission.

The heights and the states are asked in the first repeat, by the readers that do not read once.

func PartsRead

func PartsRead(o *Observation, m Marked) (read, of int)

PartsRead is how many of the parts of writing of the markup that are neither crossed out nor written illegibly on purpose an observation reads exactly as written, compared as squash compares, and how many there are: each part of writing of the observation counts for one part of the markup at most. An illegible part has no text to read, and a reader that guesses it is not right for it. The accuracy of the reading of a sheet is the one over the other.

func ReadsAs

func ReadsAs(o *Observation, text string) bool

ReadsAs reports whether an observation has a part of writing that reads as the text, compared as squash compares: so a part the writer had only begun is read as if it were written whole.

func RecordObservation added in v0.1.8

func RecordObservation(c *CallRecord) *observationv1.Observation

RecordObservation is the observation that the record of a call tells, by the verdict, the reason and the value the run wrote for it, so that what is made of it keeps the rules of the run that judged it: nil for a call that failed or that gave no verdict, the protocol's reason for a reason of the reading or blank, and otherwise the value read.

func Request

func Request(t *sample.Task, sh *Sheet, g *Given) provider.Request

Request is what a reading asks of a model about a sheet of a task, given a key and solution or nil for none: the instructions, the picture after its label, and the text: the size of the picture, the task as the learner sees it, its statement, and the block of the key. The model, its effort, whether it thinks and how many tokens it may write the caller sets.

func RequestOf added in v0.1.16

func RequestOf(statement string, png []byte, width, height int, g *Given) provider.Request

RequestOf is the request of a reading of a crop, given as its PNG and its size, of a task by its statement as the learner reads it: the request the runner asks of a sheet and the library asks of the learner's work alike, so that eval measures the reading the platform makes. The library gives no key.

func SlotVerdict added in v0.1.8

func SlotVerdict(key string, o *observationv1.Observation) (verdict.SlotVerdict, error)

SlotVerdict is module-kit's verdict on the one answer slot of a sheet whose check is number with the key (task.SheetItem), on an observation as the protocol writes it, nil for none: then the slot is unchecked. An error is an observation that is not valid, or a key that is no number.

func ValueOf

func ValueOf(text string) string

ValueOf is the number a written answer gives, as the banks write their keys (sample.ValueOf).

Types

type Call

type Call struct {
	Set       string    `json:"set"`
	Sheet     int       `json:"sheet"`
	Condition Condition `json:"condition"`
	Key       string    `json:"key,omitempty"`
	Reader    string    `json:"reader"`
	Repeat    int       `json:"repeat"`
	Digit     int       `json:"digit"`
	Drawn     int       `json:"drawn"`
	State     int       `json:"state,omitempty"`
}

Call is one call of a run: a sheet by its set and number, a condition, the key given in it as the bank writes it, a reader by its name, the repeat, from 1, the height of digits asked for and the one its crop is drawn at, which is less when the crop would be too large (render.CropOf), and the state of the sheet read, from 1, or none for the finished sheet.

type CallRecord

type CallRecord struct {
	Kind string `json:"kind"`
	Call
	NotAsked bool   `json:"not_asked,omitempty"`
	Answer   string `json:"answer,omitempty"`
	Verdict  string `json:"verdict"`
	Reason   Reason `json:"reason,omitempty"`
	Value    string `json:"value,omitempty"`
	UnderKey Under  `json:"under_key"`
	Error    string `json:"error,omitempty"`
	// Invalid is set when the answer is off the schema: no observation, and the report of the
	// protocol names the call unchecked, UNCHECKED_CAUSE_INVALID.
	Invalid bool `json:"invalid,omitempty"`
	runner.Usage
}

CallRecord tells a call: the answer as the model gave it, the verdict on it and its reason, the value of its answer, what was read under the key, the failure if it failed, and what it took. A call whose request could not be built was not asked, and says so.

type Condition

type Condition string

Condition is what a reading is given besides the sheet and its task: no key, the right key and solution, or a false key and solution.

const (
	NoKey    Condition = "none"
	RightKey Condition = "right"
	FalseKey Condition = "false"
)

The conditions of the reading.

type Given

type Given struct {
	Key      string   `json:"key"`
	Solution []string `json:"solution"`
}

Given is a key and a solution that a reading is given, right or false.

type Log

Log is a run's log read back: the run, its sheets, 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 back, as runner.ReadLog reads a log: every line a record of a kind it knows, the run's first and the end, if there is one, last, and a last line cut off half written left out. A log of another kind of call is refused (runner.ReadRecords).

type Marked

type Marked struct {
	Parts []MarkedPart `json:"parts"`
	Value string       `json:"value"`
}

Marked is the markup of a sheet as the reading compares with it: its parts in the order of reading, and the value of its answer. A part of a sheet of free writing has the kind of its part of the plan; any other part is writing.

func MarkupOf

func MarkupOf(s *sample.Sample, plan *sample.PlanSheet) Marked

MarkupOf is the markup of a sample, with the kinds of its parts from its sheet of the plan, if it has one with as many parts. The value is that of its answer that is not crossed out.

type MarkedPart

type MarkedPart struct {
	Kind       string `json:"kind"`
	Text       string `json:"text"`
	CrossedOut bool   `json:"crossed_out,omitempty"`
	Illegible  bool   `json:"illegible,omitempty"`
	Answer     bool   `json:"answer,omitempty"`
}

MarkedPart is a part of the markup: its kind and text, and whether it is crossed out, illegible or the answer.

type Observation

type Observation struct {
	Parts   []Part   `json:"parts"`
	Results []Result `json:"results"`
}

Observation is what a model read on a sheet: the parts of the work in the order the solution is read, and its final answers. It says nothing of whether the answer is right: the verdict is the program's.

func Read

func Read(answer string) (*Observation, error)

Read takes a model's observation apart as strictly as the schema: the parts and the results, both of them and nothing else, every field of a part and of a result, and each result on a part of the observation. The answer as the model gave it is the run's to keep.

func Rest

func Rest(o *Observation, m Marked) *Observation

Rest is an observation without the parts of writing that read the parts of writing of the markup, matched as PartsRead matches them: what of the observation is left once the markup is read in it.

func Right(m Marked) *Observation

Right is the observation of a reader who is always right, by the markup: what the stub answers. Its parts are those of the markup that are not crossed out, as they are written; its result is the answer, with the value of its writing. A sheet without an answer has no result.

type Part

type Part struct {
	Kind          string   `json:"kind"`
	Text          string   `json:"text"`
	Legible       bool     `json:"legible"`
	OtherReadings []string `json:"other_readings"`
}

Part is a part of the work as it is written: writing, character for character, or a drawing, a number line, a row of things or a scheme, told in a few words with every number and label on it, as the markup tells a drawing; whether it is legible, and how else it could be read.

type Planned

type Planned struct {
	Heights, States, StateCalls int
}

Planned is what a planned run of the reading asks besides the conditions of the key: how many calls read the finished sheets at the other heights of digits, and how many states of the sheets are read, in how many calls.

func PlannedOf

func PlannedOf(r *runner.Run) Planned

PlannedOf counts what a run that New planned asks besides the conditions of the key.

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 and the states.

func Readers

func Readers() []Reader

Readers are the readers, the configurations of the runner by their names. An observation of a sheet comes to about 200 tokens, and Haiku with thinking writes about 300 more; Opus reads each condition once, and neither the other heights nor the states. 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. A configuration without its reader here is a mistake of the code, and Readers panics on it rather than estimate its calls at nothing or repeat it unasked.

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 Reads

type Reads struct {
	Keys, Heights, States, Plain bool
}

Reads are what a run reads of its sheets: the conditions of the key on the finished sheet with its digits 32 px high, keys; the finished sheet without a key at the other heights of digits, heights; and its states without a key, states. The heights and the states are read once, by the readers that do not read once. Plain is the run of admission: the finished sheet without a key at 32 px alone, by every reader in every repeat, Opus too, as the platform reads it; 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, which the report pairs with each other.

func ParseReads

func ParseReads(list string) (Reads, error)

ParseReads reads what a run reads from a list of keys, heights and states, joined by commas.

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 sheet is unreadable: of the observation, or of the value as the check reads it.

const (
	NoResult   Reason = "no_result"
	Results    Reason = "results"
	Illegible  Reason = "illegible"
	Ambiguous  Reason = "ambiguous"
	NotWritten Reason = "not_written"
)

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

func ObservationOf added in v0.1.8

func ObservationOf(o *Observation) (*observationv1.Observation, Reason)

ObservationOf is an observation as the eval protocol writes it: the one answer slot of a sheet, bound anywhere, with the value of the final answer, or the reason the reading gives none, and that reason in tutor's own words, which the log keeps. A nil observation, a failed call, is none: nil, with no reason.

  • no final answer is UNREADABLE_NO_FINAL_ANSWER, no_result, and more than one UNREADABLE_SEVERAL_FINAL_ANSWERS, results;
  • the answer's part illegible is UNREADABLE_ILLEGIBLE, illegible;
  • an answer that could be read as another value is UNREADABLE_AMBIGUOUS, ambiguous, and so is a value not seen in the writing of its part, not_written: the protocol names a value that the reader cannot point to in the writing ambiguous;
  • a value that nothing is left of once it is read, and an empty one, is UNREADABLE_BLANK, with no word of the reading's: module-kit's verdict names it blank;
  • otherwise the value, as it is written.

func Verdict

func Verdict(o *Observation, key string) (verdict.Verdict, Reason)

Verdict is the program's verdict on an observation, against the key of the task's check, the value of the bank's key (KeyOf), whatever key the reading was given: module-kit's, on the observation as the protocol writes it (ObservationOf). No observation, a failed call, is unchecked; a reason of the reading makes it unreadable, with the reading's own word for it; and otherwise the check of the kind number judges the value: correct, not yet right, or unreadable, blank or in none of its notations. A key that is no number is no check module-kit takes, and it gives no verdict, whatever was read: the sheet is unchecked, with no reason. The banks' keys are all numbers, and a test holds them so.

type Result

type Result struct {
	Part        int      `json:"part"`
	Value       string   `json:"value"`
	OtherValues []string `json:"other_values"`
}

Result is a final answer of the work: the number of its part, from 1, the value as it is written, the number of the answer without the unknown, the "=" before it and the words after it, and the other values it could be read as.

type RunRecord

type RunRecord struct {
	Kind          string          `json:"kind"`
	CallKind      string          `json:"call_kind"`
	Time          time.Time       `json:"time"`
	Part          string          `json:"part"`
	Sets          []string        `json:"sets"`
	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"`
}

RunRecord tells the run: its part and sets, its readers and repeats, what it reads, its cap and estimate, and the fingerprint and the version of its prompt.

type Sheet

type Sheet struct {
	PNG  []byte
	Crop *render.Crop
}

Sheet is what a reading shows of a sheet: the PNG of the crop of the work, cut by the rule of the eval protocol with its digits a given height (render.CropOf), and the crop's numbers, without the frames of the groups, which a reading does not show.

func Prepare

func Prepare(strokes []sample.Stroke, digit int) (*Sheet, error)

Prepare cuts and draws what a reading shows of the strokes a sheet shows, with its digits digit px high: the strokes of the finished sheet (render.Shown), or those of a state of it.

type SheetRecord

type SheetRecord struct {
	Kind      string          `json:"kind"`
	Set       string          `json:"set"`
	Sheet     int             `json:"sheet"`
	File      string          `json:"file"`
	Writer    sample.Writer   `json:"writer,omitempty"`
	Task      string          `json:"task"`
	Scenario  sample.Scenario `json:"scenario"`
	Outcome   sample.Outcome  `json:"outcome"`
	Layout    sample.Layout   `json:"layout,omitempty"`
	Key       string          `json:"key"`
	FalseKeys []string        `json:"false_keys"`
	Markup    Marked          `json:"markup"`
	Median    float64         `json:"median"`
	States    []states.State  `json:"states"`
	Policies  states.Policies `json:"policies"`
	// Sample is the ID of the sheet's sample of the protocol, and Truth the truth of its answer
	// slot, for the runner's report; a sheet of tutor-sample v0 has neither.
	Sample string             `json:"sample,omitempty"`
	Truth  []evalsample.Truth `json:"truth,omitempty"`
}

SheetRecord tells a sheet: its set, number and file, who wrote it, its task, scenario and outcome, its layout of free writing, the key of its check and those of its false keys, and its markup: the parts and the value of the answer, by which the report measures the reading. They are the texts of the plan, not the handwriting. It tells, too, h_med of the finished sheet in units, by which its crops are scaled; its states, each with how far the writer had written each part of the markup, whether the run reads them or not; and how many readings each policy of reading on its own would take of it.

type Under

type Under struct {
	Parts  []int `json:"parts,omitempty"`
	Result bool  `json:"result,omitempty"`
}

Under is what of an observation was read under a key and a solution: the parts, by their numbers from 1, and whether the final answer was.

func UnderKey

func UnderKey(o *Observation, m Marked, g Given) Under

UnderKey is what of an observation was read as the given solution or key, though the sheet has something else there:

  • a part of writing whose text, compared as squash compares, is a line of the given solution or the given key, while no part of the markup that is not crossed out has that text;
  • a part that is a drawing, by its numbers in the order they stand, since a drawing told in words is told in other words than the solution's: its numbers are those of a line of the given solution, and of no part of the markup;
  • the final answer, when its value is the given key's and the markup's is not.

Jump to

Keyboard shortcuts

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