correct

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: 21 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 correct is the call of the words after a correct answer: once the program has found the final answer right, a model praises a step of the solution and asks which technique helped, in words of a form of their own (words.Correct). It is a call of its own and an AI capability of its own, correct_answer_words, not a rung of the hint ladder. The model sees the crop of the work, or none when the task's answer slots are bound choice alone and no work goes with the request, the task, its key, its solution and its techniques, in a block of data, the language and the presentation style. The program checks the words for a leak and their form before they reach the learner, and gives no words when they fail: the call only words them.

Index

Constants

View Source
const (
	CasesFormat  = "tutor-correct-cases"
	CasesVersion = 1
)

CasesFormat names the file of the cases, and CasesVersion is its version.

View Source
const (
	WithheldFailed = "failed"
	WithheldLeak   = "leak"
	WithheldForm   = "form"
)

The causes for which the learner reads no words: the call failed or its answer is off the schema, the leak check found the key or a leak phrase in the words, or they break their form. With a leak and the form broken at once, the cause is the leak. There is no fallback text of these words: api then gives none (attempt.proto spec, GetCorrectAnswerWordsResponse).

View Source
const CallKind = "correct"

CallKind is the kind of call of the words after a correct answer, as its log tells it (runner.CallKind).

View Source
const Version = 1

Version is the version of the prompt of the words after a correct answer, which the library and the runner ask alike (RequestOf). A version is frozen once measured, and the admitted one is version 1: a change to a word a model reads is a new version, measured anew. TestFrozenV1 holds it.

Variables

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

Schema is the answer every model returns.

Functions

func Fingerprint

func Fingerprint() string

Fingerprint names the prompt: the SHA-256 of every word a model reads besides those of the sheet and its task — with the names of the languages measured, as golang.org/x/text gives them —: the instructions, the label of the picture, the text round the task and its data, the style of the measurement and the schema, whose names the model reads too. The log of a run keeps it, and an entry of the list of admitted models (admission.Entry).

func Instructions

func Instructions() string

Instructions are the instructions of every request.

func New

func New(part, set string, chosen []sheets.Chosen, tutors []hint.Tutor, repeats int, cs *Set) (*runner.Run, error)

New plans a run of the words over the cases of a set, on the sheets of a part of one set, each with its answer right, by the tutors, repeated: it cuts the crop of every sheet at 32 px and puts the calls in order, repeat by repeat, case by case, tutor by tutor, so that a run cut short has the same repeats of every case. A sheet whose answer is not right has no such words, and is refused; so is a case of a sheet the part does not hold. The run tells only the sheets its cases are of. A call without the work takes no crop's tokens.

func Read

func Read(answer string) (string, error)

Read takes a model's answer apart as strictly as the schema: the words, and nothing else; empty words are no answer, and fail the call, so that the judge has every word that came. Whether they keep their form and leak nothing the program checks (words.Correct; leak.Check).

func RequestOf

func RequestOf(p Prompt) (provider.Request, error)

RequestOf is what the words ask of a model: the instructions, the crop after its label when there is one, and the text: the size of the crop or that there is none, the task, the language, the words it allows (words.HintWords, the limit of the form of these words) and the style, and the block of the task's data. The library and the runner ask it alike, so that eval measures the words the platform asks. A language whose tag cannot be read is refused. The model, its effort, whether it thinks and how many tokens it may write the caller sets.

func Right(sh sheets.Chosen) bool

Right reports whether a sheet is one the words are asked of: one whose answer is right.

Types

type Call

type Call struct {
	Set    string      `json:"set"`
	Sheet  int         `json:"sheet"`
	Lang   sample.Lang `json:"lang"`
	Tutor  string      `json:"tutor"`
	Repeat int         `json:"repeat"`
	Case   string      `json:"case"`
}

Call is one call of a run: a sheet by its set and number, the language of the words, a tutor by its name, the repeat, from 1, and the case by its ID.

type CallRecord

type CallRecord struct {
	Kind string `json:"kind"`
	Call
	NotAsked      bool     `json:"not_asked,omitempty"`
	Answer        string   `json:"answer,omitempty"`
	Words         string   `json:"words,omitempty"`
	Error         string   `json:"error,omitempty"`
	LeakedKeys    []string `json:"leaked_keys,omitempty"`
	LeakedPhrases []string `json:"leaked_phrases,omitempty"`
	Form          []string `json:"form,omitempty"`
	Withheld      string   `json:"withheld,omitempty"`
	Shown         string   `json:"shown,omitempty"`
	Gendered      []string `json:"gendered,omitempty"`
	NoteEcho      []string `json:"note_echo,omitempty"`
	runner.Usage
}

CallRecord tells a call: the answer as the model gave it, its words, the failure if it failed, and what it took; the words checked: the keys and, apart, the leak phrases the leak check found in them, what they break of their form, why the learner reads none, if so, and what the learner reads; and the measures code counts: the words by which the rough search finds the learner's sex told, and what the words take up of the note at the side. A call whose request could not be built was not asked, and says so.

