Documentation
¶
Overview ¶
Package contracts holds the JSON Schemas (draft 2020-12) of tool inputs and outputs, and the closed schemas of the quarantined reader's answers (notes/). The schema files are embedded; Validate checks raw tool arguments against the input schema before any service is called.
Index ¶
- Variables
- func Input(tool string) (json.RawMessage, error)
- func NoteDescription(schemaID string) (string, error)
- func NoteSchema(schemaID string) (json.RawMessage, error)
- func Output(tool string) (json.RawMessage, error)
- func ToolNames() []string
- func Validate(tool string, raw []byte) error
- func ValidateNote(schemaID string, raw []byte) error
- func ValidateOutput(tool string, raw []byte) error
Constants ¶
This section is empty.
Variables ¶
var ErrInvalid = errors.New("schema validation failed")
ErrInvalid marks arguments or results that do not match their schema.
Functions ¶
func Input ¶
func Input(tool string) (json.RawMessage, error)
Input returns the raw input schema of a tool, for the tool listing.
func NoteDescription ¶
NoteDescription returns the top-level "description" of a note schema: one line per value, for the system prompt of the quarantined reader.
func NoteSchema ¶
func NoteSchema(schemaID string) (json.RawMessage, error)
NoteSchema returns the closed schema that edi.extract_note answers with for schemaID (notes/<schemaID>.json), as the model's response format.
func Output ¶
func Output(tool string) (json.RawMessage, error)
Output returns the raw output schema of a tool, for the tool listing.
func ToolNames ¶
func ToolNames() []string
ToolNames lists the tools that have a schema: the tools of the gateway. The linter of upstream descriptions uses it to find references to them.
func Validate ¶
Validate checks raw tool arguments against the input schema of the tool. Empty arguments count as an empty object. The error wraps ErrInvalid.
func ValidateNote ¶
ValidateNote checks the model's answer against the note schema schemaID.
func ValidateOutput ¶
ValidateOutput checks a tool result against the output schema.
Types ¶
This section is empty.