ResponseInput

@Serializable(with = ResponseInputSerializer::class)
sealed interface ResponseInput

The two shapes the input of a ResponseRequest takes on the wire: a bare string, treated by the API as a single user message, or an array of ResponseItems.

The request constructors and ResponseParams.createRequest wrap a String or a List<ResponseItem> for you, so this type mostly shows up when reading a request back:

when (val input = request.input) {
is ResponseInput.Text -> println(input.text)
is ResponseInput.Items -> println("${'$'}{input.items.size} items")
null -> println("instructions only")
}

Inheritors

Types

Link copied to clipboard
class Items(val items: List<ResponseItem>) : ResponseInput

A conversation, sent as a JSON array of items.

Link copied to clipboard
class Text(val text: String) : ResponseInput

A single user message, sent as a bare JSON string.