@@ -14,14 +14,19 @@ language js
14
14
pattern change_constructor() {
15
15
`new $constructor($params)` where {
16
16
$constructor <: `OpenAIApi` => `OpenAI`,
17
- $params <: [$config],
18
- $program <: contains or {
19
- `const $config = new Configuration($details)`,
20
- `let $config = new Configuration($details)`,
21
- `var $config = new Configuration($details)`
22
- } => .,
17
+ or {
18
+ $params <: contains `new Configuration($details)`,
19
+ and {
20
+ $params <: [$config],
21
+ $program <: contains or {
22
+ `const $config = new Configuration($details)`,
23
+ `let $config = new Configuration($details)`,
24
+ `var $config = new Configuration($details)`
25
+ } => .,
26
+ }
27
+ },
23
28
$params => `$details`,
24
- $program <: contains change_imports(),
29
+ $program <: maybe contains change_imports(),
25
30
}
26
31
}
27
32
@@ -347,11 +352,21 @@ const response = await openai.audio.transcriptions.create({
347
352
## File handling
348
353
349
354
``` js
355
+ const openai = new OpenAIApi (
356
+ new Configuration ({
357
+ apiKey: process .env .OPENAI_API_KEY ,
358
+ }),
359
+ );
360
+
350
361
const myFile = await openai .downloadFile (' my-file' , options);
351
362
console .log (myFile);
352
363
```
353
364
354
365
``` ts
366
+ const openai = new OpenAI ({
367
+ apiKey: process .env .OPENAI_API_KEY ,
368
+ });
369
+
355
370
const myFile = await openai .files .retrieveContent (' my-file' , options );
356
371
console .log (myFile );
357
372
```
0 commit comments