Raon
Meet Raon-1 nano (E1.5B), smaller and faster!View on Hugging Face (new tab)
Docs

Structured outputs

Have the model answer in JSON that matches your schema.

Give a JSON Schema, and the answer is JSON that follows it. Use this when your code parses the answer, for example to extract fields from text or to fill a form.

With a schema

The OpenAI SDKs build the schema from a Pydantic model or a Zod object and parse the answer for you:

from pydantic import BaseModel

class Person(BaseModel):
    name: str
    age: int

completion = client.chat.completions.parse(
    model="raon-1-mini",
    messages=[{"role": "user", "content": "Make up a person who lives in Seoul."}],
    response_format=Person,
)
print(completion.choices[0].message.parsed)
APIWhere the schema goes
Chat Completionsresponse_format: {"type": "json_schema", "json_schema": {...}}
Responsestext.format: {"type": "json_schema", "name": ..., "schema": {...}}
Messagesoutput_config: {"format": {"type": "json_schema", "schema": {...}}}

The model still reasons first. The reasoning stays in its own field, and only the answer follows the schema.

Schema rules

Raon checks the schema before the model starts. A json_schema that is not a valid JSON Schema is refused with HTTP 400 as an invalid request, and nothing is generated; see Errors for the error shape. Fix the schema rather than retrying. Check that:

  • schema is a JSON object. Make the top level an object ("type": "object") with its fields under properties.
  • Each type is one of object, array, string, number, integer, boolean or null, or an array of these.
  • properties maps each field name to a schema, and required is an array of field names.
  • items on an array is a schema, and enum is a non-empty array.
  • Each $ref points to a definition inside the same schema, such as #/$defs/address.

With strict: true, also list every field in required and set "additionalProperties": false on each object, as in the example above. The Pydantic and Zod helpers in the OpenAI SDKs do this for you.

JSON mode

response_format: {"type": "json_object"} on Chat Completions asks for any valid JSON object, without a schema. Say in the prompt which keys you want.

Tips

  • Give each field a clear name, and a description where the meaning is not obvious. The model fills fields from these.
  • Leave enough output tokens for both reasoning and JSON: max_tokens or max_completion_tokens on Chat Completions, max_tokens on Messages, and max_output_tokens on Responses. Check for truncation using finish_reason: "length", stop_reason: "max_tokens", or status: "incomplete" and incomplete_details, respectively. Parse and validate the answer before using it.

On this page