You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,13 +100,30 @@ Documentation for each method, request param, and response field are available i
100
100
> [!IMPORTANT]
101
101
> Previous versions of this SDK used a `Configuration` class. See the [v3 to v4 migration guide](https://github.com/openai/openai-node/discussions/217).
102
102
103
+
### Polling Helpers
104
+
105
+
When interacting with the API some actions such as starting a Run may take time to complete. The SDK includes
106
+
helper functions which will poll the status until it reaches a terminal state and then return the resulting object.
107
+
If an API method results in an action which could benefit from polling there will be a corresponding version of the
108
+
method ending in 'AndPoll'.
109
+
110
+
For instance to create a Run and poll until it reaches a terminal state you can run:
111
+
112
+
```ts
113
+
const run =awaitopenai.beta.threads.runs.createAndPoll(thread.id, {
114
+
assistant_id: assistantId,
115
+
});
116
+
```
117
+
118
+
More information on the lifecycle of a Run can be found in the [Run Lifecycle Documentation](https://platform.openai.com/docs/assistants/how-it-works/run-lifecycle)
119
+
103
120
### Streaming Helpers
104
121
105
122
The SDK also includes helpers to process streams and handle the incoming events.
0 commit comments