Hierarchy

  • APIResource
    • Files

Constructors

  • Parameters

    • client: OpenAI

    Returns OpenAIClient.Files

Methods

  • Returns the contents of the specified file.

    Parameters

    • fileId: string
    • Optionaloptions: RequestOptions<unknown>

    Returns APIPromise<Response>

  • Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.

    The Assistants API supports files up to 2 million tokens and of specific file types. See the Assistants Tools guide for details.

    The Fine-tuning API only supports .jsonl files. The input also has certain required formats for fine-tuning chat or completions models.

    The Batch API only supports .jsonl files up to 100 MB in size. The input also has a specific required format.

    Please contact us if you need to increase these storage limits.

    Parameters

    Returns APIPromise<FileObject>

  • Delete a file.

    Parameters

    • fileId: string
    • Optionaloptions: RequestOptions<unknown>

    Returns APIPromise<FileDeleted>

  • Returns information about a specific file.

    Parameters

    • fileId: string
    • Optionaloptions: RequestOptions<unknown>

    Returns APIPromise<FileObject>

  • Returns the contents of the specified file.

    Parameters

    • fileId: string
    • Optionaloptions: RequestOptions<unknown>

    Returns APIPromise<string>

    The .content() method should be used instead

  • Waits for the given file to be processed, default timeout is 30 mins.

    Parameters

    • id: string
    • Optional__namedParameters: {
          maxWait?: number;
          pollInterval?: number;
      }
      • OptionalmaxWait?: number
      • OptionalpollInterval?: number

    Returns Promise<FileObject>