Skip to content

Commit 03d1662

Browse files
authored
Merge pull request #475 from openai/release-please--branches--master--changes--next--components--openai
release: 4.17.1
2 parents 96b037a + 0532117 commit 03d1662

File tree

9 files changed

+31
-5
lines changed

9 files changed

+31
-5
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "4.17.0"
2+
".": "4.17.1"
33
}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 4.17.1 (2023-11-09)
4+
5+
Full Changelog: [v4.17.0...v4.17.1](https://github.com/openai/openai-node/compare/v4.17.0...v4.17.1)
6+
7+
### Refactors
8+
9+
* **client:** deprecate files.retrieveContent in favour of files.content ([#474](https://github.com/openai/openai-node/issues/474)) ([7c7bfc2](https://github.com/openai/openai-node/commit/7c7bfc2fad5a786c9172110e90c9566a943e49f9))
10+
311
## 4.17.0 (2023-11-08)
412

513
Full Changelog: [v4.16.2...v4.17.0](https://github.com/openai/openai-node/compare/v4.16.2...v4.17.0)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ You can import in Deno via:
2121
<!-- x-release-please-start-version -->
2222

2323
```ts
24-
import OpenAI from 'https://deno.land/x/openai@v4.17.0/mod.ts';
24+
import OpenAI from 'https://deno.land/x/openai@v4.17.1/mod.ts';
2525
```
2626

2727
<!-- x-release-please-end -->

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Methods:
8282
- <code title="get /files/{file_id}">client.files.<a href="./src/resources/files.ts">retrieve</a>(fileId) -> FileObject</code>
8383
- <code title="get /files">client.files.<a href="./src/resources/files.ts">list</a>({ ...params }) -> FileObjectsPage</code>
8484
- <code title="delete /files/{file_id}">client.files.<a href="./src/resources/files.ts">del</a>(fileId) -> FileDeleted</code>
85+
- <code title="get /files/{file_id}/content">client.files.<a href="./src/resources/files.ts">content</a>(fileId) -> Response</code>
8586
- <code title="get /files/{file_id}/content">client.files.<a href="./src/resources/files.ts">retrieveContent</a>(fileId) -> string</code>
8687
- <code>client.files.<a href="./src/resources/files.ts">waitForProcessing</a>(id, { pollInterval = 5000, maxWait = 30 _ 60 _ 1000 }) -> Promise&lt;FileObject&gt;</code>
8788

build-deno

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This is a build produced from https://github.com/openai/openai-node – please g
1515
Usage:
1616
1717
\`\`\`ts
18-
import OpenAI from "$(echo 'https://deno.land/x/openai@v4.16.2/mod.ts' | sed -E s/@\.+\\//@"$PACKAGE_VERSION"\\//)";
18+
import OpenAI from "$(echo 'https://deno.land/x/openai@v4.17.0/mod.ts' | sed -E s/@\.+\\//@"$PACKAGE_VERSION"\\//)";
1919
2020
const client = new OpenAI();
2121
\`\`\`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openai",
3-
"version": "4.17.0",
3+
"version": "4.17.1",
44
"description": "Client library for the OpenAI API",
55
"author": "OpenAI <support@openai.com>",
66
"types": "dist/index.d.ts",

src/resources/files.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import * as Core from 'openai/core';
44
import { APIResource } from 'openai/resource';
55
import { isRequestOptions } from 'openai/core';
6+
import { type Response } from 'openai/_shims/index';
67
import { sleep } from 'openai/core';
78
import { APIConnectionTimeoutError } from 'openai/error';
89
import * as FilesAPI from 'openai/resources/files';
@@ -58,6 +59,15 @@ export class Files extends APIResource {
5859
/**
5960
* Returns the contents of the specified file.
6061
*/
62+
content(fileId: string, options?: Core.RequestOptions): Core.APIPromise<Response> {
63+
return this.get(`/files/${fileId}/content`, { ...options, __binaryResponse: true });
64+
}
65+
66+
/**
67+
* Returns the contents of the specified file.
68+
*
69+
* @deprecated The `.content()` method should be used instead
70+
*/
6171
retrieveContent(fileId: string, options?: Core.RequestOptions): Core.APIPromise<string> {
6272
return this.get(`/files/${fileId}/content`, {
6373
...options,

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '4.17.0'; // x-release-please-version
1+
export const VERSION = '4.17.1'; // x-release-please-version

tests/api-resources/files.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ describe('resource files', () => {
9191
);
9292
});
9393

94+
test('content: request options instead of params are passed correctly', async () => {
95+
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
96+
await expect(openai.files.content('string', { path: '/_stainless_unknown_path' })).rejects.toThrow(
97+
OpenAI.NotFoundError,
98+
);
99+
});
100+
94101
test('retrieveContent', async () => {
95102
const responsePromise = openai.files.retrieveContent('string');
96103
const rawResponse = await responsePromise.asResponse();

0 commit comments

Comments
 (0)