/**
* This file was auto-generated by Fern from our API Definition.
*/
///
import * as environments from "../../../../environments";
import * as core from "../../../../core";
import * as Vectara from "../../../index";
import * as fs from "fs";
import { Blob } from "buffer";
export declare namespace Upload {
interface Options {
environment?: core.Supplier;
token?: core.Supplier;
/** Override the x-api-key header */
apiKey?: core.Supplier;
fetcher?: core.FetchFunction;
}
interface RequestOptions {
/** The maximum time to wait for a response in seconds. */
timeoutInSeconds?: number;
/** The number of times to retry the request. Defaults to 2. */
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the x-api-key header */
apiKey?: string | undefined;
/** Additional headers to include in the request. */
headers?: Record;
}
}
/**
* Upload files to a corpus for automatic parsing, text extraction, chunking, and indexing
*/
export declare class Upload {
protected readonly _options: Upload.Options;
constructor(_options?: Upload.Options);
/**
* Upload files such as PDFs and Word Documents for automatic text extraction and metadata parsing.
* The request expects a `multipart/form-data` format containing the following parts:
* * `metadata` - (Optional) Specifies a JSON object representing any additional metadata to be associated with the extracted document. For example, `'metadata={"key": "value"};type=application/json'`
* * `chunking_strategy` - (Optional) Specifies the chunking strategy for the platform to use. If you do not set this option, the platform uses the default strategy, which creates one chunk per sentence. For example, `'chunking_strategy={"type":"max_chars_chunking_strategy","max_chars_per_chunk":200};type=application/json'`
* * `table_extraction_config` - (Optional) Specifies whether to extract table data from the uploaded file. If you do not set this option, the platform does not extract tables from PDF files. Example config, `'table_extraction_config={"extract_tables":true};type=application/json'`
* * `file` - Specifies the file that you want to upload.
* * `filename` - Specified as part of the file field with the file name that you want to associate with the uploaded file. For a curl example, use the following syntax: `'file=@/path/to/file/file.pdf;filename=desired_filename.pdf'`
*
* For more detailed information, see this [File Upload API guide.](https://docs.vectara.com/docs/api-reference/indexing-apis/file-upload/file-upload)
*
* @param {File | fs.ReadStream | Blob} file
* @param {Vectara.CorpusKey} corpusKey
* @param {Vectara.UploadFileRequest} request
* @param {Upload.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Vectara.BadRequestError}
* @throws {@link Vectara.ForbiddenError}
* @throws {@link Vectara.NotFoundError}
*
* @example
* await client.upload.file(fs.createReadStream("/path/to/your/file"), "my-corpus", {})
*/
file(file: File | fs.ReadStream | Blob, corpusKey: Vectara.CorpusKey, request: Vectara.UploadFileRequest, requestOptions?: Upload.RequestOptions): Promise;
protected _getAuthorizationHeader(): Promise;
}