Skip to main content
Contextual AI supports structured outputs in JSON format. Use structured output mode when responses must follow a consistent, easily parsed format—for example, to extract defined data fields or integrate with downstream applications and workflows.
This feature is currently in beta, with attributions and other capabilities planned for future release.
To use structured outputs:
  1. Define your schema, which must be valid JSON and include the json_schema key.
  2. Pass the schema as part of your /query request.
Contextual AI Python SDK users must include the schema under the structured_output key in the extra_body parameter.
  1. Parse the returned message as JSON-formatted data:
The resulting structured output can then be used for a variety of downstream applications: