ChatCompletionsResponseFormatJsonSchemaDefinition interface

Defines the response format for chat completions as JSON with a given schema. The AI model will need to adhere to this schema when generating completions.

Properties

description

A description of the response format, used by the AI model to determine how to generate responses in this format.

name

A name that labels this JSON schema. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

schema

The definition of the JSON schema. See https://json-schema.org/overview/what-is-jsonschema. Note that AI models usually only support a subset of the keywords defined by JSON schema. Consult your AI model documentation to determine what is supported.

strict

If set to true, the service will error out if the provided JSON schema contains keywords not supported by the AI model. An example of such keyword may be maxLength for JSON type string. If false, and the provided JSON schema contains keywords not supported by the AI model, the AI model will not error out. Instead it will ignore the unsupported keywords.

Property Details

description

A description of the response format, used by the AI model to determine how to generate responses in this format.

description?: string

Property Value

string

name

A name that labels this JSON schema. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

name: string

Property Value

string

schema

The definition of the JSON schema. See https://json-schema.org/overview/what-is-jsonschema. Note that AI models usually only support a subset of the keywords defined by JSON schema. Consult your AI model documentation to determine what is supported.

schema: Record<string, unknown>

Property Value

Record<string, unknown>

strict

If set to true, the service will error out if the provided JSON schema contains keywords not supported by the AI model. An example of such keyword may be maxLength for JSON type string. If false, and the provided JSON schema contains keywords not supported by the AI model, the AI model will not error out. Instead it will ignore the unsupported keywords.

strict?: boolean

Property Value

boolean