diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index ac650bfe5..b7d9bba0f 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.17.0"
+ ".": "4.17.1"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de140b63d..798a6a4e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 4.17.1 (2023-11-09)
+
+Full Changelog: [v4.17.0...v4.17.1](https://github.com/openai/openai-node/compare/v4.17.0...v4.17.1)
+
+### Refactors
+
+* **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))
+
## 4.17.0 (2023-11-08)
Full Changelog: [v4.16.2...v4.17.0](https://github.com/openai/openai-node/compare/v4.16.2...v4.17.0)
diff --git a/README.md b/README.md
index f174ec4ff..f05f11b8e 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ You can import in Deno via:
```ts
-import OpenAI from 'https://deno.land/x/openai@v4.17.0/mod.ts';
+import OpenAI from 'https://deno.land/x/openai@v4.17.1/mod.ts';
```
diff --git a/api.md b/api.md
index 67ff66dec..b8da4cf0c 100644
--- a/api.md
+++ b/api.md
@@ -82,6 +82,7 @@ Methods:
- client.files.retrieve(fileId) -> FileObject
- client.files.list({ ...params }) -> FileObjectsPage
- client.files.del(fileId) -> FileDeleted
+- client.files.content(fileId) -> Response
- client.files.retrieveContent(fileId) -> string
- client.files.waitForProcessing(id, { pollInterval = 5000, maxWait = 30 _ 60 _ 1000 }) -> Promise<FileObject>
diff --git a/build-deno b/build-deno
index c6c34389e..e179de38e 100755
--- a/build-deno
+++ b/build-deno
@@ -15,7 +15,7 @@ This is a build produced from https://github.com/openai/openai-node – please g
Usage:
\`\`\`ts
-import OpenAI from "$(echo 'https://deno.land/x/openai@v4.16.2/mod.ts' | sed -E s/@\.+\\//@"$PACKAGE_VERSION"\\//)";
+import OpenAI from "$(echo 'https://deno.land/x/openai@v4.17.0/mod.ts' | sed -E s/@\.+\\//@"$PACKAGE_VERSION"\\//)";
const client = new OpenAI();
\`\`\`
diff --git a/package.json b/package.json
index 0ddfa10f3..ca8e904f6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "openai",
- "version": "4.17.0",
+ "version": "4.17.1",
"description": "Client library for the OpenAI API",
"author": "OpenAI ",
"types": "dist/index.d.ts",
diff --git a/src/resources/files.ts b/src/resources/files.ts
index 78acc40ed..4dda2f7ba 100644
--- a/src/resources/files.ts
+++ b/src/resources/files.ts
@@ -3,6 +3,7 @@
import * as Core from 'openai/core';
import { APIResource } from 'openai/resource';
import { isRequestOptions } from 'openai/core';
+import { type Response } from 'openai/_shims/index';
import { sleep } from 'openai/core';
import { APIConnectionTimeoutError } from 'openai/error';
import * as FilesAPI from 'openai/resources/files';
@@ -58,6 +59,15 @@ export class Files extends APIResource {
/**
* Returns the contents of the specified file.
*/
+ content(fileId: string, options?: Core.RequestOptions): Core.APIPromise {
+ return this.get(`/files/${fileId}/content`, { ...options, __binaryResponse: true });
+ }
+
+ /**
+ * Returns the contents of the specified file.
+ *
+ * @deprecated The `.content()` method should be used instead
+ */
retrieveContent(fileId: string, options?: Core.RequestOptions): Core.APIPromise {
return this.get(`/files/${fileId}/content`, {
...options,
diff --git a/src/version.ts b/src/version.ts
index c75285419..008e616ef 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '4.17.0'; // x-release-please-version
+export const VERSION = '4.17.1'; // x-release-please-version
diff --git a/tests/api-resources/files.test.ts b/tests/api-resources/files.test.ts
index a84a2aba7..9e6373aba 100644
--- a/tests/api-resources/files.test.ts
+++ b/tests/api-resources/files.test.ts
@@ -91,6 +91,13 @@ describe('resource files', () => {
);
});
+ test('content: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(openai.files.content('string', { path: '/_stainless_unknown_path' })).rejects.toThrow(
+ OpenAI.NotFoundError,
+ );
+ });
+
test('retrieveContent', async () => {
const responsePromise = openai.files.retrieveContent('string');
const rawResponse = await responsePromise.asResponse();