Prompting techniques
JSON Schema
Definition
JSON Schema is a standard vocabulary for describing the shape of JSON data — its keys, types and required fields. AI providers use it to constrain model output to a guaranteed structure.
A schema declares what valid data looks like: which properties exist, their types, which are required, and what values are permitted. Providers that support structured output take a schema and guarantee the model's response conforms to it.
This turns a probabilistic system into a dependable component. Without a schema you hope for valid JSON and write defensive parsing; with one you can rely on the shape and validate only semantics.
Schemas double as documentation for the model. Descriptive property names and per-field descriptions measurably improve extraction accuracy, because the schema is telling the model what each field means.
Example
{"type":"object","properties":{"sentiment":{"type":"string","enum":["positive","neutral","negative"]},"score":{"type":"number"}},"required":["sentiment"]}
Related terms
Structured output
Structured output means constraining a model to return data in a machine-readable shape such as JSON, usually by specifying the exact schema in the prompt or using a provider feature that enforces it.
Function calling
Function calling lets a model request that your code run a specific function with specific arguments. You expose tool definitions; the model returns a structured call, your code executes it, and the result goes back into the conversation.
Evaluation (evals)
Evaluation is systematically measuring AI output quality against a test set, rather than judging from a handful of examples. It is what makes prompt and model changes safe to ship.
Zero-shot prompting
Zero-shot prompting means asking a model to do a task with no worked examples — just an instruction. It works well for common tasks the model has seen extensively in training.
Few-shot prompting
Few-shot prompting means including two to five worked examples of the input-output pattern you want before making your real request. It is the fastest way to lock in a consistent format, tone or edge-case behaviour.
Chain-of-thought prompting
Chain-of-thought prompting asks a model to work through its reasoning step by step before answering. It measurably improves accuracy on maths, logic, and multi-step problems by forcing intermediate steps instead of an immediate guess.
Put this into practice
Understanding the term is step one. Our free courses and tools let you actually use it.