Type Alias UploadFileOptions

UploadFileOptions: {
    metadata?: Record<string, string | number>;
    multimodal?: boolean;
} & (
    | { file?: never; fileName?: never; path: string }
    | { file: Uploadable; fileName: string; path?: never }
)

Options for uploading a file to an assistant.

Provide either path (a local file path) or file + fileName (an in-memory buffer, blob, or readable stream). The two forms are mutually exclusive.

Type declaration

  • Optionalmetadata?: Record<string, string | number>

    Metadata to attach to the file.

  • Optionalmultimodal?: boolean

    Whether to process the file as multimodal (enabling image extraction). Defaults to false.

  • { file?: never; fileName?: never; path: string }
    • Optionalfile?: never
    • OptionalfileName?: never
    • path: string

      The local path to the file to upload. The file is read asynchronously.

  • { file: Uploadable; fileName: string; path?: never }
    • file: Uploadable

      The file data to upload. Accepts a Buffer, Blob, or Node.js ReadableStream. When passing a stream, fileName is required so the server receives a meaningful filename.

    • fileName: string

      The filename to use in the multipart upload (e.g. "report.pdf"). Required when using file.

    • Optionalpath?: never