Package-level declarations

Types

Link copied to clipboard
@Serializable
data class AssistantStreamEvent(val rawType: String?, val type: AssistantStreamEventType, val data: String?)

Represents an event emitted when streaming a run.

Link copied to clipboard

Represents an event type emitted when streaming a Run.

Link copied to clipboard
@Serializable
data class CodeInterpreterImage(val fileId: FileId)

Code interpreter image

Link copied to clipboard
@Serializable
data class CodeInterpreterToolCall(val input: String, val outputs: List<CodeInterpreterToolCallOutput>)
Link copied to clipboard
@Serializable
sealed interface CodeInterpreterToolCallOutput
Link copied to clipboard
@Serializable
data class FileSearchToolCallRankingOptions(val ranker: String, val scoreThreshold: Double)
Link copied to clipboard
@Serializable
data class FileSearchToolCallResult(val fileId: FileId, val fileName: String, val score: Double)
Link copied to clipboard
@Serializable
data class FileSearchToolCallStep(val rankingOptions: FileSearchToolCallRankingOptions, val results: List<FileSearchToolCallResult>)
Link copied to clipboard
@Serializable
data class FunctionToolCallStep(val name: String, val arguments: String, val output: String? = null)
Link copied to clipboard
@Serializable
data class MessageCreation(val messageId: MessageId)

Details of the message that occurred during the run step.

Link copied to clipboard
@Serializable
@SerialName(value = "message_creation")
data class MessageCreationStep(    val id: RunStepId,     val createdAt: Int,     val assistantId: AssistantId,     val threadId: ThreadId,     val runId: RunId,     val status: Status,     val stepDetails: MessageCreationStepDetails,     val lastError: LastError? = null,     val expiredAt: Int? = null,     val cancelledAt: Int? = null,     val failedAt: Int? = null,     val completedAt: Int? = null,     val metadata: Map<String, String>? = null) : RunStep
Link copied to clipboard
@Serializable
@SerialName(value = "message_creation")
data class MessageCreationStepDetails(val messageCreation: MessageCreation) : RunStepDetails

Details of the message creation by the run step.

Link copied to clipboard
@Serializable
data class MessageDelta(val id: MessageId, val object: String, val delta: MessageDeltaData)

Represents a message delta i.e. any changed fields on a message during streaming.

Link copied to clipboard
@Serializable
data class MessageDeltaData(val role: Role, val content: MessageContent)

The delta containing the fields that have changed on the message.

Link copied to clipboard
@Serializable
sealed interface RequiredAction

Details on the action required to continue the run.

Link copied to clipboard
@Serializable
data class Run(    val id: RunId,     val createdAt: Int,     val threadId: ThreadId,     val assistantId: AssistantId,     val status: Status,     val requiredAction: RequiredAction? = null,     val lastError: LastError? = null,     val expiresAt: Int? = null,     val startedAt: Int? = null,     val cancelledAt: Int? = null,     val failedAt: Int? = null,     val completedAt: Int? = null,     val model: ModelId,     val instructions: String? = null,     val tools: List<AssistantTool>? = null,     val fileIds: List<String>? = null,     val metadata: Map<String, String>? = null,     val usage: Usage? = null,     val temperature: Double? = null,     val topP: Double? = null,     val maxPromptTokens: Int? = null,     val maxCompletionTokens: Int? = null)

Represents an execution run on a thread.

Link copied to clipboard
@Serializable
value class RunId(val id: String)

A run id.

Link copied to clipboard
@Serializable
data class RunRequest(    val assistantId: AssistantId,     val model: ModelId? = null,     val instructions: String? = null,     val additionalInstructions: String? = null,     val tools: List<AssistantTool>? = null,     val metadata: Map<String, String>? = null,     val stream: Boolean = false)

Create a run request.

Link copied to clipboard

Builder for RunRequest.

Link copied to clipboard
@Serializable
sealed interface RunStep
Link copied to clipboard
@Serializable
data class RunStepDelta(val id: RunStepId, val object: String, val delta: RunStepDeltaData)

Represents a run step delta i.e. any changed fields on a run step during streaming.

Link copied to clipboard
@Serializable
data class RunStepDeltaData(val stepDetails: RunStepDetails)

The delta containing the fields that have changed on the run step.

Link copied to clipboard
@Serializable
sealed interface RunStepDetails

A run step object.

Link copied to clipboard
@Serializable
value class RunStepId(val id: String)

A run step id.

Link copied to clipboard
@Serializable
data class ThreadRunRequest(    val assistantId: AssistantId,     val thread: ThreadRequest? = null,     val model: ModelId? = null,     val instructions: String? = null,     val tools: List<AssistantTool>? = null,     val metadata: Map<String, String>? = null,     val stream: Boolean = false)

Create a thread and run it in one request.

Link copied to clipboard

Create a thread and run it in one request.

Link copied to clipboard
@Serializable
@SerialName(value = "tool_calls")
data class ToolCallsStep(    val id: RunStepId,     val createdAt: Int,     val assistantId: AssistantId,     val threadId: ThreadId,     val runId: RunId,     val status: Status,     val stepDetails: ToolCallStepDetails,     val lastError: LastError? = null,     val expiredAt: Int? = null,     val cancelledAt: Int? = null,     val failedAt: Int? = null,     val completedAt: Int? = null,     val metadata: Map<String, String>? = null) : RunStep
Link copied to clipboard
@Serializable
sealed interface ToolCallStep
Link copied to clipboard
@Serializable
@SerialName(value = "tool_calls")
data class ToolCallStepDetails(val toolCalls: List<ToolCallStep>? = null) : RunStepDetails

Details of the tool call.

Link copied to clipboard
@Serializable
value class ToolCallStepId(val id: String)

Tool call step identifier.

Link copied to clipboard
@Serializable
data class ToolOutput(val toolCallId: ToolId? = null, val output: String? = null)

Represents a tool output.

Link copied to clipboard

A tool output builder.

Link copied to clipboard
@Serializable
data class ToolOutputs(val toolCalls: List<ToolCall>)

Details on the tool outputs needed for this run to continue.

Functions

Link copied to clipboard

Create a run request.

Link copied to clipboard

Create a thread and run it in one request.

Link copied to clipboard

Creates a ToolOutput instance using the provided builder block.