OpenAIResponseFormat

Expected response format from OpenAI's chat completion API. This interface defines different types of response formats that can be requested:

  • Text - Response in plain text format

  • JsonSchema - Response conforming to a specified JSON schema

  • JsonObject - Response as a JSON object

Inheritors

Types

Link copied to clipboard

JSON object response format. An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

Link copied to clipboard
@SerialName(value = "json_schema")
class JsonSchema(val jsonSchema: JsonSchemaObject) : OpenAIResponseFormat

JSON Schema response format. Used to generate structured JSON responses.

Link copied to clipboard

Default response format. Used to generate text responses.