Package-level declarations

Types

Link copied to clipboard
data class CreateRunRequest(var assistantId: String, var model: String? = null, var instructions: String? = null, var tools: List<Tool>? = null, var metadata: Map<String, String>? = null)

A data class which represents a request to create a Run.

Link copied to clipboard
data class ListRunsRequest(var limit: Int? = null, var order: ListOrder? = null, var after: String? = null, var before: String? = null)

Represents a request to list all runs for a Thread. If a thread has too many runs, you may need to use the after or before parameters to page through them via multiple requests.

Link copied to clipboard
data class ListRunsResponse(val data: List<Run>, val firstId: String?, val lastId: String?, val hasMore: Boolean)

A data class which represents a response from the OpenAI API containing a list of Runs.

Link copied to clipboard
data class ListRunStepsRequest(var limit: Int? = null, var order: ListOrder? = null, var after: String? = null, var before: String? = null)

Represents a request to list all RunSteps in a Run. If a Run has too many steps, you may need to use the after or before parameters to page through them via multiple requests (Though it is extraordinarily rare to have more then 100 steps in 1 run).

Link copied to clipboard
data class ListRunStepsResponse(val data: List<RunStep>, val firstId: String?, val lastId: String?, val hasMore: Boolean)

A data class which represents a response from the OpenAI API containing a list of RunSteps.

Link copied to clipboard

Represents the details of a RunStep.Type.MESSAGE_CREATION step. This stores the ID of the message that was created. You can use this ID to get the message object from the MessageHandler.retrieve function.

Link copied to clipboard
data class ModifyRunRequest(var metadata: MutableMap<String, String>?)

A data class which represents a request to modify a Run.

Link copied to clipboard
sealed class RequiredAction

Represents a required action for a run. This is used when the Assistant requests tool calls. In this future, this may be used for other required actions as well.

Link copied to clipboard
data class Run(val id: String, val createdAt: Int, val threadId: String, val assistantId: String, val status: RunStatus, val requiredAction: RequiredAction?, val lastError: RunError?, val expiresAt: Int, val startedAt: Int?, val cancelledAt: Int?, val failedAt: Int?, val completedAt: Int?, val model: String, val instructions: String, val tools: List<Tool>, val fileIds: List<String>, val metadata: Map<String, String>)

Represents a run object returned by the OpenAI API. The run object itself isn't highly useful for most applications, but it is used to retrieve the messages from the run via RunSteps.

Link copied to clipboard
data class RunError(val code: RunError.ErrorCode, val message: String)

A data class which represents an error in a Run.

Link copied to clipboard
interface RunHandler

Handler used to interact with a Run objects.

Link copied to clipboard
class RunHandlerImpl(requestHelper: RequestHelper, endpoint: String, val threadId: String) : RunHandler
Link copied to clipboard

Represents the current state of a Run. You can view the current status of a run by looking at the Run.status field.

Link copied to clipboard
data class RunStep(val id: String, val createdAt: Int, val assistantId: String, val threadId: String, val runId: String, val type: RunStep.Type, val status: RunStatus, val stepDetails: RunStep.Details, val lastError: RunError?, val expiredAt: Int?, val cancelledAt: Int?, val failedAt: Int?, val completedAt: Int?, val metadata: Map<String, String> = emptyMap())

Each Run is broken down into steps. It is common for a Run to only have 1 step; creating a message. But with tool calls involved, an Assistant can create an arbitrary number of steps.

Link copied to clipboard
interface RunStepHandler

Handler used to interact with a RunStep objects.

Link copied to clipboard
class RunStepHandlerImpl(requestHelper: RequestHelper, endpoint: String, val threadId: String, val runId: String) : RunStepHandler
Link copied to clipboard
data class SubmitToolOutputs(var toolOutputs: MutableList<ToolCallOutputs>)

A data class holding your tool's outputs. Used after an Assistant makes a tool call.

Link copied to clipboard
data class ToolCallOutputs(var toolCallId: String, var output: String)

Represents the response to a specific tool call. This is used when submitting tool outputs back to the RunHandler.

Link copied to clipboard
data class ToolCallsDetails(val toolCalls: List<ToolCall>) : RunStep.Details

Contains the list of all tool calls made during a run step.