InputBuilder

DSL for building the input of a Responses API call.

Appends items in call order. Because the API is stateless, a previous response's output is appended verbatim with items to continue the conversation.

Example:

client.createResponse {
input {
user("What is the weather in Tokyo?")
items(previous.output)
functionCallOutput(callId, """{"temp_c": 21}""")
}
}

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun assistant(text: String)

Appends an assistant message, replaying an earlier model turn as context.

Link copied to clipboard
fun developer(text: String)

Appends a developer message, which the API treats exactly like a user message.

Link copied to clipboard
fun functionCall(callId: String, name: String, arguments: String)

Appends a function call, replaying one the model emitted earlier.

Link copied to clipboard

Appends the result of running a function, as content parts — which lets a tool hand the model an image it produced.

fun functionCallOutput(callId: String, output: String)

Appends the result of running a function the model called.

Link copied to clipboard
fun item(item: ResponseItem)

Appends a ready-made item.

Link copied to clipboard
fun items(items: List<ResponseItem>)

Appends ready-made items, typically the output of a previous response.

Link copied to clipboard
fun message(role: ResponseRole, text: String)

Appends a message with an arbitrary role.

Link copied to clipboard
fun reasoning(text: String)

Appends a chain-of-thought item, replaying the reasoning of an earlier turn.

Link copied to clipboard
fun system(text: String)

Appends a system message.

Link copied to clipboard

Appends a multimodal user message assembled by a ContentBuilder DSL.

fun user(text: String)

Appends a user message.