func (*CallRecord) Came

func (c *CallRecord) Came() bool

Came is whether the call's words came: it was asked and gave an answer on the schema.

func (*CallRecord) Leaked

func (c *CallRecord) Leaked() bool

Leaked is whether the leak check found a key or a leak phrase in the call's words.

type Case

type Case struct {
	ID         string        `json:"id"`
	Kind       CaseKind      `json:"kind"`
	Sheet      int           `json:"sheet"`
	Lang       sample.Lang   `json:"lang"`
	Work       bool          `json:"work"`
	Techniques []string      `json:"techniques"`
	Note       string        `json:"note"`
	NoteKind   hint.NoteKind `json:"note_kind"`
}

Case is a call of the words: its ID and kind; the sheet of the plan by its number; the language; whether the work goes with it; the techniques of the task, none for a task that names none; and on a sheet with a note, the note's text, as the plan writes it, and its kind.

type CaseKind

type CaseKind string

CaseKind is what a case tries.

const (
	// CaseWork is the words with the work.
	CaseWork CaseKind = "work"
	// CaseChoice is the words without the work, as for a task whose answer slots are bound choice
	// alone.
	CaseChoice CaseKind = "choice"
	// CaseNote is the words with the work, on a sheet with a note at the side.
	CaseNote CaseKind = "note"
)

The kinds of case.

func CaseKinds

func CaseKinds() []CaseKind

CaseKinds are the kinds of case, in their order.

type Cases

type Cases struct {
	Format  string `json:"format"`
	Version int    `json:"version"`
	Plan    string `json:"plan"`
	Seed    uint64 `json:"seed"`
	Cases   []Case `json:"cases"`
}

Cases is the file of the cases: the plan of the sheets they are of, by its file's name, the seed that made them and the cases, in the order a run asks them.

func ReadCases

func ReadCases(r io.Reader) (*Cases, error)

ReadCases reads a file of cases strictly: no field it does not know, no list left null, and one value only.

func (*Cases) Check

func (c *Cases) Check(plan *sample.Plan, bank *sample.Bank) error

Check checks the cases against the plan of their sheets and its bank: every ID once; a kind and a language the set knows; a sheet of the plan whose answer is right, of a task of the bank; the work with every case but one of choice; and a note, of a kind the set knows, on a case of a note alone, the very text of the sheet's note at the side, its last part.

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 words after a correct answer 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 Prompt

type Prompt struct {
	Statement     string
	PNG           []byte
	Width, Height int
	Key           string
	Solution      []string
	Techniques    []string
	Language      string
	Style         string
}

Prompt is what a request of the words holds: the task as the learner reads it; the crop of the work, as PNG with its size, or none, when the task's answer slots are bound choice alone; the key and the solution; the techniques of the task, none when it names none; the language of the words, by its tag; and the presentation style, only what changes the words.

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"`
	Tutors        []hint.TutorRecord `json:"tutors"`
	Repeats       int                `json:"repeats"`
	Langs         []sample.Lang      `json:"langs"`
	Style         string             `json:"style"`
	MaxUSD        float64            `json:"max_usd"`
	Estimate      runner.Estimate    `json:"estimate"`
	Prompt        string             `json:"prompt"`
	PromptVersion int                `json:"prompt_version"`
	CasesFile     string             `json:"cases_file"`
	CasesSHA256   string             `json:"cases_sha256"`
	Cases         []Case             `json:"cases"`
	CasesLeftOut  int                `json:"cases_left_out,omitempty"`
}

RunRecord tells the run: its part and set, its tutors and repeats, the languages and style of its words, its cap and estimate, the fingerprint and the version of its prompt, and the file of its cases, by its name and SHA-256, the cases it asks and how many of the file's it left out.

type Set

type Set struct {
	File, SHA256 string
	Cases        *Cases
	LeftOut      int
}

Set is the set a run asks: the file of its cases, by its name and SHA-256, and the cases it asks, checked against the plan of the sheets they are of (Cases.Check), and how many of the file's it left out.

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"`
	Statement    string          `json:"statement"`
	SearchedKeys []string        `json:"searched_keys"`
	Phrases      []string        `json:"leak_phrases"`
	Digit        int             `json:"digit"`
	Drawn        int             `json:"drawn"`
	Width        int             `json:"width"`
	Height       int             `json:"height"`
}

SheetRecord tells a sheet: its set, number and file, who wrote it, its task, scenario and outcome, its layout of free writing, the key, the statement, what the leak check searches the words for — the key, unless the statement shows it, and apart from it the leak phrases —, and its crop: the height of digits asked for and drawn at, and the size. The texts are the plan's and the bank's, not handwriting.

Jump to

Keyboard shortcuts

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