Intelligence · function
requireStructuredOutput
Ask for output shaped like a schema, or refuse before spending anything.
Explained in Agents and behaviour.
function requireStructuredOutput(provider: AiProvider | null, schema: ToolSchema, value: unknown): StructuredResultimport { requireStructuredOutput } from '@driftengine/ai';Parameters
| Parameter | Type | Description |
|---|---|---|
provider | AiProvider | null | |
schema | ToolSchema | |
value | unknown |
In depth
A provider declaring no structured output is refused before the request. Sending it anyway and hoping the text parses is the silent-downgrade failure wearing a different hat: it works often enough to ship and fails on the input nobody tested.