Documentation
¶
Overview ¶
Package comments is the model stage that reads what a video's top comments say about it, when a person asks on the video's review card. It runs once per item and never as a batch: the route queues one task, a worker reads the source's top comments through the source's own reader and asks one model call through modelstage's dispatch-once protocol, and the answer is kept as the output's answer. A model wrote that answer over strangers' comments, so it ships as outsider text alone, and the comments themselves are not kept.
Index ¶
- Constants
- func NewHandler(port modelport.Port, readers Readers, settings modelstage.Settings, ...) worker.Handler
- func Reads(mediaType string) bool
- func Register(mediaType string)
- func Routes(st *store.Store, log *slog.Logger) server.Routes
- func StateOf(r store.ItemRecords, claimed map[string]bool) *server.ReviewComments
- type Answer
- type Read
- type Reader
- type Readers
- type Source
- type Thread
Constants ¶
const ( // Capability is the capability of every comments task. Capability = store.StageComments // Producer names the stage's outputs, whose version is the prompt's. Producer = "comments" // SchemaVersion is the route's answer, schemas/item-comments.schema.json. SchemaVersion = 1 )
const ( // DefaultModel and DefaultEffort are what the read's run is asked for // where config names neither. It reads short comments and answers a short // schema, so the smallest model does it. DefaultModel = "haiku" DefaultEffort = "medium" )
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(port modelport.Port, readers Readers, settings modelstage.Settings, log *slog.Logger) worker.Handler
NewHandler is the worker handler that reads each task's item's comments through the reader that readers opens for its media type, and asks port what they say under modelstage's dispatch-once protocol. A worker opens it only where it holds a model port and a reader.
func Register ¶
func Register(mediaType string)
Register records that this build reads the comments of items of mediaType through one of its sources, so the route queues a read for one. sources.Register calls it.
func StateOf ¶
func StateOf(r store.ItemRecords, claimed map[string]bool) *server.ReviewComments
StateOf is how the read of the item's comments stands in r, where claimed holds each capability that a worker heard from lately claims. It is nil where no source of this build reads the item's comments and none were read. A done answer stands whatever a later task does.
Types ¶
type Answer ¶
type Answer struct {
Summary string `json:"summary"`
Praise []string `json:"praise"`
Criticism []string `json:"criticism"`
Tone string `json:"tone"`
}
Answer is the model's answer, as prompts/comments/answer.schema.json holds it.
func DecodeAnswer ¶
func DecodeAnswer(raw json.RawMessage) (Answer, error)
DecodeAnswer decodes a stored answer without checking it against this build's schema, which its run's schema checked when it arrived.
func ReadAnswer ¶
func ReadAnswer(raw json.RawMessage) (Answer, error)
ReadAnswer checks raw against the schema of the prompt in force and decodes it.
type Read ¶
Read is an item's top comments, most relevant first, and Disabled where the item's owner turned its comments off.