Tinker Structured outputs

by Samy (Kondasamy Jayaraman)

Loading Larkspur mini

Larkspur mini · no schemaThe prompt: “Order 1042 status as JSON:”

Chapter 2 of 7

A schema is a contract

Larkspur mini answered in prose. The team writes down what the order system expects, and the host checks every answer against it, as Tool calling’s host checks tool arguments.

This chapter: What does checking the answer after it is written buy you, and what does it cost?

About this chapter

You will learn

  • What a JSON schema says: which fields, which types, which values
  • How a check after the answer turns a bad answer into a retry
  • Why retries cost tokens and still guarantee nothing

Words you’ll meet

Validation
Checking a finished answer against the schema. It can only say pass or fail, after the tokens are spent.
Retry
Asking again after a failed check, and paying for every token again.

Step 1 of 4

The schema: one field, status, on time or delayed, nothing else.

Use it to check every answer.

The schema (JSON Schema)
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "on time",
        "delayed"
      ]
    }
  },
  "required": [
    "status"
  ],
  "additionalProperties": false
}

Loading Larkspur mini…