Skip to main content

Module declaration

Module declaration 

Source
Expand description

Type surface of submilli:llm.

Two forms, one per meaning. text and texts return the completion text: they are plain functions, and a schema they take is the program’s own, sent to the provider as written and never used to parse or check the answer. call<T> and batch<T> return a checked T: they are declared generic and runtime-generic, so like every generic function a call passes one $TypeDescriptor per type parameter in a trailing $types environment — the type’s structural predicate, its name, its JSON Schema, and its TypeInfo reference (codegen::runtime_descriptors). The host sends the schema to the provider, parses each response as JSON and runs the predicate on it; a rejected value becomes an ok: false entry with reason: "invalid-output". So the value of a Success<T> holds only what the predicate accepted, which is what lets the declared return type Completion<T> be trusted without a cast around the call. T has no default: it is written, or inferred from the expected type, and the call is typed either way. The typechecker gates it through its rows in the checked-call table (stdlib::checked_call; is_checked_call and is_checked_batch are its hooks), and codegen emits the schema per type; nothing about the descriptor is a parameter, so the written declaration is the whole public API.

Functions§

is_checked_batch
Whether mangled is batch<T>.
is_checked_call
Whether mangled is call<T>.
package_declaration