/** * 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"; export declare namespace Documents { 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; } } /** * Retrieve and manage documents stored in a corpus for administrative tasks */ export declare class Documents { protected readonly _options: Documents.Options; constructor(_options?: Documents.Options); /** * Retrieve a list of documents stored in a specific corpus. This endpoint * provides an overview of document metadata without returning the full content of * each document. * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the queried corpus. * @param {Vectara.DocumentsListRequest} request * @param {Documents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.documents.list("my-corpus") */ list(corpusKey: Vectara.CorpusKey, request?: Vectara.DocumentsListRequest, requestOptions?: Documents.RequestOptions): Promise>; /** * Add a document to a corpus. This endpoint supports two document formats, structured and core. * * * **Structured** documents have a more conventional structure that provide document sections * and parts in a format created by Vectara's proprietary strategy automatically. You provide * a logical document structure, and Vectara handles the partitioning. * * **Core** documents differ in that they follow an advanced, granular structure that * explicitly defines each document part in an array. Each part becomes a distinct, * searchable item in query results. You have precise control over the document structure * and content. * * For more details, see [Indexing](https://docs.vectara.com/docs/learn/select-ideal-indexing-api). * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the queried corpus. * @param {Vectara.DocumentsCreateRequest} request * @param {Documents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.BadRequestError} * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.documents.create("my-corpus-key", { * body: { * id: "my-doc-id", * type: "structured", * sections: [{ * id: 1, * title: "A nice title.", * text: "I'm a nice document section.", * metadata: { * "section": "1.1" * } * }, { * id: 2, * title: "Another nice title.", * text: "I'm another document section on something else.", * metadata: { * "section": "1.2" * } * }], * metadata: { * "url": "https://example.com" * } * } * }) */ create(corpusKey: Vectara.CorpusKey, request: Vectara.DocumentsCreateRequest, requestOptions?: Documents.RequestOptions): Promise; /** * Retrieve the content and metadata of a specific document, identified by its * unique `document_id` from a specific corpus. * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the corpus containing the document to retrieve. * @param {string} documentId - The document ID of the document to retrieve. * This `document_id` must be percent encoded. * @param {Vectara.GetCorpusDocumentRequest} request * @param {Documents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.documents.getCorpusDocument("my-corpus", "document_id") */ getCorpusDocument(corpusKey: Vectara.CorpusKey, documentId: string, request?: Vectara.GetCorpusDocumentRequest, requestOptions?: Documents.RequestOptions): Promise; /** * Permanently delete a document identified by its unique `document_id` from a specific * corpus. This operation cannot be undone, so use it with caution. * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the corpus with the document to delete. * @param {string} documentId - The document ID of the document to delete. * This `document_id` must be percent encoded. * @param {Vectara.DocumentsDeleteRequest} request * @param {Documents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.documents.delete("my-corpus", "document_id") */ delete(corpusKey: Vectara.CorpusKey, documentId: string, request?: Vectara.DocumentsDeleteRequest, requestOptions?: Documents.RequestOptions): Promise; protected _getAuthorizationHeader(): Promise; }