Documentation
¶
Overview ¶
Package finding is the call that finds the tasks on the photo of a page from the learner's paper: a model sees the photo of the whole page once and gives a box round each task, in pixels of the photo, with the box of the instruction printed above it, and nothing of the page's text. It is the capability task_finding of spec's admission table. The program puts the boxes in the order of the page and turns them into task frames, by which app cuts each task's crop on the device; the learner unpicks a frame or draws one the model missed, so a frame the model gets wrong costs a tap. The learner may ask in words which tasks to take and how to split them: the request goes as data, with the frames on the page, and the answer is still boxes alone. Without a request, a request of its own asks first which way up the page is and how much its lines slope, and the program turns the photo upright before the tasks are found on it.
Index ¶
- Constants
- Variables
- func Fingerprint() string
- func Instructions() string
- func OrientInstructions() string
- func OrientRequestOf(photo provider.Image, width, height int) provider.Request
- func RequestOf(photo provider.Image, width, height int, request string, frames []Frame) provider.Request
- type Box
- type Frame
- type Orientation
- type Task
Constants ¶
const MaxOutputTokens = 8000
MaxOutputTokens is the most a call may write, thinking included: twenty boxes take a few hundred tokens, and the rest is the model's reasoning on a crowded page.
const MaxTasks = 20
MaxTasks is the most tasks a page gives: the 20 attempts BeginPaperAttempts of spec's contract begins at most. The model is asked for no more, and of more the program keeps the first of the page.
const OrientMaxOutputTokens = 2000
OrientMaxOutputTokens is the most the orientation may write, thinking included: its answer takes some 20 tokens, and the rest is the model's reasoning on a page whose text is hard to tell, far less than on the boxes of a crowded page, so a fourth of the finding's bound.
const OrientSchemaName = "page_orientation"
OrientSchemaName is the name of the schema of the orientation, by which a request tells it.
const Version = 5
Version is the version of the prompt. A change to a word a model reads is a new version, and the entry of the list that admitted the prompt admits it no longer. TestFrozenV5 holds it.
Variables ¶
var OrientSchema = map[string]any{ "type": "object", "additionalProperties": false, "required": []string{"top", "tilt"}, "properties": orientProperties, }
OrientSchema is the answer of the orientation every model returns.
var Schema = map[string]any{ "type": "object", "additionalProperties": false, "required": []string{"tasks"}, "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 the photo — the instructions, the label, the text and the schema, whose names the model reads too, of the finding and of the orientation before it. An entry of the list of admitted models holds it (admission.Entry).
func OrientInstructions ¶ added in v0.1.61
func OrientInstructions() string
OrientInstructions are the instructions of every request of the orientation.
func OrientRequestOf ¶ added in v0.1.61
OrientRequestOf is what the orientation asks of a model about a photo, as provider.Photo gives it, of width × height px: the instructions, and the photo after its label and its size. The model, its effort and how many tokens it may write the caller sets.
func RequestOf ¶
func RequestOf(photo provider.Image, width, height int, request string, frames []Frame) provider.Request
RequestOf is what the finding asks of a model about a photo, as provider.Photo gives it, of width × height px: the instructions, the photo after its label and its size, and with the learner's request, the request and the frames, numbered in the order given, which is the page's. The model, its effort and how many tokens it may write the caller sets.
Types ¶
type Box ¶
type Box struct{ X1, Y1, X2, Y2 int }
Box is a box as the model gave it, in pixels of the photo, its corners in order.
type Frame ¶
Frame is a frame on the page as the request names it: its box in pixels of the photo the model sees, and whether the learner drew it.
type Orientation ¶ added in v0.1.61
Orientation is which way up the page lies on the photo, as the model gave it: the side the top of the page faces, and the degrees by which its lines rise to the right once its top is up.
func ReadOrientation ¶ added in v0.1.61
func ReadOrientation(answer string) (Orientation, error)
ReadOrientation takes a model's answer of the orientation apart as strictly as the schema: the side, one of the four, and the tilt, from -maxTilt to maxTilt, and nothing else.
func (Orientation) Turn ¶ added in v0.1.61
func (o Orientation) Turn() int
Turn is the turn, in whole degrees clockwise from -179 to 180, by which the photo is turned for its page to read upright: the quarter turn its top asks, and the tilt, one of less than leastTilt taken as none.
type Task ¶ added in v0.1.66
Task is a task the model found: its box, and the box of the instruction printed above it, zero when the page prints none.