Json

@SerialName(value = "json")
data class Json(val schemaName: String? = null, val schemaDescription: String? = null, val schemaJson: JsonElement? = null) : ResponseFormat(source)

JSON-shaped response. schemaJson is the JSON-Schema constraint (optional — null means "any valid JSON object"); schemaName and schemaDescription are passed verbatim to providers that expose named-schema modes (OpenAI structured outputs, Gemini's response_schema).

Idiomatic use via outputObj / outputArray: when a caller wants typed output, they construct an Output AND set responseFormat = ResponseFormat.Json(...) on the call params so the provider constrains decoding, then Output.decode parses the response text.

Constructors

Link copied to clipboard
constructor(schemaName: String? = null, schemaDescription: String? = null, schemaJson: JsonElement? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard