Structured Output Schema Rules
How to create schema for structured output of process application tasks
This document outlines the rules for creating a JSON schema object that will determine the AI’s JSON output. The schema defines the structure and constraints of the JSON data that the AI will generate, ensuring that the output adheres to specific requirements.
Main Structure
The main schema is an object that contains properties, specifically a property named schema
.
Properties of schema
- Type: Must be an object.
- Additional Properties: Can be one of the following types:
Allowed Types for Additional Properties
-
Object Type
- Must have:
type
: Set to"object"
schema
: An object that can have additional properties defined recursively.
- Required:
type
,schema
- Must have:
-
Array Type
- Must have:
type
: Set to"array"
items
: Must reference additional properties defined in the schema.
- Required:
type
,items
- Must have:
-
Enum Type
- Must have:
type
: Set to"enum"
enum
: An array of strings representing possible values.
- Required:
type
- Must have:
-
Null Type
- Must have:
type
: Set to"null"
- Required:
type
- Must have:
-
String Type
- Must have:
type
: Set to"string"
- Required:
type
- Must have:
-
Number Type
- Must have:
type
: Set to"number"
- Required:
type
- Must have:
Example of a JSON Schema
Here is an example that showcases all properites