Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 4.17.1 #475

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.17.0"
".": "4.17.1"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You can import in Deno via:
<!-- x-release-please-start-version -->

```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';
```

<!-- x-release-please-end -->
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Methods:
- <code title="get /files/{file_id}">client.files.<a href="./src/resources/files.ts">retrieve</a>(fileId) -> FileObject</code>
- <code title="get /files">client.files.<a href="./src/resources/files.ts">list</a>({ ...params }) -> FileObjectsPage</code>
- <code title="delete /files/{file_id}">client.files.<a href="./src/resources/files.ts">del</a>(fileId) -> FileDeleted</code>
- <code title="get /files/{file_id}/content">client.files.<a href="./src/resources/files.ts">content</a>(fileId) -> Response</code>
- <code title="get /files/{file_id}/content">client.files.<a href="./src/resources/files.ts">retrieveContent</a>(fileId) -> string</code>
- <code>client.files.<a href="./src/resources/files.ts">waitForProcessing</a>(id, { pollInterval = 5000, maxWait = 30 _ 60 _ 1000 }) -> Promise&lt;FileObject&gt;</code>

Expand Down
2 changes: 1 addition & 1 deletion build-deno
Original file line number Diff line number Diff line change
Expand Up @@ -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();
\`\`\`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openai",
"version": "4.17.0",
"version": "4.17.1",
"description": "Client library for the OpenAI API",
"author": "OpenAI <support@openai.com>",
"types": "dist/index.d.ts",
Expand Down
10 changes: 10 additions & 0 deletions src/resources/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -58,6 +59,15 @@ export class Files extends APIResource {
/**
* Returns the contents of the specified file.
*/
content(fileId: string, options?: Core.RequestOptions): Core.APIPromise<Response> {
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<string> {
return this.get(`/files/${fileId}/content`, {
...options,
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '4.17.0'; // x-release-please-version
export const VERSION = '4.17.1'; // x-release-please-version
7 changes: 7 additions & 0 deletions tests/api-resources/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down