openai 4.83.0 → 4.84.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 +25 -0
- package/README.md +90 -331
- package/beta/realtime/websocket.d.ts +1 -1
- package/beta/realtime/websocket.d.ts.map +1 -1
- package/beta/realtime/websocket.js.map +1 -1
- package/beta/realtime/websocket.mjs.map +1 -1
- package/beta/realtime/ws.d.ts +1 -1
- package/beta/realtime/ws.d.ts.map +1 -1
- package/beta/realtime/ws.js.map +1 -1
- package/beta/realtime/ws.mjs.map +1 -1
- package/internal/decoders/line.d.ts +2 -2
- package/internal/decoders/line.d.ts.map +1 -1
- package/internal/decoders/line.js +69 -34
- package/internal/decoders/line.js.map +1 -1
- package/internal/decoders/line.mjs +69 -34
- package/internal/decoders/line.mjs.map +1 -1
- package/lib/AssistantStream.d.ts.map +1 -1
- package/lib/AssistantStream.js +4 -0
- package/lib/AssistantStream.js.map +1 -1
- package/lib/AssistantStream.mjs +4 -0
- package/lib/AssistantStream.mjs.map +1 -1
- package/package.json +1 -1
- package/pagination.d.ts +3 -0
- package/pagination.d.ts.map +1 -1
- package/pagination.js +7 -0
- package/pagination.js.map +1 -1
- package/pagination.mjs +7 -0
- package/pagination.mjs.map +1 -1
- package/resources/beta/assistants.d.ts +19 -1
- package/resources/beta/assistants.d.ts.map +1 -1
- package/resources/beta/assistants.js.map +1 -1
- package/resources/beta/assistants.mjs.map +1 -1
- package/resources/beta/threads/runs/runs.d.ts +9 -0
- package/resources/beta/threads/runs/runs.d.ts.map +1 -1
- package/resources/beta/threads/runs/runs.js.map +1 -1
- package/resources/beta/threads/runs/runs.mjs.map +1 -1
- package/resources/chat/completions.d.ts +4 -4
- package/resources/chat/completions.d.ts.map +1 -1
- package/src/beta/realtime/websocket.ts +1 -1
- package/src/beta/realtime/ws.ts +2 -2
- package/src/internal/decoders/line.ts +69 -38
- package/src/lib/AssistantStream.ts +5 -0
- package/src/pagination.ts +13 -0
- package/src/resources/beta/assistants.ts +50 -1
- package/src/resources/beta/threads/runs/runs.ts +10 -0
- package/src/resources/chat/completions.ts +4 -4
- package/src/streaming.ts +5 -1
- package/src/version.ts +1 -1
- package/streaming.d.ts +3 -1
- package/streaming.d.ts.map +1 -1
- package/streaming.js +4 -1
- package/streaming.js.map +1 -1
- package/streaming.mjs +4 -1
- package/streaming.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.84.0 (2025-02-12)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v4.83.0...v4.84.0](https://github.com/openai/openai-node/compare/v4.83.0...v4.84.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **pagination:** avoid fetching when has_more: false ([#1305](https://github.com/openai/openai-node/issues/1305)) ([b6944c6](https://github.com/openai/openai-node/commit/b6944c634b53c9084f2ccf777c2491e89b2cc7af))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **api:** add missing reasoning effort + model enums ([#1302](https://github.com/openai/openai-node/issues/1302)) ([14c55c3](https://github.com/openai/openai-node/commit/14c55c312e31f1ed46d02f39a99049f785504a53))
|
|
15
|
+
* **assistants:** handle `thread.run.incomplete` event ([7032cc4](https://github.com/openai/openai-node/commit/7032cc40b8aa0a58459cf114bceb8028a8517400))
|
|
16
|
+
* correctly decode multi-byte characters over multiple chunks ([#1316](https://github.com/openai/openai-node/issues/1316)) ([dd776c4](https://github.com/openai/openai-node/commit/dd776c4867401f527f699bd4b9e567890256e849))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
|
|
21
|
+
* **internal:** remove segfault-handler dependency ([3521ca3](https://github.com/openai/openai-node/commit/3521ca34e7f5bd51542084e27c084a5d7cc5448b))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Documentation
|
|
25
|
+
|
|
26
|
+
* **readme:** cleanup into multiple files ([da94424](https://github.com/openai/openai-node/commit/da944242e542e9e5e51cb11853c621fc6825ac02))
|
|
27
|
+
|
|
3
28
|
## 4.83.0 (2025-02-05)
|
|
4
29
|
|
|
5
30
|
Full Changelog: [v4.82.0...v4.83.0](https://github.com/openai/openai-node/compare/v4.82.0...v4.83.0)
|
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ import OpenAI from 'jsr:@openai/openai';
|
|
|
40
40
|
The full API of this library can be found in [api.md file](api.md) along with many [code examples](https://github.com/openai/openai-node/tree/master/examples). The code below shows how to get started using the chat completions API.
|
|
41
41
|
|
|
42
42
|
<!-- prettier-ignore -->
|
|
43
|
-
```
|
|
43
|
+
```ts
|
|
44
44
|
import OpenAI from 'openai';
|
|
45
45
|
|
|
46
46
|
const client = new OpenAI({
|
|
@@ -80,189 +80,11 @@ async function main() {
|
|
|
80
80
|
main();
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
If you need to cancel a stream, you can `break` from the loop
|
|
84
|
-
or call `stream.controller.abort()`.
|
|
85
|
-
|
|
86
|
-
## Realtime API beta
|
|
87
|
-
|
|
88
|
-
The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection.
|
|
89
|
-
|
|
90
|
-
The Realtime API works through a combination of client-sent events and server-sent events. Clients can send events to do things like update session configuration or send text and audio inputs. Server events confirm when audio responses have completed, or when a text response from the model has been received. A full event reference can be found [here](https://platform.openai.com/docs/api-reference/realtime-client-events) and a guide can be found [here](https://platform.openai.com/docs/guides/realtime).
|
|
91
|
-
|
|
92
|
-
This SDK supports accessing the Realtime API through the [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) or with [ws](https://github.com/websockets/ws).
|
|
93
|
-
|
|
94
|
-
Basic text based example with `ws`:
|
|
95
|
-
|
|
96
|
-
```ts
|
|
97
|
-
// requires `yarn add ws @types/ws`
|
|
98
|
-
import { OpenAIRealtimeWS } from 'openai/beta/realtime/ws';
|
|
99
|
-
|
|
100
|
-
const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' });
|
|
101
|
-
|
|
102
|
-
// access the underlying `ws.WebSocket` instance
|
|
103
|
-
rt.socket.on('open', () => {
|
|
104
|
-
console.log('Connection opened!');
|
|
105
|
-
rt.send({
|
|
106
|
-
type: 'session.update',
|
|
107
|
-
session: {
|
|
108
|
-
modalities: ['text'],
|
|
109
|
-
model: 'gpt-4o-realtime-preview',
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
rt.send({
|
|
114
|
-
type: 'conversation.item.create',
|
|
115
|
-
item: {
|
|
116
|
-
type: 'message',
|
|
117
|
-
role: 'user',
|
|
118
|
-
content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }],
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
rt.send({ type: 'response.create' });
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
rt.on('error', (err) => {
|
|
126
|
-
// in a real world scenario this should be logged somewhere as you
|
|
127
|
-
// likely want to continue procesing events regardless of any errors
|
|
128
|
-
throw err;
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
rt.on('session.created', (event) => {
|
|
132
|
-
console.log('session created!', event.session);
|
|
133
|
-
console.log();
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
rt.on('response.text.delta', (event) => process.stdout.write(event.delta));
|
|
137
|
-
rt.on('response.text.done', () => console.log());
|
|
138
|
-
|
|
139
|
-
rt.on('response.done', () => rt.close());
|
|
140
|
-
|
|
141
|
-
rt.socket.on('close', () => console.log('\nConnection closed!'));
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
To use the web API `WebSocket` implementation, replace `OpenAIRealtimeWS` with `OpenAIRealtimeWebSocket` and adjust any `rt.socket` access:
|
|
145
|
-
|
|
146
|
-
```ts
|
|
147
|
-
import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket';
|
|
148
|
-
|
|
149
|
-
const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' });
|
|
150
|
-
// ...
|
|
151
|
-
rt.socket.addEventListener('open', () => {
|
|
152
|
-
// ...
|
|
153
|
-
});
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
A full example can be found [here](https://github.com/openai/openai-node/blob/master/examples/realtime/websocket.ts).
|
|
157
|
-
|
|
158
|
-
### Realtime error handling
|
|
159
|
-
|
|
160
|
-
When an error is encountered, either on the client side or returned from the server through the [`error` event](https://platform.openai.com/docs/guides/realtime-model-capabilities#error-handling), the `error` event listener will be fired. However, if you haven't registered an `error` event listener then an `unhandled Promise rejection` error will be thrown.
|
|
161
|
-
|
|
162
|
-
It is **highly recommended** that you register an `error` event listener and handle errors approriately as typically the underlying connection is still usable.
|
|
163
|
-
|
|
164
|
-
```ts
|
|
165
|
-
const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' });
|
|
166
|
-
rt.on('error', (err) => {
|
|
167
|
-
// in a real world scenario this should be logged somewhere as you
|
|
168
|
-
// likely want to continue procesing events regardless of any errors
|
|
169
|
-
throw err;
|
|
170
|
-
});
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Request & Response types
|
|
174
|
-
|
|
175
|
-
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
|
|
176
|
-
|
|
177
|
-
<!-- prettier-ignore -->
|
|
178
|
-
```ts
|
|
179
|
-
import OpenAI from 'openai';
|
|
180
|
-
|
|
181
|
-
const client = new OpenAI({
|
|
182
|
-
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
async function main() {
|
|
186
|
-
const params: OpenAI.Chat.ChatCompletionCreateParams = {
|
|
187
|
-
messages: [{ role: 'user', content: 'Say this is a test' }],
|
|
188
|
-
model: 'gpt-4o',
|
|
189
|
-
};
|
|
190
|
-
const chatCompletion: OpenAI.Chat.ChatCompletion = await client.chat.completions.create(params);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
main();
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
197
|
-
|
|
198
|
-
> [!IMPORTANT]
|
|
199
|
-
> Previous versions of this SDK used a `Configuration` class. See the [v3 to v4 migration guide](https://github.com/openai/openai-node/discussions/217).
|
|
200
|
-
|
|
201
|
-
### Polling Helpers
|
|
202
|
-
|
|
203
|
-
When interacting with the API some actions such as starting a Run and adding files to vector stores are asynchronous and take time to complete. The SDK includes
|
|
204
|
-
helper functions which will poll the status until it reaches a terminal state and then return the resulting object.
|
|
205
|
-
If an API method results in an action which could benefit from polling there will be a corresponding version of the
|
|
206
|
-
method ending in 'AndPoll'.
|
|
207
|
-
|
|
208
|
-
For instance to create a Run and poll until it reaches a terminal state you can run:
|
|
209
|
-
|
|
210
|
-
```ts
|
|
211
|
-
const run = await openai.beta.threads.runs.createAndPoll(thread.id, {
|
|
212
|
-
assistant_id: assistantId,
|
|
213
|
-
});
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
More information on the lifecycle of a Run can be found in the [Run Lifecycle Documentation](https://platform.openai.com/docs/assistants/deep-dive/run-lifecycle)
|
|
217
|
-
|
|
218
|
-
### Bulk Upload Helpers
|
|
219
|
-
|
|
220
|
-
When creating and interacting with vector stores, you can use the polling helpers to monitor the status of operations.
|
|
221
|
-
For convenience, we also provide a bulk upload helper to allow you to simultaneously upload several files at once.
|
|
222
|
-
|
|
223
|
-
```ts
|
|
224
|
-
const fileList = [
|
|
225
|
-
createReadStream('/home/data/example.pdf'),
|
|
226
|
-
...
|
|
227
|
-
];
|
|
228
|
-
|
|
229
|
-
const batch = await openai.vectorStores.fileBatches.uploadAndPoll(vectorStore.id, {files: fileList});
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Streaming Helpers
|
|
233
|
-
|
|
234
|
-
The SDK also includes helpers to process streams and handle the incoming events.
|
|
235
|
-
|
|
236
|
-
```ts
|
|
237
|
-
const run = openai.beta.threads.runs
|
|
238
|
-
.stream(thread.id, {
|
|
239
|
-
assistant_id: assistant.id,
|
|
240
|
-
})
|
|
241
|
-
.on('textCreated', (text) => process.stdout.write('\nassistant > '))
|
|
242
|
-
.on('textDelta', (textDelta, snapshot) => process.stdout.write(textDelta.value))
|
|
243
|
-
.on('toolCallCreated', (toolCall) => process.stdout.write(`\nassistant > ${toolCall.type}\n\n`))
|
|
244
|
-
.on('toolCallDelta', (toolCallDelta, snapshot) => {
|
|
245
|
-
if (toolCallDelta.type === 'code_interpreter') {
|
|
246
|
-
if (toolCallDelta.code_interpreter.input) {
|
|
247
|
-
process.stdout.write(toolCallDelta.code_interpreter.input);
|
|
248
|
-
}
|
|
249
|
-
if (toolCallDelta.code_interpreter.outputs) {
|
|
250
|
-
process.stdout.write('\noutput >\n');
|
|
251
|
-
toolCallDelta.code_interpreter.outputs.forEach((output) => {
|
|
252
|
-
if (output.type === 'logs') {
|
|
253
|
-
process.stdout.write(`\n${output.logs}\n`);
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
More information on streaming helpers can be found in the dedicated documentation: [helpers.md](helpers.md)
|
|
83
|
+
If you need to cancel a stream, you can `break` from the loop or call `stream.controller.abort()`.
|
|
262
84
|
|
|
263
|
-
###
|
|
85
|
+
### Chat Completion streaming helpers
|
|
264
86
|
|
|
265
|
-
This library provides several conveniences for streaming chat completions, for example:
|
|
87
|
+
This library also provides several conveniences for streaming chat completions, for example:
|
|
266
88
|
|
|
267
89
|
```ts
|
|
268
90
|
import OpenAI from 'openai';
|
|
@@ -292,98 +114,32 @@ async function main() {
|
|
|
292
114
|
main();
|
|
293
115
|
```
|
|
294
116
|
|
|
295
|
-
|
|
296
|
-
[various helpers for your convenience](helpers.md#chat-events) including event handlers and promises.
|
|
297
|
-
|
|
298
|
-
Alternatively, you can use `openai.chat.completions.create({ stream: true, … })`
|
|
299
|
-
which only returns an async iterable of the chunks in the stream and thus uses less memory
|
|
300
|
-
(it does not build up a final chat completion object for you).
|
|
301
|
-
|
|
302
|
-
If you need to cancel a stream, you can `break` from a `for await` loop or call `stream.abort()`.
|
|
303
|
-
|
|
304
|
-
### Automated function calls
|
|
117
|
+
See [helpers.md](helpers.md#chat-events) for more details.
|
|
305
118
|
|
|
306
|
-
|
|
307
|
-
convenience helper for using function tool calls with the `/chat/completions` endpoint
|
|
308
|
-
which automatically call the JavaScript functions you provide
|
|
309
|
-
and sends their results back to the `/chat/completions` endpoint,
|
|
310
|
-
looping as long as the model requests tool calls.
|
|
311
|
-
|
|
312
|
-
If you pass a `parse` function, it will automatically parse the `arguments` for you
|
|
313
|
-
and returns any parsing errors to the model to attempt auto-recovery.
|
|
314
|
-
Otherwise, the args will be passed to the function you provide as a string.
|
|
119
|
+
### Request & Response types
|
|
315
120
|
|
|
316
|
-
|
|
317
|
-
it returns immediately after calling that function (and only loops to auto-recover parsing errors).
|
|
121
|
+
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
|
|
318
122
|
|
|
123
|
+
<!-- prettier-ignore -->
|
|
319
124
|
```ts
|
|
320
125
|
import OpenAI from 'openai';
|
|
321
126
|
|
|
322
|
-
const client = new OpenAI(
|
|
127
|
+
const client = new OpenAI({
|
|
128
|
+
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
|
|
129
|
+
});
|
|
323
130
|
|
|
324
131
|
async function main() {
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
{
|
|
331
|
-
type: 'function',
|
|
332
|
-
function: {
|
|
333
|
-
function: getCurrentLocation,
|
|
334
|
-
parameters: { type: 'object', properties: {} },
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
type: 'function',
|
|
339
|
-
function: {
|
|
340
|
-
function: getWeather,
|
|
341
|
-
parse: JSON.parse, // or use a validation library like zod for typesafe parsing.
|
|
342
|
-
parameters: {
|
|
343
|
-
type: 'object',
|
|
344
|
-
properties: {
|
|
345
|
-
location: { type: 'string' },
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
},
|
|
350
|
-
],
|
|
351
|
-
})
|
|
352
|
-
.on('message', (message) => console.log(message));
|
|
353
|
-
|
|
354
|
-
const finalContent = await runner.finalContent();
|
|
355
|
-
console.log();
|
|
356
|
-
console.log('Final content:', finalContent);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
async function getCurrentLocation() {
|
|
360
|
-
return 'Boston'; // Simulate lookup
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
async function getWeather(args: { location: string }) {
|
|
364
|
-
const { location } = args;
|
|
365
|
-
// … do lookup …
|
|
366
|
-
return { temperature, precipitation };
|
|
132
|
+
const params: OpenAI.Chat.ChatCompletionCreateParams = {
|
|
133
|
+
messages: [{ role: 'user', content: 'Say this is a test' }],
|
|
134
|
+
model: 'gpt-4o',
|
|
135
|
+
};
|
|
136
|
+
const chatCompletion: OpenAI.Chat.ChatCompletion = await client.chat.completions.create(params);
|
|
367
137
|
}
|
|
368
138
|
|
|
369
139
|
main();
|
|
370
|
-
|
|
371
|
-
// {role: "user", content: "How's the weather this week?"}
|
|
372
|
-
// {role: "assistant", tool_calls: [{type: "function", function: {name: "getCurrentLocation", arguments: "{}"}, id: "123"}
|
|
373
|
-
// {role: "tool", name: "getCurrentLocation", content: "Boston", tool_call_id: "123"}
|
|
374
|
-
// {role: "assistant", tool_calls: [{type: "function", function: {name: "getWeather", arguments: '{"location": "Boston"}'}, id: "1234"}]}
|
|
375
|
-
// {role: "tool", name: "getWeather", content: '{"temperature": "50degF", "preciptation": "high"}', tool_call_id: "1234"}
|
|
376
|
-
// {role: "assistant", content: "It's looking cold and rainy - you might want to wear a jacket!"}
|
|
377
|
-
//
|
|
378
|
-
// Final content: "It's looking cold and rainy - you might want to wear a jacket!"
|
|
379
140
|
```
|
|
380
141
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
Note that `runFunctions` was previously available as well, but has been deprecated in favor of `runTools`.
|
|
384
|
-
|
|
385
|
-
Read more about various examples such as with integrating with [zod](helpers.md#integrate-with-zod),
|
|
386
|
-
[next.js](helpers.md#integrate-with-nextjs), and [proxying a stream to the browser](helpers.md#proxy-streaming-to-a-browser).
|
|
142
|
+
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
387
143
|
|
|
388
144
|
## File uploads
|
|
389
145
|
|
|
@@ -434,6 +190,7 @@ async function main() {
|
|
|
434
190
|
.create({ model: 'gpt-4o', training_file: 'file-abc123' })
|
|
435
191
|
.catch(async (err) => {
|
|
436
192
|
if (err instanceof OpenAI.APIError) {
|
|
193
|
+
console.log(err.request_id);
|
|
437
194
|
console.log(err.status); // 400
|
|
438
195
|
console.log(err.name); // BadRequestError
|
|
439
196
|
console.log(err.headers); // {server: 'nginx', ...}
|
|
@@ -459,76 +216,6 @@ Error codes are as followed:
|
|
|
459
216
|
| >=500 | `InternalServerError` |
|
|
460
217
|
| N/A | `APIConnectionError` |
|
|
461
218
|
|
|
462
|
-
## Request IDs
|
|
463
|
-
|
|
464
|
-
> For more information on debugging requests, see [these docs](https://platform.openai.com/docs/api-reference/debugging-requests)
|
|
465
|
-
|
|
466
|
-
All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI.
|
|
467
|
-
|
|
468
|
-
```ts
|
|
469
|
-
const completion = await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' });
|
|
470
|
-
console.log(completion._request_id) // req_123
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
You can also access the Request ID using the `.withResponse()` method:
|
|
474
|
-
|
|
475
|
-
```ts
|
|
476
|
-
const { data: stream, request_id } = await openai.chat.completions
|
|
477
|
-
.create({
|
|
478
|
-
model: 'gpt-4',
|
|
479
|
-
messages: [{ role: 'user', content: 'Say this is a test' }],
|
|
480
|
-
stream: true,
|
|
481
|
-
})
|
|
482
|
-
.withResponse();
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
## Microsoft Azure OpenAI
|
|
486
|
-
|
|
487
|
-
To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI`
|
|
488
|
-
class instead of the `OpenAI` class.
|
|
489
|
-
|
|
490
|
-
> [!IMPORTANT]
|
|
491
|
-
> The Azure API shape slightly differs from the core API shape which means that the static types for responses / params
|
|
492
|
-
> won't always be correct.
|
|
493
|
-
|
|
494
|
-
```ts
|
|
495
|
-
import { AzureOpenAI } from 'openai';
|
|
496
|
-
import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity';
|
|
497
|
-
|
|
498
|
-
const credential = new DefaultAzureCredential();
|
|
499
|
-
const scope = 'https://cognitiveservices.azure.com/.default';
|
|
500
|
-
const azureADTokenProvider = getBearerTokenProvider(credential, scope);
|
|
501
|
-
|
|
502
|
-
const openai = new AzureOpenAI({ azureADTokenProvider, apiVersion: "<The API version, e.g. 2024-10-01-preview>" });
|
|
503
|
-
|
|
504
|
-
const result = await openai.chat.completions.create({
|
|
505
|
-
model: 'gpt-4o',
|
|
506
|
-
messages: [{ role: 'user', content: 'Say hello!' }],
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
console.log(result.choices[0]!.message?.content);
|
|
510
|
-
```
|
|
511
|
-
|
|
512
|
-
### Realtime API
|
|
513
|
-
This SDK provides real-time streaming capabilities for Azure OpenAI through the `OpenAIRealtimeWS` and `OpenAIRealtimeWebSocket` clients described previously.
|
|
514
|
-
|
|
515
|
-
To utilize the real-time features, begin by creating a fully configured `AzureOpenAI` client and passing it into either `OpenAIRealtimeWS.azure` or `OpenAIRealtimeWebSocket.azure`. For example:
|
|
516
|
-
|
|
517
|
-
```ts
|
|
518
|
-
const cred = new DefaultAzureCredential();
|
|
519
|
-
const scope = 'https://cognitiveservices.azure.com/.default';
|
|
520
|
-
const deploymentName = 'gpt-4o-realtime-preview-1001';
|
|
521
|
-
const azureADTokenProvider = getBearerTokenProvider(cred, scope);
|
|
522
|
-
const client = new AzureOpenAI({
|
|
523
|
-
azureADTokenProvider,
|
|
524
|
-
apiVersion: '2024-10-01-preview',
|
|
525
|
-
deployment: deploymentName,
|
|
526
|
-
});
|
|
527
|
-
const rt = await OpenAIRealtimeWS.azure(client);
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
Once the instance has been created, you can then begin sending requests and receiving streaming responses in real time.
|
|
531
|
-
|
|
532
219
|
### Retries
|
|
533
220
|
|
|
534
221
|
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
|
|
@@ -571,6 +258,29 @@ On timeout, an `APIConnectionTimeoutError` is thrown.
|
|
|
571
258
|
|
|
572
259
|
Note that requests which time out will be [retried twice by default](#retries).
|
|
573
260
|
|
|
261
|
+
## Request IDs
|
|
262
|
+
|
|
263
|
+
> For more information on debugging requests, see [these docs](https://platform.openai.com/docs/api-reference/debugging-requests)
|
|
264
|
+
|
|
265
|
+
All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI.
|
|
266
|
+
|
|
267
|
+
```ts
|
|
268
|
+
const completion = await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' });
|
|
269
|
+
console.log(completion._request_id) // req_123
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
You can also access the Request ID using the `.withResponse()` method:
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
const { data: stream, request_id } = await openai.chat.completions
|
|
276
|
+
.create({
|
|
277
|
+
model: 'gpt-4',
|
|
278
|
+
messages: [{ role: 'user', content: 'Say this is a test' }],
|
|
279
|
+
stream: true,
|
|
280
|
+
})
|
|
281
|
+
.withResponse();
|
|
282
|
+
```
|
|
283
|
+
|
|
574
284
|
## Auto-pagination
|
|
575
285
|
|
|
576
286
|
List methods in the OpenAI API are paginated.
|
|
@@ -602,6 +312,55 @@ while (page.hasNextPage()) {
|
|
|
602
312
|
}
|
|
603
313
|
```
|
|
604
314
|
|
|
315
|
+
## Realtime API Beta
|
|
316
|
+
|
|
317
|
+
The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection.
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket';
|
|
321
|
+
|
|
322
|
+
const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' });
|
|
323
|
+
|
|
324
|
+
rt.on('response.text.delta', (event) => process.stdout.write(event.delta));
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
For more information see [realtime.md](realtime.md).
|
|
328
|
+
|
|
329
|
+
## Microsoft Azure OpenAI
|
|
330
|
+
|
|
331
|
+
To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI`
|
|
332
|
+
class instead of the `OpenAI` class.
|
|
333
|
+
|
|
334
|
+
> [!IMPORTANT]
|
|
335
|
+
> The Azure API shape slightly differs from the core API shape which means that the static types for responses / params
|
|
336
|
+
> won't always be correct.
|
|
337
|
+
|
|
338
|
+
```ts
|
|
339
|
+
import { AzureOpenAI } from 'openai';
|
|
340
|
+
import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity';
|
|
341
|
+
|
|
342
|
+
const credential = new DefaultAzureCredential();
|
|
343
|
+
const scope = 'https://cognitiveservices.azure.com/.default';
|
|
344
|
+
const azureADTokenProvider = getBearerTokenProvider(credential, scope);
|
|
345
|
+
|
|
346
|
+
const openai = new AzureOpenAI({ azureADTokenProvider, apiVersion: "<The API version, e.g. 2024-10-01-preview>" });
|
|
347
|
+
|
|
348
|
+
const result = await openai.chat.completions.create({
|
|
349
|
+
model: 'gpt-4o',
|
|
350
|
+
messages: [{ role: 'user', content: 'Say hello!' }],
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
console.log(result.choices[0]!.message?.content);
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
For more information on support for the Azure API, see [azure.md](azure.md).
|
|
357
|
+
|
|
358
|
+
## Automated function calls
|
|
359
|
+
|
|
360
|
+
We provide the `openai.beta.chat.completions.runTools({…})` convenience helper for using function tool calls with the `/chat/completions` endpoint which automatically call the JavaScript functions you provide and sends their results back to the `/chat/completions` endpoint, looping as long as the model requests tool calls.
|
|
361
|
+
|
|
362
|
+
For more information see [helpers.md](helpers.md#automated-function-calls).
|
|
363
|
+
|
|
605
364
|
## Advanced Usage
|
|
606
365
|
|
|
607
366
|
### Accessing raw Response data (e.g., headers)
|
|
@@ -17,7 +17,7 @@ export declare class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
17
17
|
*/
|
|
18
18
|
onURL?: (url: URL) => void;
|
|
19
19
|
}, client?: Pick<OpenAI, 'apiKey' | 'baseURL'>);
|
|
20
|
-
static azure(client: AzureOpenAI, options?: {
|
|
20
|
+
static azure(client: Pick<AzureOpenAI, '_getAzureADToken' | 'apiVersion' | 'apiKey' | 'baseURL' | 'deploymentName'>, options?: {
|
|
21
21
|
deploymentName?: string;
|
|
22
22
|
dangerouslyAllowBrowser?: boolean;
|
|
23
23
|
}): Promise<OpenAIRealtimeWebSocket>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../src/beta/realtime/websocket.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,KAA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B,EAAE,GAAG,OAAO,CAAC;QAC5C,OAAO,IAAI,uBAAuB,CAChC;YACE,KAAK,EAAE,cAAc;YACrB,KAAK;YACL,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAA0B;QAC7B,IAAI;YACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;SACzC;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,qBAAqB,EAAE,GAAG,CAAC,CAAC;SACjD;IACH,CAAC;IAED,KAAK,CAAC,KAAwC;QAC5C,IAAI;YACF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,IAAI,IAAI,EAAE,KAAK,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC;SAC/D;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,gCAAgC,EAAE,GAAG,CAAC,CAAC;SAC5D;IACH,CAAC;CACF"}
|
package/beta/realtime/ws.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare class OpenAIRealtimeWS extends OpenAIRealtimeEmitter {
|
|
|
10
10
|
model: string;
|
|
11
11
|
options?: WS.ClientOptions | undefined;
|
|
12
12
|
}, client?: Pick<OpenAI, 'apiKey' | 'baseURL'>);
|
|
13
|
-
static azure(client: AzureOpenAI, options?: {
|
|
13
|
+
static azure(client: Pick<AzureOpenAI, '_getAzureADToken' | 'apiVersion' | 'apiKey' | 'baseURL' | 'deploymentName'>, options?: {
|
|
14
14
|
deploymentName?: string;
|
|
15
15
|
options?: WS.ClientOptions | undefined;
|
|
16
16
|
}): Promise<OpenAIRealtimeWS>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/beta/realtime/ws.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAuB,MAAM,wCAAwC,CAAC;AACvG,OAAO,EAAE,qBAAqB,EAA6B,MAAM,iBAAiB,CAAC;AAEnF,qBAAa,gBAAiB,SAAQ,qBAAqB;IACzD,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC;gBAGnB,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,EAAE,CAAC,aAAa,GAAG,SAAS,CAAA;KAAE,EAChE,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;WA0ChC,KAAK,CAChB,MAAM,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/beta/realtime/ws.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAuB,MAAM,wCAAwC,CAAC;AACvG,OAAO,EAAE,qBAAqB,EAA6B,MAAM,iBAAiB,CAAC;AAEnF,qBAAa,gBAAiB,SAAQ,qBAAqB;IACzD,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC;gBAGnB,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,EAAE,CAAC,aAAa,GAAG,SAAS,CAAA;KAAE,EAChE,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;WA0ChC,K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AC;QAC9C,IAAI,KAAK,EAAE;YACT,OAAO,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC;SAC7C;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;SAC7F;KACF;AACH,CAAC"}
|
|
@@ -7,10 +7,10 @@ export type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefine
|
|
|
7
7
|
* https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
|
|
8
8
|
*/
|
|
9
9
|
export declare class LineDecoder {
|
|
10
|
+
#private;
|
|
10
11
|
static NEWLINE_CHARS: Set<string>;
|
|
11
12
|
static NEWLINE_REGEXP: RegExp;
|
|
12
|
-
buffer:
|
|
13
|
-
trailingCR: boolean;
|
|
13
|
+
buffer: Uint8Array;
|
|
14
14
|
textDecoder: any;
|
|
15
15
|
constructor();
|
|
16
16
|
decode(chunk: Bytes): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":";AAEA,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAElF;;;;;GAKG;AACH,qBAAa,WAAW
|
|
1
|
+
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":";AAEA,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAElF;;;;;GAKG;AACH,qBAAa,WAAW;;IAEtB,MAAM,CAAC,aAAa,cAAyB;IAC7C,MAAM,CAAC,cAAc,SAAkB;IAEvC,MAAM,EAAE,UAAU,CAAC;IAEnB,WAAW,EAAE,GAAG,CAAC;;IAOjB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE;IAgD9B,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAqChC,KAAK,IAAI,MAAM,EAAE;CAMlB"}
|