/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { documentsBatchIndex } from "../funcs/documentsBatchIndex.js"; import { documentsDelete } from "../funcs/documentsDelete.js"; import { documentsGet } from "../funcs/documentsGet.js"; import { documentsIndex } from "../funcs/documentsIndex.js"; import { documentsIndexFile } from "../funcs/documentsIndexFile.js"; import { documentsIndexMultimodal } from "../funcs/documentsIndexMultimodal.js"; import { documentsList } from "../funcs/documentsList.js"; import { documentsRetrieve } from "../funcs/documentsRetrieve.js"; import { documentsRetrieveSimilar } from "../funcs/documentsRetrieveSimilar.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class Documents extends ClientSDK { /** * List documents within an index * * @remarks * Retrieve a list of all documents. */ async list( request: operations.ListDocumentsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(documentsList( this, request, options, )); } /** * Batch index text documents * * @remarks * Batch index text documents. Limited to 100 documents per batch. */ async batchIndex( request: components.BatchIndexTextRequest, options?: RequestOptions, ): Promise { return unwrapAsync(documentsBatchIndex( this, request, options, )); } /** * Index a document by uploading a file * * @remarks * Index a document into the specified index by uploading a file. Supports UTF-8 encoded text-based files and PDF files. The file size must be less than 60MB. */ async indexFile( request: components.IndexFileRequest, options?: RequestOptions, ): Promise { return unwrapAsync(documentsIndexFile( this, request, options, )); } /** * Index a document from an image and text content * * @remarks * Index a document into the specified index by providing the image and text content as a JSON object. */ async indexMultimodal( request: components.IndexMultimodalRequest, options?: RequestOptions, ): Promise { return unwrapAsync(documentsIndexMultimodal( this, request, options, )); } /** * Index a document from text content * * @remarks * Index a document into the specified index by providing the content as a JSON object. */ async index( request: components.IndexTextRequest, options?: RequestOptions, ): Promise { return unwrapAsync(documentsIndex( this, request, options, )); } /** * Retrieve documents from an index * * @remarks * Retrieve documents from an index using a query, top_k, and other parameters */ async retrieve( request: components.RetrieveDocumentsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(documentsRetrieve( this, request, options, )); } /** * Find documents similar to a given document * * @remarks * Retrieve documents that are similar to a specified document based on content similarity */ async retrieveSimilar( request: components.RetrieveSimilarDocumentsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(documentsRetrieveSimilar( this, request, options, )); } /** * Delete a document * * @remarks * Delete a specific document by providing its unique identifier. */ async delete( request: operations.DeleteDocumentRequest, options?: RequestOptions, ): Promise { return unwrapAsync(documentsDelete( this, request, options, )); } /** * Get a document by ID with pagination * * @remarks * Retrieve a specific document by providing the document ID, supporting pagination for large documents with multiple chunks. */ async get( request: operations.GetDocumentRequest, options?: RequestOptions, ): Promise { return unwrapAsync(documentsGet( this, request, options, )); } }