11package com.cjcrafter.openai.threads.runs
22
3+ import com.cjcrafter.openai.assistants.Assistant
4+ import com.cjcrafter.openai.chat.tool.Tool
5+ import com.cjcrafter.openai.threads.Thread
6+ import com.cjcrafter.openai.threads.message.ThreadMessage
37import com.fasterxml.jackson.annotation.JsonProperty
48
9+ /* *
10+ *
11+ */
512enum class RunStatus (
6- val isDone : Boolean ,
13+ val isTerminal : Boolean ,
714) {
815
16+ /* *
17+ * When [Run]s are first created or when you complete the [RequiredAction],
18+ * they are moved to this 'queued' status. They should _almost immediately_
19+ * move to [IN_PROGRESS].
20+ */
921 @JsonProperty(" queued" )
1022 QUEUED (false ),
1123
24+ /* *
25+ * While [IN_PROGRESS], the [Assistant] uses the mode and tools to perform
26+ * steps. You can view progress being made by the [Run] by examining the
27+ * [RunStep]s.
28+ */
1229 @JsonProperty(" in_progress" )
1330 IN_PROGRESS (false ),
1431
15- @JsonProperty(" requires_action" )
16- REQUIRES_ACTION (true ),
32+ /* *
33+ * When using the [Tool.FunctionTool], the [Run] will move to a [REQUIRED_ACTION]
34+ * state once the model determines the names and arguments of the functions
35+ * to be called. You must then run those functions and submit the outputs
36+ * using [RunHandler.submitToolOutputs] before the run proceeds. If the
37+ * outputs are not provided before the [Run.expiresAt] timestamp passes
38+ * (roughly 10 minutes past creation), the run will move to an [EXPIRED]
39+ * status.
40+ */
41+ @JsonProperty(" required_action" )
42+ REQUIRED_ACTION (true ),
1743
44+ /* *
45+ * You can attempt to cancel an [IN_PROGRESS] [Run] using [RunHandler.cancel].
46+ * Once the attempt to cancel succeeds, status of the [Run] moves to
47+ * [CANCELLED]. Cancellation is attempted but not guarenteed.
48+ */
1849 @JsonProperty(" cancelling" )
1950 CANCELLING (false ),
2051
52+ /* *
53+ * The [Run] was successfully cancelled.
54+ */
2155 @JsonProperty(" cancelled" )
2256 CANCELLED (true ),
2357
58+ /* *
59+ * You can view the reason for the failure by looking at the [Run.lastError]
60+ * object in the run (see [RunError]). The timestamp for the failure is
61+ * recorded under the [Run.failedAt].
62+ */
2463 @JsonProperty(" failed" )
2564 FAILED (true ),
2665
66+ /* *
67+ * The [Run] successfully completed! You can now view all [ThreadMessage]s
68+ * the [Assistant] added to the [Thread], and all the steps the [Run] took.
69+ * You can also continue the conversation by adding more [ThreadMessage]s
70+ * to the [Thread] and creating another [Run].
71+ */
2772 @JsonProperty(" completed" )
2873 COMPLETED (true ),
2974
75+ /* *
76+ * This happens when the function calling outputs were not submitted before
77+ * [Run.expiresAt] and the [Run] expires. Additionally, if the runs take
78+ * too long to execute and go beyond the time stated in [Run.expiresAt],
79+ * OpenAI's systems will expire the [Run].
80+ */
3081 @JsonProperty(" expired" )
3182 EXPIRED (true ),
3283}
0 commit comments