Class Run
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
Run.Builder
A builder for Run.
public final class
Run.IncompleteDetails
Details on why the run is incomplete. Will be
null
if the run is not incomplete.public final class
Run.LastError
The last error associated with this run. Will be
null
if there are no errors.public final class
Run.Metadata
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, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
public final class
Run.RequiredAction
Details on the action required to continue the run. Will be
null
if no action is required.public final class
Run.TruncationStrategy
Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
public final class
Run.Usage
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.).
-
Method Summary
Modifier and Type Method Description final String
id()
The identifier, which can be referenced in API endpoints. final String
assistantId()
The ID of the assistant used for execution of this run. final Optional<Long>
cancelledAt()
The Unix timestamp (in seconds) for when the run was cancelled. final Optional<Long>
completedAt()
The Unix timestamp (in seconds) for when the run was completed. final Long
createdAt()
The Unix timestamp (in seconds) for when the run was created. final Optional<Long>
expiresAt()
The Unix timestamp (in seconds) for when the run will expire. final Optional<Long>
failedAt()
The Unix timestamp (in seconds) for when the run failed. final Optional<Run.IncompleteDetails>
incompleteDetails()
Details on why the run is incomplete. final String
instructions()
The instructions that the assistant used for this run. final Optional<Run.LastError>
lastError()
The last error associated with this run. final Optional<Long>
maxCompletionTokens()
The maximum number of completion tokens specified to have been used over the course of the run. final Optional<Long>
maxPromptTokens()
The maximum number of prompt tokens specified to have been used over the course of the run. final Optional<Run.Metadata>
metadata()
Set of 16 key-value pairs that can be attached to an object. final String
model()
The model that the assistant used for this run. final JsonValue
_object_()
The object type, which is always thread.run
.final Boolean
parallelToolCalls()
Whether to enable parallel function calling during tool use. final Optional<Run.RequiredAction>
requiredAction()
Details on the action required to continue the run. final Optional<AssistantResponseFormatOption>
responseFormat()
Specifies the format that the model must output. final Optional<Long>
startedAt()
The Unix timestamp (in seconds) for when the run was started. final RunStatus
status()
The status of the run, which can be either queued
,in_progress
,requires_action
,cancelling
,cancelled
,failed
,completed
,incomplete
, orexpired
.final String
threadId()
The ID of the thread that was executed on as a part of this run. final Optional<AssistantToolChoiceOption>
toolChoice()
Controls which (if any) tool is called by the model. final List<AssistantTool>
tools()
The list of tools that the assistant used for this run. final Optional<Run.TruncationStrategy>
truncationStrategy()
Controls for how a thread will be truncated prior to the run. final Optional<Run.Usage>
usage()
Usage statistics related to the run. final Optional<Double>
temperature()
The sampling temperature used for this run. final Optional<Double>
topP()
The nucleus sampling value used for this run. final JsonField<String>
_id()
Returns the raw JSON value of id. final JsonField<String>
_assistantId()
Returns the raw JSON value of assistantId. final JsonField<Long>
_cancelledAt()
Returns the raw JSON value of cancelledAt. final JsonField<Long>
_completedAt()
Returns the raw JSON value of completedAt. final JsonField<Long>
_createdAt()
Returns the raw JSON value of createdAt. final JsonField<Long>
_expiresAt()
Returns the raw JSON value of expiresAt. final JsonField<Long>
_failedAt()
Returns the raw JSON value of failedAt. final JsonField<Run.IncompleteDetails>
_incompleteDetails()
Returns the raw JSON value of incompleteDetails. final JsonField<String>
_instructions()
Returns the raw JSON value of instructions. final JsonField<Run.LastError>
_lastError()
Returns the raw JSON value of lastError. final JsonField<Long>
_maxCompletionTokens()
Returns the raw JSON value of maxCompletionTokens. final JsonField<Long>
_maxPromptTokens()
Returns the raw JSON value of maxPromptTokens. final JsonField<Run.Metadata>
_metadata()
Returns the raw JSON value of metadata. final JsonField<String>
_model()
Returns the raw JSON value of model. final JsonField<Boolean>
_parallelToolCalls()
Returns the raw JSON value of parallelToolCalls. final JsonField<Run.RequiredAction>
_requiredAction()
Returns the raw JSON value of requiredAction. final JsonField<AssistantResponseFormatOption>
_responseFormat()
Returns the raw JSON value of responseFormat. final JsonField<Long>
_startedAt()
Returns the raw JSON value of startedAt. final JsonField<RunStatus>
_status()
Returns the raw JSON value of status. final JsonField<String>
_threadId()
Returns the raw JSON value of threadId. final JsonField<AssistantToolChoiceOption>
_toolChoice()
Returns the raw JSON value of toolChoice. final JsonField<List<AssistantTool>>
_tools()
Returns the raw JSON value of tools. final JsonField<Run.TruncationStrategy>
_truncationStrategy()
Returns the raw JSON value of truncationStrategy. final JsonField<Run.Usage>
_usage()
Returns the raw JSON value of usage. final JsonField<Double>
_temperature()
Returns the raw JSON value of temperature. final JsonField<Double>
_topP()
Returns the raw JSON value of topP. final Map<String, JsonValue>
_additionalProperties()
final Run.Builder
toBuilder()
final Run
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static Run.Builder
builder()
Returns a mutable builder for constructing an instance of Run. -
-
Method Detail
-
assistantId
final String assistantId()
The ID of the assistant used for execution of this run.
-
cancelledAt
final Optional<Long> cancelledAt()
The Unix timestamp (in seconds) for when the run was cancelled.
-
completedAt
final Optional<Long> completedAt()
The Unix timestamp (in seconds) for when the run was completed.
-
expiresAt
final Optional<Long> expiresAt()
The Unix timestamp (in seconds) for when the run will expire.
-
incompleteDetails
final Optional<Run.IncompleteDetails> incompleteDetails()
Details on why the run is incomplete. Will be
null
if the run is not incomplete.
-
instructions
final String instructions()
The instructions that the assistant used for this run.
-
lastError
final Optional<Run.LastError> lastError()
The last error associated with this run. Will be
null
if there are no errors.
-
maxCompletionTokens
final Optional<Long> maxCompletionTokens()
The maximum number of completion tokens specified to have been used over the course of the run.
-
maxPromptTokens
final Optional<Long> maxPromptTokens()
The maximum number of prompt tokens specified to have been used over the course of the run.
-
metadata
final Optional<Run.Metadata> metadata()
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, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
_object_
final JsonValue _object_()
The object type, which is always
thread.run
.Expected to always return the following:
JsonValue.from("thread.run")
However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
parallelToolCalls
final Boolean parallelToolCalls()
Whether to enable parallel function calling during tool use.
-
requiredAction
final Optional<Run.RequiredAction> requiredAction()
Details on the action required to continue the run. Will be
null
if no action is required.
-
responseFormat
final Optional<AssistantResponseFormatOption> responseFormat()
Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 * Turbo, and all GPT-3.5 Turbo models since
gpt-3.5-turbo-1106
.Setting to
{ "type": "json_schema", "json_schema": {...} }
enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }
enables JSON mode, which ensures the message the model generates is valid JSON.Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if
finish_reason="length"
, which indicates the generation exceededmax_tokens
or the conversation exceeded the max context length.
-
startedAt
final Optional<Long> startedAt()
The Unix timestamp (in seconds) for when the run was started.
-
status
final RunStatus status()
The status of the run, which can be either
queued
,in_progress
,requires_action
,cancelling
,cancelled
,failed
,completed
,incomplete
, orexpired
.
-
toolChoice
final Optional<AssistantToolChoiceOption> toolChoice()
Controls which (if any) tool is called by the model.
none
means the model will not call any tools and instead generates a message.auto
is the default value and means the model can pick between generating a message or calling one or more tools.required
means the model must call one or more tools before responding to the user. Specifying a particular tool like{"type": "file_search"}
or{"type": "function", "function": {"name": "my_function"}}
forces the model to call that tool.
-
tools
final List<AssistantTool> tools()
The list of tools that the assistant used for this run.
-
truncationStrategy
final Optional<Run.TruncationStrategy> truncationStrategy()
Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
-
usage
final Optional<Run.Usage> usage()
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.).
-
temperature
final Optional<Double> temperature()
The sampling temperature used for this run. If not set, defaults to 1.
-
topP
final Optional<Double> topP()
The nucleus sampling value used for this run. If not set, defaults to 1.
-
_id
final JsonField<String> _id()
Returns the raw JSON value of id.
Unlike id, this method doesn't throw if the JSON field has an unexpected type.
-
_assistantId
final JsonField<String> _assistantId()
Returns the raw JSON value of assistantId.
Unlike assistantId, this method doesn't throw if the JSON field has an unexpected type.
-
_cancelledAt
final JsonField<Long> _cancelledAt()
Returns the raw JSON value of cancelledAt.
Unlike cancelledAt, this method doesn't throw if the JSON field has an unexpected type.
-
_completedAt
final JsonField<Long> _completedAt()
Returns the raw JSON value of completedAt.
Unlike completedAt, this method doesn't throw if the JSON field has an unexpected type.
-
_createdAt
final JsonField<Long> _createdAt()
Returns the raw JSON value of createdAt.
Unlike createdAt, this method doesn't throw if the JSON field has an unexpected type.
-
_expiresAt
final JsonField<Long> _expiresAt()
Returns the raw JSON value of expiresAt.
Unlike expiresAt, this method doesn't throw if the JSON field has an unexpected type.
-
_failedAt
final JsonField<Long> _failedAt()
Returns the raw JSON value of failedAt.
Unlike failedAt, this method doesn't throw if the JSON field has an unexpected type.
-
_incompleteDetails
final JsonField<Run.IncompleteDetails> _incompleteDetails()
Returns the raw JSON value of incompleteDetails.
Unlike incompleteDetails, this method doesn't throw if the JSON field has an unexpected type.
-
_instructions
final JsonField<String> _instructions()
Returns the raw JSON value of instructions.
Unlike instructions, this method doesn't throw if the JSON field has an unexpected type.
-
_lastError
final JsonField<Run.LastError> _lastError()
Returns the raw JSON value of lastError.
Unlike lastError, this method doesn't throw if the JSON field has an unexpected type.
-
_maxCompletionTokens
final JsonField<Long> _maxCompletionTokens()
Returns the raw JSON value of maxCompletionTokens.
Unlike maxCompletionTokens, this method doesn't throw if the JSON field has an unexpected type.
-
_maxPromptTokens
final JsonField<Long> _maxPromptTokens()
Returns the raw JSON value of maxPromptTokens.
Unlike maxPromptTokens, this method doesn't throw if the JSON field has an unexpected type.
-
_metadata
final JsonField<Run.Metadata> _metadata()
Returns the raw JSON value of metadata.
Unlike metadata, this method doesn't throw if the JSON field has an unexpected type.
-
_model
final JsonField<String> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_parallelToolCalls
final JsonField<Boolean> _parallelToolCalls()
Returns the raw JSON value of parallelToolCalls.
Unlike parallelToolCalls, this method doesn't throw if the JSON field has an unexpected type.
-
_requiredAction
final JsonField<Run.RequiredAction> _requiredAction()
Returns the raw JSON value of requiredAction.
Unlike requiredAction, this method doesn't throw if the JSON field has an unexpected type.
-
_responseFormat
final JsonField<AssistantResponseFormatOption> _responseFormat()
Returns the raw JSON value of responseFormat.
Unlike responseFormat, this method doesn't throw if the JSON field has an unexpected type.
-
_startedAt
final JsonField<Long> _startedAt()
Returns the raw JSON value of startedAt.
Unlike startedAt, this method doesn't throw if the JSON field has an unexpected type.
-
_status
final JsonField<RunStatus> _status()
Returns the raw JSON value of status.
Unlike status, this method doesn't throw if the JSON field has an unexpected type.
-
_threadId
final JsonField<String> _threadId()
Returns the raw JSON value of threadId.
Unlike threadId, this method doesn't throw if the JSON field has an unexpected type.
-
_toolChoice
final JsonField<AssistantToolChoiceOption> _toolChoice()
Returns the raw JSON value of toolChoice.
Unlike toolChoice, this method doesn't throw if the JSON field has an unexpected type.
-
_tools
final JsonField<List<AssistantTool>> _tools()
Returns the raw JSON value of tools.
Unlike tools, this method doesn't throw if the JSON field has an unexpected type.
-
_truncationStrategy
final JsonField<Run.TruncationStrategy> _truncationStrategy()
Returns the raw JSON value of truncationStrategy.
Unlike truncationStrategy, this method doesn't throw if the JSON field has an unexpected type.
-
_usage
final JsonField<Run.Usage> _usage()
Returns the raw JSON value of usage.
Unlike usage, this method doesn't throw if the JSON field has an unexpected type.
-
_temperature
final JsonField<Double> _temperature()
Returns the raw JSON value of temperature.
Unlike temperature, this method doesn't throw if the JSON field has an unexpected type.
-
_topP
final JsonField<Double> _topP()
Returns the raw JSON value of topP.
Unlike topP, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final Run.Builder toBuilder()
-
builder
final static Run.Builder builder()
Returns a mutable builder for constructing an instance of Run.
The following fields are required:
.id() .assistantId() .cancelledAt() .completedAt() .createdAt() .expiresAt() .failedAt() .incompleteDetails() .instructions() .lastError() .maxCompletionTokens() .maxPromptTokens() .metadata() .model() .parallelToolCalls() .requiredAction() .responseFormat() .startedAt() .status() .threadId() .toolChoice() .tools() .truncationStrategy() .usage()
-
-
-
-