Skip to content

run

Classes:

Name Description
LastError
RequiredAction
RequiredActionSubmitToolOutputs
Run
Usage

LastError

Attributes:

Name Type Description
code Literal['server_error', 'rate_limit_exceeded', 'invalid_prompt']

One of server_error, rate_limit_exceeded, or invalid_prompt.

message str

A human-readable description of the error.

code instance-attribute

code: Literal[
    "server_error", "rate_limit_exceeded", "invalid_prompt"
]

One of server_error, rate_limit_exceeded, or invalid_prompt.

message instance-attribute

message: str

A human-readable description of the error.

RequiredAction

Attributes:

Name Type Description
submit_tool_outputs RequiredActionSubmitToolOutputs

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

type Literal['submit_tool_outputs']

For now, this is always submit_tool_outputs.

submit_tool_outputs instance-attribute

submit_tool_outputs: RequiredActionSubmitToolOutputs

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

type instance-attribute

type: Literal['submit_tool_outputs']

For now, this is always submit_tool_outputs.

RequiredActionSubmitToolOutputs

Attributes:

Name Type Description
tool_calls List[RequiredActionFunctionToolCall]

A list of the relevant tool calls.

tool_calls instance-attribute

A list of the relevant tool calls.

Run

Attributes:

Name Type Description
assistant_id str

The ID of the

cancelled_at Optional[int]

The Unix timestamp (in seconds) for when the run was cancelled.

completed_at Optional[int]

The Unix timestamp (in seconds) for when the run was completed.

created_at int

The Unix timestamp (in seconds) for when the run was created.

expires_at Optional[int]

The Unix timestamp (in seconds) for when the run will expire.

failed_at Optional[int]

The Unix timestamp (in seconds) for when the run failed.

file_ids List[str]

The list of File IDs the

id str

The identifier, which can be referenced in API endpoints.

instructions str

The instructions that the

last_error Optional[LastError]

The last error associated with this run. Will be null if there are no errors.

metadata Optional[object]

Set of 16 key-value pairs that can be attached to an object.

model str

The model that the

object Literal['thread.run']

The object type, which is always thread.run.

required_action Optional[RequiredAction]

Details on the action required to continue the run.

started_at Optional[int]

The Unix timestamp (in seconds) for when the run was started.

status RunStatus

The status of the run, which can be either queued, in_progress,

thread_id str

The ID of the thread

tools List[AssistantTool]

The list of tools that the

usage Optional[Usage]

Usage statistics related to the run.

assistant_id instance-attribute

assistant_id: str

The ID of the assistant used for execution of this run.

cancelled_at class-attribute instance-attribute

cancelled_at: Optional[int] = None

The Unix timestamp (in seconds) for when the run was cancelled.

completed_at class-attribute instance-attribute

completed_at: Optional[int] = None

The Unix timestamp (in seconds) for when the run was completed.

created_at instance-attribute

created_at: int

The Unix timestamp (in seconds) for when the run was created.

expires_at class-attribute instance-attribute

expires_at: Optional[int] = None

The Unix timestamp (in seconds) for when the run will expire.

failed_at class-attribute instance-attribute

failed_at: Optional[int] = None

The Unix timestamp (in seconds) for when the run failed.

file_ids instance-attribute

file_ids: List[str]

The list of File IDs the assistant used for this run.

id instance-attribute

id: str

The identifier, which can be referenced in API endpoints.

instructions instance-attribute

instructions: str

The instructions that the assistant used for this run.

last_error class-attribute instance-attribute

last_error: Optional[LastError] = None

The last error associated with this run. Will be null if there are no errors.

metadata class-attribute instance-attribute

metadata: Optional[object] = None

Set of 16 key-value pairs that can be attached to an object.

This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.

model instance-attribute

model: str

The model that the assistant used for this run.

object instance-attribute

object: Literal['thread.run']

The object type, which is always thread.run.

required_action class-attribute instance-attribute

required_action: Optional[RequiredAction] = None

Details on the action required to continue the run.

Will be null if no action is required.

started_at class-attribute instance-attribute

started_at: Optional[int] = None

The Unix timestamp (in seconds) for when the run was started.

status instance-attribute

status: RunStatus

The status of the run, which can be either queued, in_progress, requires_action, cancelling, cancelled, failed, completed, or expired.

thread_id instance-attribute

thread_id: str

The ID of the thread that was executed on as a part of this run.

tools instance-attribute

The list of tools that the assistant used for this run.

usage class-attribute instance-attribute

usage: Optional[Usage] = None

Usage statistics related to the run.

This value will be null if the run is not in a terminal state (i.e. in_progress, queued, etc.).

Usage

Attributes:

Name Type Description
completion_tokens int

Number of completion tokens used over the course of the run.

prompt_tokens int

Number of prompt tokens used over the course of the run.

total_tokens int

Total number of tokens used (prompt + completion).

completion_tokens instance-attribute

completion_tokens: int

Number of completion tokens used over the course of the run.

prompt_tokens instance-attribute

prompt_tokens: int

Number of prompt tokens used over the course of the run.

total_tokens instance-attribute

total_tokens: int

Total number of tokens used (prompt + completion).