Skip to main content

Module schema

Module schema 

Source
Expand description

Ingot types to JSON Schema.

This is where the type system stops being decorative. ask<string[]> becomes a schema the provider constrains its output to, and a response that does not match is an error rather than a best-effort parse.

Two rules shape the mapping:

  • Prose is not constrained. text and markdown ask for writing, so they get a plain completion. Constraining them to a JSON string would mean receiving markdown wrapped in JSON escaping — worse than not asking.
  • Non-object schemas are wrapped. Provider structured-output implementations generally expect an object at the schema root, so a scalar or array schema is nested under value and unwrapped on the way back.

Structs§

UnsupportedResponseType
A response type that cannot be requested from a model.

Enums§

ResponseShape
How a declared response type is requested from a provider.

Constants§

FILE_HANDLE_FIELD
The runtime representation of a file: a handle, never the content.

Functions§

response_shape
Work out how to request ty, resolving record types against types.
type_schema
The JSON Schema for one Ingot type.
validate
Check a value against an Ingot type. Returns the first mismatch found.