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: CHANGELOG.md
+29
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,34 @@
1
1
# Changelog
2
2
3
+
## 4.73.0 (2024-11-20)
4
+
5
+
Full Changelog: [v4.72.0...v4.73.0](https://github.com/openai/openai-node/compare/v4.72.0...v4.73.0)
6
+
7
+
### Features
8
+
9
+
***api:** add gpt-4o-2024-11-20 model ([#1201](https://github.com/openai/openai-node/issues/1201)) ([0feeafd](https://github.com/openai/openai-node/commit/0feeafd21ba4b6281cc3b9dafa2919b1e2e4d1c3))
10
+
* bump model in all example snippets to gpt-4o ([6961c37](https://github.com/openai/openai-node/commit/6961c37f2e581bcc12ec2bbe77df2b9b260fe297))
11
+
12
+
13
+
### Bug Fixes
14
+
15
+
***docs:** add missing await to pagination example ([#1190](https://github.com/openai/openai-node/issues/1190)) ([524b9e8](https://github.com/openai/openai-node/commit/524b9e82ae13a3b5093dcfbfd1169a798cf99ab4))
16
+
17
+
18
+
### Chores
19
+
20
+
***client:** drop unused devDependency ([#1191](https://github.com/openai/openai-node/issues/1191)) ([8ee6c03](https://github.com/openai/openai-node/commit/8ee6c0335673f2ecf84ea11bdfc990adab607e20))
***internal:** use reexports not destructuring ([#1181](https://github.com/openai/openai-node/issues/1181)) ([f555dd6](https://github.com/openai/openai-node/commit/f555dd6503bc4ccd4d13f4e1a1d36fbbfd51c369))
23
+
24
+
25
+
### Documentation
26
+
27
+
* bump models in example snippets to gpt-4o ([#1184](https://github.com/openai/openai-node/issues/1184)) ([4ec4027](https://github.com/openai/openai-node/commit/4ec402790cf3cfbccbf3ef9b61d577b0118977e8))
28
+
* change readme title ([#1198](https://github.com/openai/openai-node/issues/1198)) ([e34981c](https://github.com/openai/openai-node/commit/e34981c00f2f0360baffe870bcc38786030671bf))
@@ -14,16 +14,21 @@ To learn how to use the OpenAI API, check out our [API Reference](https://platfo
14
14
npm install openai
15
15
```
16
16
17
-
You can also import from jsr:
17
+
### Installation from JSR
18
18
19
-
<!-- x-release-please-start-version -->
19
+
```sh
20
+
deno add jsr:@openai/openai
21
+
npx jsr add @openai/openai
22
+
```
23
+
24
+
These commands will make the module importable from the `@openai/openai` scope:
25
+
26
+
You can also [import directly from JSR](https://jsr.io/docs/using-packages#importing-with-jsr-specifiers) without an install step if you're using the Deno JavaScript runtime:
20
27
21
28
```ts
22
29
importOpenAIfrom'jsr:@openai/openai';
23
30
```
24
31
25
-
<!-- x-release-please-end -->
26
-
27
32
## Usage
28
33
29
34
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.
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.
369
374
370
375
```ts
371
-
const completion =awaitclient.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4' });
376
+
const completion =awaitclient.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' });
awaitclient.chat.completions.create({ messages: [{ role:'user', content:'How can I get the name of the current day in Node.js?' }], model:'gpt-3.5-turbo' }, {
423
+
awaitclient.chat.completions.create({ messages: [{ role:'user', content:'How can I get the name of the current day in JavaScript?' }], model:'gpt-4o' }, {
419
424
maxRetries:5,
420
425
});
421
426
```
@@ -432,7 +437,7 @@ const client = new OpenAI({
432
437
});
433
438
434
439
// Override per-request:
435
-
awaitclient.chat.completions.create({ messages: [{ role: 'user', content: 'How can I list all files in a directory using Python?' }], model: 'gpt-3.5-turbo' }, {
440
+
awaitclient.chat.completions.create({ messages: [{ role: 'user', content: 'How can I list all files in a directory using Python?' }], model: 'gpt-4o' }, {
436
441
timeout: 5*1000,
437
442
});
438
443
```
@@ -467,7 +472,7 @@ for (const fineTuningJob of page.data) {
467
472
468
473
// Convenience methods are provided for manually paginating:
469
474
while (page.hasNextPage()) {
470
-
page=page.getNextPage();
475
+
page=awaitpage.getNextPage();
471
476
// ...
472
477
}
473
478
```
@@ -485,13 +490,13 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
485
490
const client =newOpenAI();
486
491
487
492
const response =awaitclient.chat.completions
488
-
.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-3.5-turbo' })
493
+
.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' })
489
494
.asResponse();
490
495
console.log(response.headers.get('X-My-Header'));
491
496
console.log(response.statusText); // access the underlying Response object
492
497
493
498
const { data: chatCompletion, response: raw } =awaitclient.chat.completions
494
-
.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-3.5-turbo' })
499
+
.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' })
495
500
.withResponse();
496
501
console.log(raw.headers.get('X-My-Header'));
497
502
console.log(chatCompletion);
@@ -622,7 +627,7 @@ TypeScript >= 4.5 is supported.
622
627
The following runtimes are supported:
623
628
624
629
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
625
-
- Deno v1.28.0 or higher, using `import OpenAI from "npm:openai"`.
0 commit comments