openai 4.28.4 → 4.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +7 -10
- package/index.d.mts +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/lib/AbstractAssistantStreamRunner.d.ts +74 -0
- package/lib/AbstractAssistantStreamRunner.d.ts.map +1 -0
- package/lib/AbstractAssistantStreamRunner.js +246 -0
- package/lib/AbstractAssistantStreamRunner.js.map +1 -0
- package/lib/AbstractAssistantStreamRunner.mjs +242 -0
- package/lib/AbstractAssistantStreamRunner.mjs.map +1 -0
- package/lib/AssistantStream.d.ts +56 -0
- package/lib/AssistantStream.d.ts.map +1 -0
- package/lib/AssistantStream.js +526 -0
- package/lib/AssistantStream.js.map +1 -0
- package/lib/AssistantStream.mjs +499 -0
- package/lib/AssistantStream.mjs.map +1 -0
- package/lib/ChatCompletionRunFunctions.test.js +35 -0
- package/lib/ChatCompletionRunFunctions.test.js.map +1 -1
- package/lib/ChatCompletionRunFunctions.test.mjs +35 -0
- package/lib/ChatCompletionRunFunctions.test.mjs.map +1 -1
- package/lib/ChatCompletionStream.d.ts.map +1 -1
- package/lib/ChatCompletionStream.js +21 -3
- package/lib/ChatCompletionStream.js.map +1 -1
- package/lib/ChatCompletionStream.mjs +21 -3
- package/lib/ChatCompletionStream.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/audio/speech.d.ts +3 -6
- package/resources/audio/speech.d.ts.map +1 -1
- package/resources/audio/speech.js.map +1 -1
- package/resources/audio/speech.mjs.map +1 -1
- package/resources/audio/transcriptions.d.ts +14 -4
- package/resources/audio/transcriptions.d.ts.map +1 -1
- package/resources/audio/transcriptions.js.map +1 -1
- package/resources/audio/transcriptions.mjs.map +1 -1
- package/resources/audio/translations.d.ts +2 -1
- package/resources/audio/translations.d.ts.map +1 -1
- package/resources/audio/translations.js.map +1 -1
- package/resources/audio/translations.mjs.map +1 -1
- package/resources/beta/assistants/assistants.d.ts +629 -60
- package/resources/beta/assistants/assistants.d.ts.map +1 -1
- package/resources/beta/assistants/assistants.js.map +1 -1
- package/resources/beta/assistants/assistants.mjs.map +1 -1
- package/resources/beta/assistants/index.d.ts +1 -1
- package/resources/beta/assistants/index.d.ts.map +1 -1
- package/resources/beta/assistants/index.js.map +1 -1
- package/resources/beta/assistants/index.mjs.map +1 -1
- package/resources/beta/beta.d.ts +12 -0
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.ts +2 -2
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/threads/index.d.ts +3 -3
- package/resources/beta/threads/index.d.ts.map +1 -1
- package/resources/beta/threads/index.js +2 -2
- package/resources/beta/threads/index.js.map +1 -1
- package/resources/beta/threads/index.mjs +1 -1
- package/resources/beta/threads/index.mjs.map +1 -1
- package/resources/beta/threads/messages/index.d.ts +1 -1
- package/resources/beta/threads/messages/index.d.ts.map +1 -1
- package/resources/beta/threads/messages/index.js +2 -2
- package/resources/beta/threads/messages/index.js.map +1 -1
- package/resources/beta/threads/messages/index.mjs +1 -1
- package/resources/beta/threads/messages/index.mjs.map +1 -1
- package/resources/beta/threads/messages/messages.d.ts +289 -86
- package/resources/beta/threads/messages/messages.d.ts.map +1 -1
- package/resources/beta/threads/messages/messages.js +5 -5
- package/resources/beta/threads/messages/messages.js.map +1 -1
- package/resources/beta/threads/messages/messages.mjs +3 -3
- package/resources/beta/threads/messages/messages.mjs.map +1 -1
- package/resources/beta/threads/runs/index.d.ts +2 -2
- package/resources/beta/threads/runs/index.d.ts.map +1 -1
- package/resources/beta/threads/runs/index.js.map +1 -1
- package/resources/beta/threads/runs/index.mjs.map +1 -1
- package/resources/beta/threads/runs/runs.d.ts +153 -49
- package/resources/beta/threads/runs/runs.d.ts.map +1 -1
- package/resources/beta/threads/runs/runs.js +14 -7
- package/resources/beta/threads/runs/runs.js.map +1 -1
- package/resources/beta/threads/runs/runs.mjs +14 -7
- package/resources/beta/threads/runs/runs.mjs.map +1 -1
- package/resources/beta/threads/runs/steps.d.ts +219 -5
- package/resources/beta/threads/runs/steps.d.ts.map +1 -1
- package/resources/beta/threads/runs/steps.js.map +1 -1
- package/resources/beta/threads/runs/steps.mjs.map +1 -1
- package/resources/beta/threads/threads.d.ts +144 -22
- package/resources/beta/threads/threads.d.ts.map +1 -1
- package/resources/beta/threads/threads.js +9 -4
- package/resources/beta/threads/threads.js.map +1 -1
- package/resources/beta/threads/threads.mjs +9 -4
- package/resources/beta/threads/threads.mjs.map +1 -1
- package/resources/chat/completions.d.ts +28 -18
- package/resources/chat/completions.d.ts.map +1 -1
- package/resources/chat/completions.js.map +1 -1
- package/resources/chat/completions.mjs.map +1 -1
- package/resources/completions.d.ts +2 -0
- package/resources/completions.d.ts.map +1 -1
- package/resources/completions.js.map +1 -1
- package/resources/completions.mjs.map +1 -1
- package/resources/files.d.ts +4 -4
- package/resources/images.d.ts +6 -3
- package/resources/images.d.ts.map +1 -1
- package/resources/images.js.map +1 -1
- package/resources/images.mjs.map +1 -1
- package/resources/moderations.d.ts +3 -5
- package/resources/moderations.d.ts.map +1 -1
- package/resources/moderations.js +1 -1
- package/resources/moderations.js.map +1 -1
- package/resources/moderations.mjs +1 -1
- package/resources/moderations.mjs.map +1 -1
- package/resources/shared.d.ts +6 -0
- package/resources/shared.d.ts.map +1 -1
- package/src/index.ts +1 -0
- package/src/lib/AbstractAssistantStreamRunner.ts +340 -0
- package/src/lib/AssistantStream.ts +698 -0
- package/src/lib/ChatCompletionRunFunctions.test.ts +52 -1
- package/src/lib/ChatCompletionStream.ts +29 -6
- package/src/resources/audio/speech.ts +3 -6
- package/src/resources/audio/transcriptions.ts +14 -4
- package/src/resources/audio/translations.ts +2 -1
- package/src/resources/beta/assistants/assistants.ts +768 -76
- package/src/resources/beta/assistants/index.ts +9 -0
- package/src/resources/beta/beta.ts +12 -0
- package/src/resources/beta/index.ts +12 -0
- package/src/resources/beta/threads/index.ts +30 -5
- package/src/resources/beta/threads/messages/index.ts +21 -5
- package/src/resources/beta/threads/messages/messages.ts +332 -94
- package/src/resources/beta/threads/runs/index.ts +18 -1
- package/src/resources/beta/threads/runs/runs.ts +225 -60
- package/src/resources/beta/threads/runs/steps.ts +254 -5
- package/src/resources/beta/threads/threads.ts +182 -25
- package/src/resources/chat/completions.ts +28 -18
- package/src/resources/completions.ts +2 -0
- package/src/resources/files.ts +4 -4
- package/src/resources/images.ts +6 -3
- package/src/resources/moderations.ts +3 -5
- package/src/resources/shared.ts +10 -0
- package/src/streaming.ts +31 -0
- package/src/version.ts +1 -1
- package/streaming.d.ts +2 -0
- package/streaming.d.ts.map +1 -1
- package/streaming.js +32 -1
- package/streaming.js.map +1 -1
- package/streaming.mjs +30 -0
- package/streaming.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -3,6 +3,10 @@ import { APIResource } from 'openai/resource';
|
|
|
3
3
|
import * as AssistantsAPI from 'openai/resources/beta/assistants/assistants';
|
|
4
4
|
import * as Shared from 'openai/resources/shared';
|
|
5
5
|
import * as FilesAPI from 'openai/resources/beta/assistants/files';
|
|
6
|
+
import * as ThreadsAPI from 'openai/resources/beta/threads/threads';
|
|
7
|
+
import * as MessagesAPI from 'openai/resources/beta/threads/messages/messages';
|
|
8
|
+
import * as RunsAPI from 'openai/resources/beta/threads/runs/runs';
|
|
9
|
+
import * as StepsAPI from 'openai/resources/beta/threads/runs/steps';
|
|
6
10
|
import { CursorPage, type CursorPageParams } from 'openai/pagination';
|
|
7
11
|
export declare class Assistants extends APIResource {
|
|
8
12
|
files: FilesAPI.Files;
|
|
@@ -84,33 +88,631 @@ export interface Assistant {
|
|
|
84
88
|
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
|
|
85
89
|
* assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.
|
|
86
90
|
*/
|
|
87
|
-
tools: Array<
|
|
91
|
+
tools: Array<AssistantTool>;
|
|
88
92
|
}
|
|
89
|
-
export
|
|
90
|
-
|
|
93
|
+
export interface AssistantDeleted {
|
|
94
|
+
id: string;
|
|
95
|
+
deleted: boolean;
|
|
96
|
+
object: 'assistant.deleted';
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Represents an event emitted when streaming a Run.
|
|
100
|
+
*
|
|
101
|
+
* Each event in a server-sent events stream has an `event` and `data` property:
|
|
102
|
+
*
|
|
103
|
+
* ```
|
|
104
|
+
* event: thread.created
|
|
105
|
+
* data: {"id": "thread_123", "object": "thread", ...}
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* We emit events whenever a new object is created, transitions to a new state, or
|
|
109
|
+
* is being streamed in parts (deltas). For example, we emit `thread.run.created`
|
|
110
|
+
* when a new run is created, `thread.run.completed` when a run completes, and so
|
|
111
|
+
* on. When an Assistant chooses to create a message during a run, we emit a
|
|
112
|
+
* `thread.message.created event`, a `thread.message.in_progress` event, many
|
|
113
|
+
* `thread.message.delta` events, and finally a `thread.message.completed` event.
|
|
114
|
+
*
|
|
115
|
+
* We may add additional events over time, so we recommend handling unknown events
|
|
116
|
+
* gracefully in your code. See the
|
|
117
|
+
* [Assistants API quickstart](https://platform.openai.com/docs/assistants/overview)
|
|
118
|
+
* to learn how to integrate the Assistants API with streaming.
|
|
119
|
+
*/
|
|
120
|
+
export type AssistantStreamEvent = AssistantStreamEvent.ThreadCreated | AssistantStreamEvent.ThreadRunCreated | AssistantStreamEvent.ThreadRunQueued | AssistantStreamEvent.ThreadRunInProgress | AssistantStreamEvent.ThreadRunRequiresAction | AssistantStreamEvent.ThreadRunCompleted | AssistantStreamEvent.ThreadRunFailed | AssistantStreamEvent.ThreadRunCancelling | AssistantStreamEvent.ThreadRunCancelled | AssistantStreamEvent.ThreadRunExpired | AssistantStreamEvent.ThreadRunStepCreated | AssistantStreamEvent.ThreadRunStepInProgress | AssistantStreamEvent.ThreadRunStepDelta | AssistantStreamEvent.ThreadRunStepCompleted | AssistantStreamEvent.ThreadRunStepFailed | AssistantStreamEvent.ThreadRunStepCancelled | AssistantStreamEvent.ThreadRunStepExpired | AssistantStreamEvent.ThreadMessageCreated | AssistantStreamEvent.ThreadMessageInProgress | AssistantStreamEvent.ThreadMessageDelta | AssistantStreamEvent.ThreadMessageCompleted | AssistantStreamEvent.ThreadMessageIncomplete | AssistantStreamEvent.ErrorEvent;
|
|
121
|
+
export declare namespace AssistantStreamEvent {
|
|
122
|
+
/**
|
|
123
|
+
* Occurs when a new
|
|
124
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads/object) is
|
|
125
|
+
* created.
|
|
126
|
+
*/
|
|
127
|
+
interface ThreadCreated {
|
|
128
|
+
/**
|
|
129
|
+
* Represents a thread that contains
|
|
130
|
+
* [messages](https://platform.openai.com/docs/api-reference/messages).
|
|
131
|
+
*/
|
|
132
|
+
data: ThreadsAPI.Thread;
|
|
133
|
+
event: 'thread.created';
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Occurs when a new
|
|
137
|
+
* [run](https://platform.openai.com/docs/api-reference/runs/object) is created.
|
|
138
|
+
*/
|
|
139
|
+
interface ThreadRunCreated {
|
|
140
|
+
/**
|
|
141
|
+
* Represents an execution run on a
|
|
142
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
143
|
+
*/
|
|
144
|
+
data: RunsAPI.Run;
|
|
145
|
+
event: 'thread.run.created';
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
149
|
+
* moves to a `queued` status.
|
|
150
|
+
*/
|
|
151
|
+
interface ThreadRunQueued {
|
|
152
|
+
/**
|
|
153
|
+
* Represents an execution run on a
|
|
154
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
155
|
+
*/
|
|
156
|
+
data: RunsAPI.Run;
|
|
157
|
+
event: 'thread.run.queued';
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
161
|
+
* moves to an `in_progress` status.
|
|
162
|
+
*/
|
|
163
|
+
interface ThreadRunInProgress {
|
|
164
|
+
/**
|
|
165
|
+
* Represents an execution run on a
|
|
166
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
167
|
+
*/
|
|
168
|
+
data: RunsAPI.Run;
|
|
169
|
+
event: 'thread.run.in_progress';
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
173
|
+
* moves to a `requires_action` status.
|
|
174
|
+
*/
|
|
175
|
+
interface ThreadRunRequiresAction {
|
|
176
|
+
/**
|
|
177
|
+
* Represents an execution run on a
|
|
178
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
179
|
+
*/
|
|
180
|
+
data: RunsAPI.Run;
|
|
181
|
+
event: 'thread.run.requires_action';
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
185
|
+
* is completed.
|
|
186
|
+
*/
|
|
187
|
+
interface ThreadRunCompleted {
|
|
91
188
|
/**
|
|
92
|
-
*
|
|
189
|
+
* Represents an execution run on a
|
|
190
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
93
191
|
*/
|
|
94
|
-
|
|
192
|
+
data: RunsAPI.Run;
|
|
193
|
+
event: 'thread.run.completed';
|
|
95
194
|
}
|
|
96
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
197
|
+
* fails.
|
|
198
|
+
*/
|
|
199
|
+
interface ThreadRunFailed {
|
|
97
200
|
/**
|
|
98
|
-
*
|
|
201
|
+
* Represents an execution run on a
|
|
202
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
99
203
|
*/
|
|
100
|
-
|
|
204
|
+
data: RunsAPI.Run;
|
|
205
|
+
event: 'thread.run.failed';
|
|
101
206
|
}
|
|
102
|
-
|
|
103
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
209
|
+
* moves to a `cancelling` status.
|
|
210
|
+
*/
|
|
211
|
+
interface ThreadRunCancelling {
|
|
104
212
|
/**
|
|
105
|
-
*
|
|
213
|
+
* Represents an execution run on a
|
|
214
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
106
215
|
*/
|
|
107
|
-
|
|
216
|
+
data: RunsAPI.Run;
|
|
217
|
+
event: 'thread.run.cancelling';
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
221
|
+
* is cancelled.
|
|
222
|
+
*/
|
|
223
|
+
interface ThreadRunCancelled {
|
|
224
|
+
/**
|
|
225
|
+
* Represents an execution run on a
|
|
226
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
227
|
+
*/
|
|
228
|
+
data: RunsAPI.Run;
|
|
229
|
+
event: 'thread.run.cancelled';
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
233
|
+
* expires.
|
|
234
|
+
*/
|
|
235
|
+
interface ThreadRunExpired {
|
|
236
|
+
/**
|
|
237
|
+
* Represents an execution run on a
|
|
238
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
239
|
+
*/
|
|
240
|
+
data: RunsAPI.Run;
|
|
241
|
+
event: 'thread.run.expired';
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Occurs when a
|
|
245
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object) is
|
|
246
|
+
* created.
|
|
247
|
+
*/
|
|
248
|
+
interface ThreadRunStepCreated {
|
|
249
|
+
/**
|
|
250
|
+
* Represents a step in execution of a run.
|
|
251
|
+
*/
|
|
252
|
+
data: StepsAPI.RunStep;
|
|
253
|
+
event: 'thread.run.step.created';
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Occurs when a
|
|
257
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object)
|
|
258
|
+
* moves to an `in_progress` state.
|
|
259
|
+
*/
|
|
260
|
+
interface ThreadRunStepInProgress {
|
|
261
|
+
/**
|
|
262
|
+
* Represents a step in execution of a run.
|
|
263
|
+
*/
|
|
264
|
+
data: StepsAPI.RunStep;
|
|
265
|
+
event: 'thread.run.step.in_progress';
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Occurs when parts of a
|
|
269
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object) are
|
|
270
|
+
* being streamed.
|
|
271
|
+
*/
|
|
272
|
+
interface ThreadRunStepDelta {
|
|
273
|
+
/**
|
|
274
|
+
* Represents a run step delta i.e. any changed fields on a run step during
|
|
275
|
+
* streaming.
|
|
276
|
+
*/
|
|
277
|
+
data: StepsAPI.RunStepDeltaEvent;
|
|
278
|
+
event: 'thread.run.step.delta';
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Occurs when a
|
|
282
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object) is
|
|
283
|
+
* completed.
|
|
284
|
+
*/
|
|
285
|
+
interface ThreadRunStepCompleted {
|
|
286
|
+
/**
|
|
287
|
+
* Represents a step in execution of a run.
|
|
288
|
+
*/
|
|
289
|
+
data: StepsAPI.RunStep;
|
|
290
|
+
event: 'thread.run.step.completed';
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Occurs when a
|
|
294
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object)
|
|
295
|
+
* fails.
|
|
296
|
+
*/
|
|
297
|
+
interface ThreadRunStepFailed {
|
|
298
|
+
/**
|
|
299
|
+
* Represents a step in execution of a run.
|
|
300
|
+
*/
|
|
301
|
+
data: StepsAPI.RunStep;
|
|
302
|
+
event: 'thread.run.step.failed';
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Occurs when a
|
|
306
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object) is
|
|
307
|
+
* cancelled.
|
|
308
|
+
*/
|
|
309
|
+
interface ThreadRunStepCancelled {
|
|
310
|
+
/**
|
|
311
|
+
* Represents a step in execution of a run.
|
|
312
|
+
*/
|
|
313
|
+
data: StepsAPI.RunStep;
|
|
314
|
+
event: 'thread.run.step.cancelled';
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Occurs when a
|
|
318
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object)
|
|
319
|
+
* expires.
|
|
320
|
+
*/
|
|
321
|
+
interface ThreadRunStepExpired {
|
|
322
|
+
/**
|
|
323
|
+
* Represents a step in execution of a run.
|
|
324
|
+
*/
|
|
325
|
+
data: StepsAPI.RunStep;
|
|
326
|
+
event: 'thread.run.step.expired';
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Occurs when a
|
|
330
|
+
* [message](https://platform.openai.com/docs/api-reference/messages/object) is
|
|
331
|
+
* created.
|
|
332
|
+
*/
|
|
333
|
+
interface ThreadMessageCreated {
|
|
334
|
+
/**
|
|
335
|
+
* Represents a message within a
|
|
336
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
337
|
+
*/
|
|
338
|
+
data: MessagesAPI.Message;
|
|
339
|
+
event: 'thread.message.created';
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Occurs when a
|
|
343
|
+
* [message](https://platform.openai.com/docs/api-reference/messages/object) moves
|
|
344
|
+
* to an `in_progress` state.
|
|
345
|
+
*/
|
|
346
|
+
interface ThreadMessageInProgress {
|
|
347
|
+
/**
|
|
348
|
+
* Represents a message within a
|
|
349
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
350
|
+
*/
|
|
351
|
+
data: MessagesAPI.Message;
|
|
352
|
+
event: 'thread.message.in_progress';
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Occurs when parts of a
|
|
356
|
+
* [Message](https://platform.openai.com/docs/api-reference/messages/object) are
|
|
357
|
+
* being streamed.
|
|
358
|
+
*/
|
|
359
|
+
interface ThreadMessageDelta {
|
|
360
|
+
/**
|
|
361
|
+
* Represents a message delta i.e. any changed fields on a message during
|
|
362
|
+
* streaming.
|
|
363
|
+
*/
|
|
364
|
+
data: MessagesAPI.MessageDeltaEvent;
|
|
365
|
+
event: 'thread.message.delta';
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Occurs when a
|
|
369
|
+
* [message](https://platform.openai.com/docs/api-reference/messages/object) is
|
|
370
|
+
* completed.
|
|
371
|
+
*/
|
|
372
|
+
interface ThreadMessageCompleted {
|
|
373
|
+
/**
|
|
374
|
+
* Represents a message within a
|
|
375
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
376
|
+
*/
|
|
377
|
+
data: MessagesAPI.Message;
|
|
378
|
+
event: 'thread.message.completed';
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Occurs when a
|
|
382
|
+
* [message](https://platform.openai.com/docs/api-reference/messages/object) ends
|
|
383
|
+
* before it is completed.
|
|
384
|
+
*/
|
|
385
|
+
interface ThreadMessageIncomplete {
|
|
386
|
+
/**
|
|
387
|
+
* Represents a message within a
|
|
388
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
389
|
+
*/
|
|
390
|
+
data: MessagesAPI.Message;
|
|
391
|
+
event: 'thread.message.incomplete';
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Occurs when an
|
|
395
|
+
* [error](https://platform.openai.com/docs/guides/error-codes/api-errors) occurs.
|
|
396
|
+
* This can happen due to an internal server error or a timeout.
|
|
397
|
+
*/
|
|
398
|
+
interface ErrorEvent {
|
|
399
|
+
data: Shared.ErrorObject;
|
|
400
|
+
event: 'error';
|
|
108
401
|
}
|
|
109
402
|
}
|
|
110
|
-
export
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
403
|
+
export type AssistantTool = CodeInterpreterTool | RetrievalTool | FunctionTool;
|
|
404
|
+
export interface CodeInterpreterTool {
|
|
405
|
+
/**
|
|
406
|
+
* The type of tool being defined: `code_interpreter`
|
|
407
|
+
*/
|
|
408
|
+
type: 'code_interpreter';
|
|
409
|
+
}
|
|
410
|
+
export interface FunctionTool {
|
|
411
|
+
function: Shared.FunctionDefinition;
|
|
412
|
+
/**
|
|
413
|
+
* The type of tool being defined: `function`
|
|
414
|
+
*/
|
|
415
|
+
type: 'function';
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Occurs when a
|
|
419
|
+
* [message](https://platform.openai.com/docs/api-reference/messages/object) is
|
|
420
|
+
* created.
|
|
421
|
+
*/
|
|
422
|
+
export type MessageStreamEvent = MessageStreamEvent.ThreadMessageCreated | MessageStreamEvent.ThreadMessageInProgress | MessageStreamEvent.ThreadMessageDelta | MessageStreamEvent.ThreadMessageCompleted | MessageStreamEvent.ThreadMessageIncomplete;
|
|
423
|
+
export declare namespace MessageStreamEvent {
|
|
424
|
+
/**
|
|
425
|
+
* Occurs when a
|
|
426
|
+
* [message](https://platform.openai.com/docs/api-reference/messages/object) is
|
|
427
|
+
* created.
|
|
428
|
+
*/
|
|
429
|
+
interface ThreadMessageCreated {
|
|
430
|
+
/**
|
|
431
|
+
* Represents a message within a
|
|
432
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
433
|
+
*/
|
|
434
|
+
data: MessagesAPI.Message;
|
|
435
|
+
event: 'thread.message.created';
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Occurs when a
|
|
439
|
+
* [message](https://platform.openai.com/docs/api-reference/messages/object) moves
|
|
440
|
+
* to an `in_progress` state.
|
|
441
|
+
*/
|
|
442
|
+
interface ThreadMessageInProgress {
|
|
443
|
+
/**
|
|
444
|
+
* Represents a message within a
|
|
445
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
446
|
+
*/
|
|
447
|
+
data: MessagesAPI.Message;
|
|
448
|
+
event: 'thread.message.in_progress';
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Occurs when parts of a
|
|
452
|
+
* [Message](https://platform.openai.com/docs/api-reference/messages/object) are
|
|
453
|
+
* being streamed.
|
|
454
|
+
*/
|
|
455
|
+
interface ThreadMessageDelta {
|
|
456
|
+
/**
|
|
457
|
+
* Represents a message delta i.e. any changed fields on a message during
|
|
458
|
+
* streaming.
|
|
459
|
+
*/
|
|
460
|
+
data: MessagesAPI.MessageDeltaEvent;
|
|
461
|
+
event: 'thread.message.delta';
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Occurs when a
|
|
465
|
+
* [message](https://platform.openai.com/docs/api-reference/messages/object) is
|
|
466
|
+
* completed.
|
|
467
|
+
*/
|
|
468
|
+
interface ThreadMessageCompleted {
|
|
469
|
+
/**
|
|
470
|
+
* Represents a message within a
|
|
471
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
472
|
+
*/
|
|
473
|
+
data: MessagesAPI.Message;
|
|
474
|
+
event: 'thread.message.completed';
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Occurs when a
|
|
478
|
+
* [message](https://platform.openai.com/docs/api-reference/messages/object) ends
|
|
479
|
+
* before it is completed.
|
|
480
|
+
*/
|
|
481
|
+
interface ThreadMessageIncomplete {
|
|
482
|
+
/**
|
|
483
|
+
* Represents a message within a
|
|
484
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
485
|
+
*/
|
|
486
|
+
data: MessagesAPI.Message;
|
|
487
|
+
event: 'thread.message.incomplete';
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
export interface RetrievalTool {
|
|
491
|
+
/**
|
|
492
|
+
* The type of tool being defined: `retrieval`
|
|
493
|
+
*/
|
|
494
|
+
type: 'retrieval';
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Occurs when a
|
|
498
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object) is
|
|
499
|
+
* created.
|
|
500
|
+
*/
|
|
501
|
+
export type RunStepStreamEvent = RunStepStreamEvent.ThreadRunStepCreated | RunStepStreamEvent.ThreadRunStepInProgress | RunStepStreamEvent.ThreadRunStepDelta | RunStepStreamEvent.ThreadRunStepCompleted | RunStepStreamEvent.ThreadRunStepFailed | RunStepStreamEvent.ThreadRunStepCancelled | RunStepStreamEvent.ThreadRunStepExpired;
|
|
502
|
+
export declare namespace RunStepStreamEvent {
|
|
503
|
+
/**
|
|
504
|
+
* Occurs when a
|
|
505
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object) is
|
|
506
|
+
* created.
|
|
507
|
+
*/
|
|
508
|
+
interface ThreadRunStepCreated {
|
|
509
|
+
/**
|
|
510
|
+
* Represents a step in execution of a run.
|
|
511
|
+
*/
|
|
512
|
+
data: StepsAPI.RunStep;
|
|
513
|
+
event: 'thread.run.step.created';
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Occurs when a
|
|
517
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object)
|
|
518
|
+
* moves to an `in_progress` state.
|
|
519
|
+
*/
|
|
520
|
+
interface ThreadRunStepInProgress {
|
|
521
|
+
/**
|
|
522
|
+
* Represents a step in execution of a run.
|
|
523
|
+
*/
|
|
524
|
+
data: StepsAPI.RunStep;
|
|
525
|
+
event: 'thread.run.step.in_progress';
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Occurs when parts of a
|
|
529
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object) are
|
|
530
|
+
* being streamed.
|
|
531
|
+
*/
|
|
532
|
+
interface ThreadRunStepDelta {
|
|
533
|
+
/**
|
|
534
|
+
* Represents a run step delta i.e. any changed fields on a run step during
|
|
535
|
+
* streaming.
|
|
536
|
+
*/
|
|
537
|
+
data: StepsAPI.RunStepDeltaEvent;
|
|
538
|
+
event: 'thread.run.step.delta';
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Occurs when a
|
|
542
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object) is
|
|
543
|
+
* completed.
|
|
544
|
+
*/
|
|
545
|
+
interface ThreadRunStepCompleted {
|
|
546
|
+
/**
|
|
547
|
+
* Represents a step in execution of a run.
|
|
548
|
+
*/
|
|
549
|
+
data: StepsAPI.RunStep;
|
|
550
|
+
event: 'thread.run.step.completed';
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Occurs when a
|
|
554
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object)
|
|
555
|
+
* fails.
|
|
556
|
+
*/
|
|
557
|
+
interface ThreadRunStepFailed {
|
|
558
|
+
/**
|
|
559
|
+
* Represents a step in execution of a run.
|
|
560
|
+
*/
|
|
561
|
+
data: StepsAPI.RunStep;
|
|
562
|
+
event: 'thread.run.step.failed';
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Occurs when a
|
|
566
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object) is
|
|
567
|
+
* cancelled.
|
|
568
|
+
*/
|
|
569
|
+
interface ThreadRunStepCancelled {
|
|
570
|
+
/**
|
|
571
|
+
* Represents a step in execution of a run.
|
|
572
|
+
*/
|
|
573
|
+
data: StepsAPI.RunStep;
|
|
574
|
+
event: 'thread.run.step.cancelled';
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Occurs when a
|
|
578
|
+
* [run step](https://platform.openai.com/docs/api-reference/runs/step-object)
|
|
579
|
+
* expires.
|
|
580
|
+
*/
|
|
581
|
+
interface ThreadRunStepExpired {
|
|
582
|
+
/**
|
|
583
|
+
* Represents a step in execution of a run.
|
|
584
|
+
*/
|
|
585
|
+
data: StepsAPI.RunStep;
|
|
586
|
+
event: 'thread.run.step.expired';
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Occurs when a new
|
|
591
|
+
* [run](https://platform.openai.com/docs/api-reference/runs/object) is created.
|
|
592
|
+
*/
|
|
593
|
+
export type RunStreamEvent = RunStreamEvent.ThreadRunCreated | RunStreamEvent.ThreadRunQueued | RunStreamEvent.ThreadRunInProgress | RunStreamEvent.ThreadRunRequiresAction | RunStreamEvent.ThreadRunCompleted | RunStreamEvent.ThreadRunFailed | RunStreamEvent.ThreadRunCancelling | RunStreamEvent.ThreadRunCancelled | RunStreamEvent.ThreadRunExpired;
|
|
594
|
+
export declare namespace RunStreamEvent {
|
|
595
|
+
/**
|
|
596
|
+
* Occurs when a new
|
|
597
|
+
* [run](https://platform.openai.com/docs/api-reference/runs/object) is created.
|
|
598
|
+
*/
|
|
599
|
+
interface ThreadRunCreated {
|
|
600
|
+
/**
|
|
601
|
+
* Represents an execution run on a
|
|
602
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
603
|
+
*/
|
|
604
|
+
data: RunsAPI.Run;
|
|
605
|
+
event: 'thread.run.created';
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
609
|
+
* moves to a `queued` status.
|
|
610
|
+
*/
|
|
611
|
+
interface ThreadRunQueued {
|
|
612
|
+
/**
|
|
613
|
+
* Represents an execution run on a
|
|
614
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
615
|
+
*/
|
|
616
|
+
data: RunsAPI.Run;
|
|
617
|
+
event: 'thread.run.queued';
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
621
|
+
* moves to an `in_progress` status.
|
|
622
|
+
*/
|
|
623
|
+
interface ThreadRunInProgress {
|
|
624
|
+
/**
|
|
625
|
+
* Represents an execution run on a
|
|
626
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
627
|
+
*/
|
|
628
|
+
data: RunsAPI.Run;
|
|
629
|
+
event: 'thread.run.in_progress';
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
633
|
+
* moves to a `requires_action` status.
|
|
634
|
+
*/
|
|
635
|
+
interface ThreadRunRequiresAction {
|
|
636
|
+
/**
|
|
637
|
+
* Represents an execution run on a
|
|
638
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
639
|
+
*/
|
|
640
|
+
data: RunsAPI.Run;
|
|
641
|
+
event: 'thread.run.requires_action';
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
645
|
+
* is completed.
|
|
646
|
+
*/
|
|
647
|
+
interface ThreadRunCompleted {
|
|
648
|
+
/**
|
|
649
|
+
* Represents an execution run on a
|
|
650
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
651
|
+
*/
|
|
652
|
+
data: RunsAPI.Run;
|
|
653
|
+
event: 'thread.run.completed';
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
657
|
+
* fails.
|
|
658
|
+
*/
|
|
659
|
+
interface ThreadRunFailed {
|
|
660
|
+
/**
|
|
661
|
+
* Represents an execution run on a
|
|
662
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
663
|
+
*/
|
|
664
|
+
data: RunsAPI.Run;
|
|
665
|
+
event: 'thread.run.failed';
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
669
|
+
* moves to a `cancelling` status.
|
|
670
|
+
*/
|
|
671
|
+
interface ThreadRunCancelling {
|
|
672
|
+
/**
|
|
673
|
+
* Represents an execution run on a
|
|
674
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
675
|
+
*/
|
|
676
|
+
data: RunsAPI.Run;
|
|
677
|
+
event: 'thread.run.cancelling';
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
681
|
+
* is cancelled.
|
|
682
|
+
*/
|
|
683
|
+
interface ThreadRunCancelled {
|
|
684
|
+
/**
|
|
685
|
+
* Represents an execution run on a
|
|
686
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
687
|
+
*/
|
|
688
|
+
data: RunsAPI.Run;
|
|
689
|
+
event: 'thread.run.cancelled';
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object)
|
|
693
|
+
* expires.
|
|
694
|
+
*/
|
|
695
|
+
interface ThreadRunExpired {
|
|
696
|
+
/**
|
|
697
|
+
* Represents an execution run on a
|
|
698
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
|
699
|
+
*/
|
|
700
|
+
data: RunsAPI.Run;
|
|
701
|
+
event: 'thread.run.expired';
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Occurs when a new
|
|
706
|
+
* [thread](https://platform.openai.com/docs/api-reference/threads/object) is
|
|
707
|
+
* created.
|
|
708
|
+
*/
|
|
709
|
+
export interface ThreadStreamEvent {
|
|
710
|
+
/**
|
|
711
|
+
* Represents a thread that contains
|
|
712
|
+
* [messages](https://platform.openai.com/docs/api-reference/messages).
|
|
713
|
+
*/
|
|
714
|
+
data: ThreadsAPI.Thread;
|
|
715
|
+
event: 'thread.created';
|
|
114
716
|
}
|
|
115
717
|
export interface AssistantCreateParams {
|
|
116
718
|
/**
|
|
@@ -151,28 +753,7 @@ export interface AssistantCreateParams {
|
|
|
151
753
|
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
|
|
152
754
|
* assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.
|
|
153
755
|
*/
|
|
154
|
-
tools?: Array<
|
|
155
|
-
}
|
|
156
|
-
export declare namespace AssistantCreateParams {
|
|
157
|
-
interface AssistantToolsCode {
|
|
158
|
-
/**
|
|
159
|
-
* The type of tool being defined: `code_interpreter`
|
|
160
|
-
*/
|
|
161
|
-
type: 'code_interpreter';
|
|
162
|
-
}
|
|
163
|
-
interface AssistantToolsRetrieval {
|
|
164
|
-
/**
|
|
165
|
-
* The type of tool being defined: `retrieval`
|
|
166
|
-
*/
|
|
167
|
-
type: 'retrieval';
|
|
168
|
-
}
|
|
169
|
-
interface AssistantToolsFunction {
|
|
170
|
-
function: Shared.FunctionDefinition;
|
|
171
|
-
/**
|
|
172
|
-
* The type of tool being defined: `function`
|
|
173
|
-
*/
|
|
174
|
-
type: 'function';
|
|
175
|
-
}
|
|
756
|
+
tools?: Array<AssistantTool>;
|
|
176
757
|
}
|
|
177
758
|
export interface AssistantUpdateParams {
|
|
178
759
|
/**
|
|
@@ -215,28 +796,7 @@ export interface AssistantUpdateParams {
|
|
|
215
796
|
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
|
|
216
797
|
* assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.
|
|
217
798
|
*/
|
|
218
|
-
tools?: Array<
|
|
219
|
-
}
|
|
220
|
-
export declare namespace AssistantUpdateParams {
|
|
221
|
-
interface AssistantToolsCode {
|
|
222
|
-
/**
|
|
223
|
-
* The type of tool being defined: `code_interpreter`
|
|
224
|
-
*/
|
|
225
|
-
type: 'code_interpreter';
|
|
226
|
-
}
|
|
227
|
-
interface AssistantToolsRetrieval {
|
|
228
|
-
/**
|
|
229
|
-
* The type of tool being defined: `retrieval`
|
|
230
|
-
*/
|
|
231
|
-
type: 'retrieval';
|
|
232
|
-
}
|
|
233
|
-
interface AssistantToolsFunction {
|
|
234
|
-
function: Shared.FunctionDefinition;
|
|
235
|
-
/**
|
|
236
|
-
* The type of tool being defined: `function`
|
|
237
|
-
*/
|
|
238
|
-
type: 'function';
|
|
239
|
-
}
|
|
799
|
+
tools?: Array<AssistantTool>;
|
|
240
800
|
}
|
|
241
801
|
export interface AssistantListParams extends CursorPageParams {
|
|
242
802
|
/**
|
|
@@ -255,6 +815,15 @@ export interface AssistantListParams extends CursorPageParams {
|
|
|
255
815
|
export declare namespace Assistants {
|
|
256
816
|
export import Assistant = AssistantsAPI.Assistant;
|
|
257
817
|
export import AssistantDeleted = AssistantsAPI.AssistantDeleted;
|
|
818
|
+
export import AssistantStreamEvent = AssistantsAPI.AssistantStreamEvent;
|
|
819
|
+
export import AssistantTool = AssistantsAPI.AssistantTool;
|
|
820
|
+
export import CodeInterpreterTool = AssistantsAPI.CodeInterpreterTool;
|
|
821
|
+
export import FunctionTool = AssistantsAPI.FunctionTool;
|
|
822
|
+
export import MessageStreamEvent = AssistantsAPI.MessageStreamEvent;
|
|
823
|
+
export import RetrievalTool = AssistantsAPI.RetrievalTool;
|
|
824
|
+
export import RunStepStreamEvent = AssistantsAPI.RunStepStreamEvent;
|
|
825
|
+
export import RunStreamEvent = AssistantsAPI.RunStreamEvent;
|
|
826
|
+
export import ThreadStreamEvent = AssistantsAPI.ThreadStreamEvent;
|
|
258
827
|
export import AssistantsPage = AssistantsAPI.AssistantsPage;
|
|
259
828
|
export import AssistantCreateParams = AssistantsAPI.AssistantCreateParams;
|
|
260
829
|
export import AssistantUpdateParams = AssistantsAPI.AssistantUpdateParams;
|