Skip to content

Commit af11177

Browse files
committed
docs: reformat README.md (#592)
1 parent 824089d commit af11177

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import OpenAI from 'https://deno.land/x/[email protected]/mod.ts';
3030

3131
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.
3232

33+
<!-- prettier-ignore -->
3334
```js
3435
import OpenAI from 'openai';
3536

@@ -77,6 +78,7 @@ or call `stream.controller.abort()`.
7778

7879
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
7980

81+
<!-- prettier-ignore -->
8082
```ts
8183
import OpenAI from 'openai';
8284

@@ -267,6 +269,7 @@ When the library is unable to connect to the API,
267269
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
268270
a subclass of `APIError` will be thrown:
269271

272+
<!-- prettier-ignore -->
270273
```ts
271274
async function main() {
272275
const fineTune = await openai.fineTunes
@@ -388,6 +391,7 @@ The "raw" `Response` returned by `fetch()` can be accessed through the `.asRespo
388391

389392
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
390393

394+
<!-- prettier-ignore -->
391395
```ts
392396
const openai = new OpenAI();
393397

@@ -412,12 +416,11 @@ If you would prefer to use a global, web-standards-compliant `fetch` function ev
412416
(for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
413417
add the following import before your first import `from "OpenAI"`:
414418

415-
<!-- prettier-ignore -->
416419
```ts
417420
// Tell TypeScript and the package to use the global web fetch instead of node-fetch.
418421
// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
419-
import "openai/shims/web";
420-
import OpenAI from "openai";
422+
import 'openai/shims/web';
423+
import OpenAI from 'openai';
421424
```
422425

423426
To do the inverse, add `import "openai/shims/node"` (which does import polyfills).

0 commit comments

Comments
 (0)