@@ -28,12 +28,12 @@ const openai = new OpenAI({
2828});
2929
3030async 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
3939main ();
@@ -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
8787main ();
@@ -226,8 +226,8 @@ You can use `for await … of` syntax to iterate through items across all pages:
226226async 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
239239let 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
265265console .log (response .headers .get (' X-My-Header' ));
266266console .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 ();
271271console .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