Skip to content

Commit

Permalink
chore(types): extract run status to a named type (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Feb 22, 2024
1 parent f2704d5 commit b3b3b8e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
if: github.repository == 'openai/openai-node'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ Types:

- <code><a href="./src/resources/beta/threads/runs/runs.ts">RequiredActionFunctionToolCall</a></code>
- <code><a href="./src/resources/beta/threads/runs/runs.ts">Run</a></code>
- <code><a href="./src/resources/beta/threads/runs/runs.ts">RunStatus</a></code>

Methods:

Expand Down
1 change: 1 addition & 0 deletions src/resources/beta/threads/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export {
export {
RequiredActionFunctionToolCall,
Run,
RunStatus,
RunCreateParams,
RunUpdateParams,
RunListParams,
Expand Down
1 change: 1 addition & 0 deletions src/resources/beta/threads/runs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export {
export {
RequiredActionFunctionToolCall,
Run,
RunStatus,
RunCreateParams,
RunUpdateParams,
RunListParams,
Expand Down
26 changes: 17 additions & 9 deletions src/resources/beta/threads/runs/runs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,7 @@ export interface Run {
* `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, or
* `expired`.
*/
status:
| 'queued'
| 'in_progress'
| 'requires_action'
| 'cancelling'
| 'cancelled'
| 'failed'
| 'completed'
| 'expired';
status: RunStatus;

/**
* The ID of the [thread](https://platform.openai.com/docs/api-reference/threads)
Expand Down Expand Up @@ -361,6 +353,21 @@ export namespace Run {
}
}

/**
* The status of the run, which can be either `queued`, `in_progress`,
* `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, or
* `expired`.
*/
export type RunStatus =
| 'queued'
| 'in_progress'
| 'requires_action'
| 'cancelling'
| 'cancelled'
| 'failed'
| 'completed'
| 'expired';

export interface RunCreateParams {
/**
* The ID of the
Expand Down Expand Up @@ -486,6 +493,7 @@ export namespace RunSubmitToolOutputsParams {
export namespace Runs {
export import RequiredActionFunctionToolCall = RunsAPI.RequiredActionFunctionToolCall;
export import Run = RunsAPI.Run;
export import RunStatus = RunsAPI.RunStatus;
export import RunsPage = RunsAPI.RunsPage;
export import RunCreateParams = RunsAPI.RunCreateParams;
export import RunUpdateParams = RunsAPI.RunUpdateParams;
Expand Down
1 change: 1 addition & 0 deletions src/resources/beta/threads/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export namespace Threads {
export import Runs = RunsAPI.Runs;
export import RequiredActionFunctionToolCall = RunsAPI.RequiredActionFunctionToolCall;
export import Run = RunsAPI.Run;
export import RunStatus = RunsAPI.RunStatus;
export import RunsPage = RunsAPI.RunsPage;
export import RunCreateParams = RunsAPI.RunCreateParams;
export import RunUpdateParams = RunsAPI.RunUpdateParams;
Expand Down

0 comments on commit b3b3b8e

Please sign in to comment.