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

chore(types): define FilePurpose enum #997

Merged
merged 1 commit into from
Aug 15, 2024
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 .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 68
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-285bce7dcdae7eea5fe84a8d6e5af2c1473d65ea193109370fb2257851eef7eb.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-8ff62fa1091460d68fbd36d72c17d91b709917bebf2983c9c4de5784bc384a2e.yml
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Types:
- <code><a href="./src/resources/files.ts">FileContent</a></code>
- <code><a href="./src/resources/files.ts">FileDeleted</a></code>
- <code><a href="./src/resources/files.ts">FileObject</a></code>
- <code><a href="./src/resources/files.ts">FilePurpose</a></code>

Methods:

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export namespace OpenAI {
export import FileContent = API.FileContent;
export import FileDeleted = API.FileDeleted;
export import FileObject = API.FileObject;
export import FilePurpose = API.FilePurpose;
export import FileObjectsPage = API.FileObjectsPage;
export import FileCreateParams = API.FileCreateParams;
export import FileListParams = API.FileListParams;
Expand Down
15 changes: 14 additions & 1 deletion src/resources/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,18 @@ export interface FileObject {
status_details?: string;
}

/**
* The intended purpose of the uploaded file.
*
* Use "assistants" for
* [Assistants](https://platform.openai.com/docs/api-reference/assistants) and
* [Message](https://platform.openai.com/docs/api-reference/messages) files,
* "vision" for Assistants image file inputs, "batch" for
* [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for
* [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning).
*/
export type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision';

export interface FileCreateParams {
/**
* The File object (not file name) to be uploaded.
Expand All @@ -171,7 +183,7 @@ export interface FileCreateParams {
* [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for
* [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning).
*/
purpose: 'assistants' | 'batch' | 'fine-tune' | 'vision';
purpose: FilePurpose;
}

export interface FileListParams {
Expand All @@ -185,6 +197,7 @@ export namespace Files {
export import FileContent = FilesAPI.FileContent;
export import FileDeleted = FilesAPI.FileDeleted;
export import FileObject = FilesAPI.FileObject;
export import FilePurpose = FilesAPI.FilePurpose;
export import FileObjectsPage = FilesAPI.FileObjectsPage;
export import FileCreateParams = FilesAPI.FileCreateParams;
export import FileListParams = FilesAPI.FileListParams;
Expand Down
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export {
FileContent,
FileDeleted,
FileObject,
FilePurpose,
FileCreateParams,
FileListParams,
FileObjectsPage,
Expand Down
2 changes: 1 addition & 1 deletion src/resources/uploads/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export interface UploadCreateParams {
* See the
* [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose).
*/
purpose: 'assistants' | 'batch' | 'fine-tune' | 'vision';
purpose: FilesAPI.FilePurpose;
}

export interface UploadCompleteParams {
Expand Down