Build the JSON schemas that drive function calling and structured output, starting from five working templates: contact extraction, sentiment classification, resume parsing, action-item extraction, and API error shapes.
Build JSON schemas for AI function calling, structured outputs, and data extraction. Define fields visually, then export as OpenAI function tool, structured output schema, or standard JSON Schema.
Templates
Fields (3)
{
"type": "function",
"function": {
"name": "my_function",
"description": "Describe what this schema extracts or produces",
"parameters": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The user's full name"
},
"age": {
"type": "integer",
"description": "The user's age in years"
},
"role": {
"type": "string",
"description": "The user's role",
"enum": [
"admin",
"editor",
"viewer"
]
}
},
"required": [
"name",
"role"
],
"additionalProperties": false
}
}
}The single highest-leverage thing in a function-calling schema is the description field on each property. The model uses those descriptions to decide what to put where, so a field described as date is filled inconsistently while one described as invoice due date in YYYY-MM-DD format, or null if not stated is filled correctly. Schema descriptions are prompt engineering.
The second is being honest about required. Marking everything required forces the model to invent values for fields the source document does not contain, which is a reliable way to manufacture hallucinations. Make optional fields optional and allow null explicitly.