@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 6.86 kB
Source Map (JSON)
{"version":3,"file":"analyticdb.d.ts","names":["PoolConfig","VectorStore","EmbeddingsInterface","Document","AnalyticDBArgs","AnalyticDBVectorStore","Record","Promise"],"sources":["../../src/vectorstores/analyticdb.d.ts"],"sourcesContent":["import { PoolConfig } from \"pg\";\nimport { VectorStore } from \"@langchain/core/vectorstores\";\nimport type { EmbeddingsInterface } from \"@langchain/core/embeddings\";\nimport { Document } from \"@langchain/core/documents\";\n/**\n * Interface defining the arguments required to create an instance of\n * `AnalyticDBVectorStore`.\n */\nexport interface AnalyticDBArgs {\n connectionOptions: PoolConfig;\n embeddingDimension?: number;\n collectionName?: string;\n preDeleteCollection?: boolean;\n}\n/**\n * Class that provides methods for creating and managing a collection of\n * documents in an AnalyticDB, adding documents or vectors to the\n * collection, performing similarity search on vectors, and creating an\n * instance of `AnalyticDBVectorStore` from texts or documents.\n */\nexport declare class AnalyticDBVectorStore extends VectorStore {\n FilterType: Record<string, any>;\n private pool;\n private embeddingDimension?;\n private collectionName;\n private preDeleteCollection;\n private isCreateCollection;\n _vectorstoreType(): string;\n constructor(embeddings: EmbeddingsInterface, args: AnalyticDBArgs);\n /**\n * Closes all the clients in the pool and terminates the pool.\n * @returns Promise that resolves when all clients are closed and the pool is terminated.\n */\n end(): Promise<void>;\n /**\n * Creates a new table in the database if it does not already exist. The\n * table is created with columns for id, embedding, document, and\n * metadata. An index is also created on the embedding column if it does\n * not already exist.\n * @returns Promise that resolves when the table and index are created.\n */\n createTableIfNotExists(): Promise<void>;\n /**\n * Deletes the collection from the database if it exists.\n * @returns Promise that resolves when the collection is deleted.\n */\n deleteCollection(): Promise<void>;\n /**\n * Creates a new collection in the database. If `preDeleteCollection` is\n * true, any existing collection with the same name is deleted before the\n * new collection is created.\n * @returns Promise that resolves when the collection is created.\n */\n createCollection(): Promise<void>;\n /**\n * Adds an array of documents to the collection. The documents are first\n * converted to vectors using the `embedDocuments` method of the\n * `embeddings` instance.\n * @param documents Array of Document instances to be added to the collection.\n * @returns Promise that resolves when the documents are added.\n */\n addDocuments(documents: Document[]): Promise<void>;\n /**\n * Adds an array of vectors and corresponding documents to the collection.\n * The vectors and documents are batch inserted into the database.\n * @param vectors Array of vectors to be added to the collection.\n * @param documents Array of Document instances corresponding to the vectors.\n * @returns Promise that resolves when the vectors and documents are added.\n */\n addVectors(vectors: number[][], documents: Document[]): Promise<void>;\n /**\n * Performs a similarity search on the vectors in the collection. The\n * search is performed using the given query vector and returns the top k\n * most similar vectors along with their corresponding documents and\n * similarity scores.\n * @param query Query vector for the similarity search.\n * @param k Number of top similar vectors to return.\n * @param filter Optional. Filter to apply on the metadata of the documents.\n * @returns Promise that resolves to an array of tuples, each containing a Document instance and its similarity score.\n */\n similaritySearchVectorWithScore(query: number[], k: number, filter?: this[\"FilterType\"]): Promise<[Document, number][]>;\n /**\n * Creates an instance of `AnalyticDBVectorStore` from an array of texts\n * and corresponding metadata. The texts are first converted to Document\n * instances before being added to the collection.\n * @param texts Array of texts to be added to the collection.\n * @param metadatas Array or object of metadata corresponding to the texts.\n * @param embeddings Embeddings instance used to convert the texts to vectors.\n * @param dbConfig Configuration for the AnalyticDB.\n * @returns Promise that resolves to an instance of `AnalyticDBVectorStore`.\n */\n static fromTexts(texts: string[], metadatas: object[] | object, embeddings: EmbeddingsInterface, dbConfig: AnalyticDBArgs): Promise<AnalyticDBVectorStore>;\n /**\n * Creates an instance of `AnalyticDBVectorStore` from an array of\n * Document instances. The documents are added to the collection.\n * @param docs Array of Document instances to be added to the collection.\n * @param embeddings Embeddings instance used to convert the documents to vectors.\n * @param dbConfig Configuration for the AnalyticDB.\n * @returns Promise that resolves to an instance of `AnalyticDBVectorStore`.\n */\n static fromDocuments(docs: Document[], embeddings: EmbeddingsInterface, dbConfig: AnalyticDBArgs): Promise<AnalyticDBVectorStore>;\n /**\n * Creates an instance of `AnalyticDBVectorStore` from an existing index\n * in the database. A new collection is created in the database.\n * @param embeddings Embeddings instance used to convert the documents to vectors.\n * @param dbConfig Configuration for the AnalyticDB.\n * @returns Promise that resolves to an instance of `AnalyticDBVectorStore`.\n */\n static fromExistingIndex(embeddings: EmbeddingsInterface, dbConfig: AnalyticDBArgs): Promise<AnalyticDBVectorStore>;\n}\n//# sourceMappingURL=analyticdb.d.ts.map"],"mappings":";;;;;;;;;AAQA;AAYA;AACgBM,UAbCF,cAAAA,CAaDE;EAOYJ,iBAAAA,EAnBLF,UAmBKE;EAA2BE,kBAAAA,CAAAA,EAAAA,MAAAA;EAK5CG,cAAAA,CAAAA,EAAAA,MAAAA;EAQmBA,mBAAAA,CAAAA,EAAAA,OAAAA;;;;;;;;AAuCgEA,cA5DzEF,qBAAAA,SAA8BJ,WAAAA,CA4D2CM;EAWdL,UAAAA,EAtEhEI,MAsEgEJ,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA;EAA+BE,QAAAA,IAAAA;EAAyBC,QAAAA,kBAAAA;EAARE,QAAAA,cAAAA;EASjGJ,QAAAA,mBAAAA;EAAwBD,QAAAA,kBAAAA;EAA+BE,gBAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAAyBC,WAAAA,CAAAA,UAAAA,EAxEnFH,mBAwEmFG,EAAAA,IAAAA,EAxExDD,cAwEwDC;EAARE;;;;EAQdA,GAAAA,CAAAA,CAAAA,EA3E9EA,OA2E8EA,CAAAA,IAAAA,CAAAA;EAxFtCN;AAAW;;;;;;4BAqBhCM;;;;;sBAKNA;;;;;;;sBAOAA;;;;;;;;0BAQIJ,aAAaI;;;;;;;;6CAQMJ,aAAaI;;;;;;;;;;;4FAWkCA,SAASJ;;;;;;;;;;;8EAWvBD,+BAA+BE,iBAAiBG,QAAQF;;;;;;;;;6BASzGF,wBAAwBD,+BAA+BE,iBAAiBG,QAAQF;;;;;;;;uCAQtEH,+BAA+BE,iBAAiBG,QAAQF"}