You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously without the `encodeURIComponent()` call we would have used the path `/example/string/with/slash`; now we'll use `/example/string%2Fwith%2Fslash`.
143
143
144
-
### Removed `httpAgent` in favor of `fetchOptions`
145
-
146
-
The `httpAgent` client option has been removed in favor of a [platform-specific `fetchOptions` property](https://github.com/stainless-sdks/openai-typescript#fetch-options).
147
-
This change was made as `httpAgent` relied on `node:http` agents which are not supported by any runtime's builtin fetch implementation.
148
-
149
-
If you were using `httpAgent` for proxy support, check out the [new proxy documentation](https://github.com/stainless-sdks/openai-typescript#configuring-proxies).
Some methods could not be named intuitively due to an internal naming conflict. This has been resolved and the methods are now correctly named.
181
-
182
-
```ts
183
-
// Before
184
-
client.chat.completions.del();
185
-
client.files.del();
186
-
client.models.del();
187
-
client.vectorStores.del();
188
-
client.vectorStores.files.del();
189
-
client.beta.assistants.del();
190
-
client.beta.threads.del();
191
-
client.beta.threads.messages.del();
192
-
client.responses.del();
193
-
194
-
// After
195
-
client.chat.completions.delete();
196
-
client.files.delete();
197
-
client.models.delete();
198
-
client.vectorStores.delete();
199
-
client.vectorStores.files.delete();
200
-
client.beta.assistants.delete();
201
-
client.beta.threads.delete();
202
-
client.beta.threads.messages.delete();
203
-
client.responses.delete();
204
-
```
205
-
206
144
### Removed request options overloads
207
145
208
146
When making requests with no required body, query or header parameters, you must now explicitly pass `null`, `undefined` or an empty object `{}` to the params argument in order to customise request options.
@@ -234,106 +172,69 @@ This affects the following methods:
234
172
-`client.responses.retrieve()`
235
173
-`client.responses.inputItems.list()`
236
174
237
-
### Pagination changes
238
-
239
-
Note that the `for await` syntax is _not_ affected. This still works as-is:
Previously some methods could not be named intuitively due to an internal naming conflict. This has been fixed and the affected methods are now correctly named.
### Removed `httpAgent` in favor of `fetchOptions`
273
204
274
-
If you were importing these classes at runtime, you'll need to switch to importing the base class or only import them at the type-level.
205
+
The `httpAgent` client option has been removed in favor of a [platform-specific `fetchOptions` property](https://github.com/stainless-sdks/openai-typescript#fetch-options).
206
+
This change was made as `httpAgent` relied on `node:http` agents which are not supported by any runtime's builtin fetch implementation.
275
207
276
-
### File handling
208
+
If you were using `httpAgent` for proxy support, check out the [new proxy documentation](https://github.com/stainless-sdks/openai-typescript#configuring-proxies).
277
209
278
-
The deprecated `fileFromPath` helper has been removed in favor of native Node.js streams:
The `headers` property on `APIError` objects is now an instance of the Web [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) class. It was previously just `Record<string, string | null | undefined>`.
321
-
322
-
### Removed exports
323
-
324
-
#### Resource classes
325
-
326
-
If you were importing resource classes from the root package then you must now import them from the file they are defined in.
327
-
This was never valid at the type level and only worked in CommonJS files.
328
-
329
-
```typescript
330
-
// Before
331
-
const { Completions } =require('openai');
332
-
333
-
// After
334
-
const { OpenAI } =require('openai');
335
-
OpenAI.Completions; // or import directly from openai/resources/completions
336
-
```
237
+
### Changed exports
337
238
338
239
#### Refactor of `openai/core`, `error`, `pagination`, `resource`, `streaming` and `uploads`
If you were relying on anything that was only exported from `openai/core` and is also not accessible anywhere else, please open an issue and we'll consider adding it to the public API.
361
262
263
+
#### Resource classes
264
+
265
+
Previously under certain circumstances it was possible to import resource classes like `Completions` directly from the root of the package. This was never valid at the type level and only worked in CommonJS files.
266
+
Now you must always either reference them as static class properties or import them directly from the files in which they are defined.
267
+
268
+
```typescript
269
+
// Before
270
+
const { Completions } =require('openai');
271
+
272
+
// After
273
+
const { OpenAI } =require('openai');
274
+
OpenAI.Completions; // or import directly from openai/resources/completions
275
+
```
276
+
362
277
#### Cleaned up `uploads` exports
363
278
364
279
As part of the `core` refactor, `openai/uploads` was moved to `openai/core/uploads`
@@ -395,3 +310,86 @@ import { APIClient } from 'openai/core';
395
310
// After
396
311
import { OpenAI } from'openai';
397
312
```
313
+
314
+
### File handling
315
+
316
+
The deprecated `fileFromPath` helper has been removed in favor of native Node.js streams:
317
+
318
+
```ts
319
+
// Before
320
+
OpenAI.fileFromPath('path/to/file');
321
+
322
+
// After
323
+
importfsfrom'fs';
324
+
fs.createReadStream('path/to/file');
325
+
```
326
+
327
+
Note that this function previously only worked on Node.js. If you're using Bun, you can use [`Bun.file`](https://bun.sh/docs/api/file-io) instead.
328
+
329
+
### Shims removal
330
+
331
+
Previously you could configure the types that the SDK used like this:
332
+
333
+
```ts
334
+
// Tell TypeScript and the package to use the global Web fetch instead of node-fetch.
335
+
import'openai/shims/web';
336
+
importOpenAIfrom'openai';
337
+
```
338
+
339
+
The `openai/shims` imports have been removed. Your global types must now be [correctly configured](#minimum-types-requirements).
340
+
341
+
### Pagination changes
342
+
343
+
The `for await` syntax **is not affected**. This still works as-is:
If you were importing these classes at runtime, you'll need to switch to importing the base class or only import them at the type-level.
377
+
378
+
### `openai/src` directory removed
379
+
380
+
Previously IDEs may have auto-completed imports from the `openai/src` directory, however this
381
+
directory was only included for an improved go-to-definition experience and should not have been used at runtime.
382
+
383
+
If you have any `openai/src/*` imports, you will need to replace them with `openai/*`.
384
+
385
+
```ts
386
+
// Before
387
+
importOpenAIfrom'openai/src';
388
+
389
+
// After
390
+
importOpenAIfrom'openai';
391
+
```
392
+
393
+
### Headers
394
+
395
+
The `headers` property on `APIError` objects is now an instance of the Web [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) class. It was previously just `Record<string, string | null | undefined>`.
0 commit comments