Skip to content

Commit 065d3b0

Browse files
chore(docs): use top-level-await in example snippets
1 parent 030f590 commit 065d3b0

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,18 @@ a subclass of `APIError` will be thrown:
132132

133133
<!-- prettier-ignore -->
134134
```ts
135-
async function main() {
136-
const job = await client.fineTuning.jobs
137-
.create({ model: 'gpt-4o', training_file: 'file-abc123' })
138-
.catch(async (err) => {
139-
if (err instanceof OpenAI.APIError) {
140-
console.log(err.request_id);
141-
console.log(err.status); // 400
142-
console.log(err.name); // BadRequestError
143-
console.log(err.headers); // {server: 'nginx', ...}
144-
} else {
145-
throw err;
146-
}
147-
});
148-
}
149-
150-
main();
135+
const job = await client.fineTuning.jobs
136+
.create({ model: 'gpt-4o', training_file: 'file-abc123' })
137+
.catch(async (err) => {
138+
if (err instanceof OpenAI.APIError) {
139+
console.log(err.request_id);
140+
console.log(err.status); // 400
141+
console.log(err.name); // BadRequestError
142+
console.log(err.headers); // {server: 'nginx', ...}
143+
} else {
144+
throw err;
145+
}
146+
});
151147
```
152148

153149
Error codes are as follows:

0 commit comments

Comments
 (0)