Skip to content

Commit 5e05b31

Browse files
docs(README): fix variable names in some examples (#327)
1 parent 8daf11f commit 5e05b31

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ const openai = new OpenAI({
2828
});
2929

3030
async function main() {
31-
const completion = await openai.chat.completions.create({
31+
const chatCompletion = await openai.chat.completions.create({
3232
messages: [{ role: 'user', content: 'Say this is a test' }],
3333
model: 'gpt-3.5-turbo',
3434
});
3535

36-
console.log(completion.choices);
36+
console.log(chatCompletion.choices);
3737
}
3838

3939
main();
@@ -81,7 +81,7 @@ async function main() {
8181
messages: [{ role: 'user', content: 'Say this is a test' }],
8282
model: 'gpt-3.5-turbo',
8383
};
84-
const completion: OpenAI.Chat.ChatCompletion = await openai.chat.completions.create(params);
84+
const chatCompletion: OpenAI.Chat.ChatCompletion = await openai.chat.completions.create(params);
8585
}
8686

8787
main();
@@ -226,8 +226,8 @@ You can use `for await … of` syntax to iterate through items across all pages:
226226
async function fetchAllFineTuningJobs(params) {
227227
const allFineTuningJobs = [];
228228
// Automatically fetches more pages as needed.
229-
for await (const job of openai.fineTuning.jobs.list({ limit: 20 })) {
230-
allFineTuningJobs.push(job);
229+
for await (const fineTuningJob of openai.fineTuning.jobs.list({ limit: 20 })) {
230+
allFineTuningJobs.push(fineTuningJob);
231231
}
232232
return allFineTuningJobs;
233233
}
@@ -237,8 +237,8 @@ Alternatively, you can make request a single page at a time:
237237

238238
```ts
239239
let page = await openai.fineTuning.jobs.list({ limit: 20 });
240-
for (const job of page.data) {
241-
console.log(job);
240+
for (const fineTuningJob of page.data) {
241+
console.log(fineTuningJob);
242242
}
243243

244244
// Convenience methods are provided for manually paginating:
@@ -265,11 +265,11 @@ const response = await openai.chat.completions
265265
console.log(response.headers.get('X-My-Header'));
266266
console.log(response.statusText); // access the underlying Response object
267267

268-
const { data: completions, response: raw } = await openai.chat.completions
268+
const { data: chatCompletion, response: raw } = await openai.chat.completions
269269
.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-3.5-turbo' })
270270
.withResponse();
271271
console.log(raw.headers.get('X-My-Header'));
272-
console.log(completions.choices);
272+
console.log(chatCompletion.choices);
273273
```
274274

275275
## Configuring an HTTP(S) Agent (e.g., for proxies)

0 commit comments

Comments
 (0)