Skip to content

Commit 4d0f969

Browse files
chore(docs): use client instead of package name in Node examples (#941)
1 parent 74f36db commit 4d0f969

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The full API of this library can be found in [api.md](api.md).
3030
```js
3131
import OpenAI from 'openai';
3232

33-
const openai = new OpenAI({
33+
const client = new OpenAI({
3434
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
3535
});
3636

@@ -51,7 +51,7 @@ We provide support for streaming responses using Server Sent Events (SSE).
5151
```ts
5252
import OpenAI from 'openai';
5353

54-
const openai = new OpenAI();
54+
const client = new OpenAI();
5555

5656
const stream = await openai.chat.completions.create({
5757
messages: [{ role: 'user', content: 'Say this is a test' }],
@@ -74,7 +74,7 @@ This library includes TypeScript definitions for all request params and response
7474
```ts
7575
import OpenAI from 'openai';
7676

77-
const openai = new OpenAI({
77+
const client = new OpenAI({
7878
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
7979
});
8080

@@ -105,7 +105,7 @@ import fs from 'fs';
105105
import fetch from 'node-fetch';
106106
import OpenAI, { toFile } from 'openai';
107107

108-
const openai = new OpenAI();
108+
const client = new OpenAI();
109109

110110
// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
111111
await openai.files.create({ file: fs.createReadStream('input.jsonl'), purpose: 'fine-tune' });
@@ -176,7 +176,7 @@ You can use the `maxRetries` option to configure or disable this:
176176
<!-- prettier-ignore -->
177177
```js
178178
// Configure the default for all requests:
179-
const openai = new OpenAI({
179+
const client = new OpenAI({
180180
maxRetries: 0, // default is 2
181181
});
182182

@@ -193,7 +193,7 @@ Requests time out after 10 minutes by default. You can configure this with a `ti
193193
<!-- prettier-ignore -->
194194
```ts
195195
// Configure the default for all requests:
196-
const openai = new OpenAI({
196+
const client = new OpenAI({
197197
timeout: 20 * 1000, // 20 seconds (default is 10 minutes)
198198
});
199199

@@ -248,7 +248,7 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
248248

249249
<!-- prettier-ignore -->
250250
```ts
251-
const openai = new OpenAI();
251+
const client = new OpenAI();
252252

253253
const response = await openai.chat.completions
254254
.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-3.5-turbo' })
@@ -359,7 +359,7 @@ import http from 'http';
359359
import { HttpsProxyAgent } from 'https-proxy-agent';
360360

361361
// Configure the default for all requests:
362-
const openai = new OpenAI({
362+
const client = new OpenAI({
363363
httpAgent: new HttpsProxyAgent(process.env.PROXY_URL),
364364
});
365365

0 commit comments

Comments
 (0)