Skip to content
lingo

One schema

One lingoObject for a tool argument and a human form.

Prefer the live demos? Open this section in the interactive docs.

Use one lingoObject to validate an LLM tool argument and canonicalize a human form, unchanged.

const shipment = lingoObject({
  weight: quantityField({ kind: 'mass', unit: 'kg', min: 0 }),
  deliverBy: dateField(),
})
import { tool } from 'ai'

// LLM emits "5 kg" / "next friday"; canonical on arrival
tool({ inputSchema: shipment, execute: run })
import { standardSchemaResolver } from '@hookform/resolvers/standard-schema'

// user types "5 kg" / picks a date; canonical on submit
useForm({ resolver: standardSchemaResolver(shipment) })

Type 5'11" or emit "5 kg"; both arrive canonical. (Whole-form resolvers use lingoObject(shape, { passthrough: true }) for fields lingo doesn't own.)