ResponseFormat

sealed interface ResponseFormat

Output format requested from the provider through CompletionConfig.responseFormat.

Gateways forward the format in streaming and non-streaming requests. The request only records what was asked for. It does not prove that the provider enforced it, so callers must still validate the returned content.

A null format leaves the request unchanged and uses the provider default.

Inheritors

Types

Link copied to clipboard
data class Json(val schema: JsonObject? = null) : ResponseFormat

A JSON object.

Link copied to clipboard
data object Text : ResponseFormat

Plain text. OpenAI receives {"type":"text"}; Ollama receives no format.