basant307/AI_Governance_Project
048
1import { APIResource } from "../core/resource.mjs";2import { APIPromise } from "../core/api-promise.mjs";3import { CursorPage, type CursorPageParams, PagePromise } from "../core/pagination.mjs";4import { type Uploadable } from "../core/uploads.mjs";5import { RequestOptions } from "../internal/request-options.mjs";6export declare class Files extends APIResource {7 /**8 * Upload a file that can be used across various endpoints. Individual files can be9 * up to 512 MB, and the size of all files uploaded by one organization can be up10 * to 100 GB.11 *12 * The Assistants API supports files up to 2 million tokens and of specific file13 * types. See the14 * [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) for15 * details.16 *17 * The Fine-tuning API only supports `.jsonl` files. The input also has certain18 * required formats for fine-tuning19 * [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or20 * [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)21 * models.22 *23 * The Batch API only supports `.jsonl` files up to 200 MB in size. The input also24 * has a specific required25 * [format](https://platform.openai.com/docs/api-reference/batch/request-input).26 *27 * Please [contact us](https://help.openai.com/) if you need to increase these28 * storage limits.29 */30 create(body: FileCreateParams, options?: RequestOptions): APIPromise<FileObject>;31 /**32 * Returns information about a specific file.33 */34 retrieve(fileID: string, options?: RequestOptions): APIPromise<FileObject>;35 /**36 * Returns a list of files.37 */38 list(query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<FileObjectsPage, FileObject>;39 /**40 * Delete a file.41 */42 delete(fileID: string, options?: RequestOptions): APIPromise<FileDeleted>;43 /**44 * Returns the contents of the specified file.45 */46 content(fileID: string, options?: RequestOptions): APIPromise<Response>;47 /**48 * Waits for the given file to be processed, default timeout is 30 mins.49 */50 waitForProcessing(id: string, { pollInterval, maxWait }?: {51 pollInterval?: number;52 maxWait?: number;53 }): Promise<FileObject>;54}55export type FileObjectsPage = CursorPage<FileObject>;56export type FileContent = string;57export interface FileDeleted {58 id: string;59 deleted: boolean;60 object: 'file';61}62/**63 * The `File` object represents a document that has been uploaded to OpenAI.64 */65export interface FileObject {66 /**67 * The file identifier, which can be referenced in the API endpoints.68 */69 id: string;70 /**71 * The size of the file, in bytes.72 */73 bytes: number;74 /**75 * The Unix timestamp (in seconds) for when the file was created.76 */77 created_at: number;78 /**79 * The name of the file.80 */81 filename: string;82 /**83 * The object type, which is always `file`.84 */85 object: 'file';86 /**87 * The intended purpose of the file. Supported values are `assistants`,88 * `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`,89 * `vision`, and `user_data`.90 */91 purpose: 'assistants' | 'assistants_output' | 'batch' | 'batch_output' | 'fine-tune' | 'fine-tune-results' | 'vision' | 'user_data';92 /**93 * @deprecated Deprecated. The current status of the file, which can be either94 * `uploaded`, `processed`, or `error`.95 */96 status: 'uploaded' | 'processed' | 'error';97 /**98 * The Unix timestamp (in seconds) for when the file will expire.99 */100 expires_at?: number;101 /**102 * @deprecated Deprecated. For details on why a fine-tuning training file failed103 * validation, see the `error` field on `fine_tuning.job`.104 */105 status_details?: string;106}107/**108 * The intended purpose of the uploaded file. One of: - `assistants`: Used in the109 * Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for110 * fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`:111 * Flexible file type for any purpose - `evals`: Used for eval data sets112 */113export type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision' | 'user_data' | 'evals';114export interface FileCreateParams {115 /**116 * The File object (not file name) to be uploaded.117 */118 file: Uploadable;119 /**120 * The intended purpose of the uploaded file. One of: - `assistants`: Used in the121 * Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for122 * fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`:123 * Flexible file type for any purpose - `evals`: Used for eval data sets124 */125 purpose: FilePurpose;126}127export interface FileListParams extends CursorPageParams {128 /**129 * Sort order by the `created_at` timestamp of the objects. `asc` for ascending130 * order and `desc` for descending order.131 */132 order?: 'asc' | 'desc';133 /**134 * Only return files with the given purpose.135 */136 purpose?: string;137}138export declare namespace Files {139 export { type FileContent as FileContent, type FileDeleted as FileDeleted, type FileObject as FileObject, type FilePurpose as FilePurpose, type FileObjectsPage as FileObjectsPage, type FileCreateParams as FileCreateParams, type FileListParams as FileListParams, };140}141//# sourceMappingURL=files.d.mts.map