UNPKG

@langchain/community

Version:
1 lines • 4.78 kB
{"version":3,"file":"voy.d.cts","names":["Voy","VoyOriginClient","EmbeddingsInterface","VectorStore","Document","VoyClient","Omit","InternalDoc","VoyVectorStore","Promise","Record"],"sources":["../../src/vectorstores/voy.d.ts"],"sourcesContent":["import type { Voy as VoyOriginClient } from \"voy-search\";\nimport type { EmbeddingsInterface } from \"@langchain/core/embeddings\";\nimport { VectorStore } from \"@langchain/core/vectorstores\";\nimport { Document } from \"@langchain/core/documents\";\nexport type VoyClient = Omit<VoyOriginClient, \"remove\" | \"size\" | \"serialize\" | \"free\">;\n/**\n * Internal interface for storing documents mappings.\n */\ninterface InternalDoc {\n embeddings: number[];\n document: Document;\n}\n/**\n * Class that extends `VectorStore`. It allows to perform similarity search using\n * Voi similarity search engine. The class requires passing Voy Client as an input parameter.\n */\nexport declare class VoyVectorStore extends VectorStore {\n client: VoyClient;\n numDimensions: number | null;\n docstore: InternalDoc[];\n _vectorstoreType(): string;\n constructor(client: VoyClient, embeddings: EmbeddingsInterface);\n /**\n * Adds documents to the Voy database. The documents are embedded using embeddings provided while instantiating the class.\n * @param documents An array of `Document` instances associated with the vectors.\n */\n addDocuments(documents: Document[]): Promise<void>;\n /**\n * Adds vectors to the Voy database. The vectors are associated with\n * the provided documents.\n * @param vectors An array of vectors to be added to the database.\n * @param documents An array of `Document` instances associated with the vectors.\n */\n addVectors(vectors: number[][], documents: Document[]): Promise<void>;\n /**\n * Searches for vectors in the Voy database that are similar to the\n * provided query vector.\n * @param query The query vector.\n * @param k The number of similar vectors to return.\n * @returns A promise that resolves with an array of tuples, each containing a `Document` instance and a similarity score.\n */\n similaritySearchVectorWithScore(query: number[], k: number): Promise<[Document<Record<string, any>>, number][]>;\n /**\n * Method to delete data from the Voy index. It can delete data based\n * on specific IDs or a filter.\n * @param params Object that includes either an array of IDs or a filter for the data to be deleted.\n * @returns Promise that resolves when the deletion is complete.\n */\n delete(params: {\n deleteAll?: boolean;\n }): Promise<void>;\n /**\n * Creates a new `VoyVectorStore` instance from an array of text strings. The text\n * strings are converted to `Document` instances and added to the Voy\n * database.\n * @param texts An array of text strings.\n * @param metadatas An array of metadata objects or a single metadata object. If an array is provided, it must have the same length as the `texts` array.\n * @param embeddings An `Embeddings` instance used to generate embeddings for the documents.\n * @param client An instance of Voy client to use in the underlying operations.\n * @returns A promise that resolves with a new `VoyVectorStore` instance.\n */\n static fromTexts(texts: string[], metadatas: object[] | object, embeddings: EmbeddingsInterface, client: VoyClient): Promise<VoyVectorStore>;\n /**\n * Creates a new `VoyVectorStore` instance from an array of `Document` instances.\n * The documents are added to the Voy database.\n * @param docs An array of `Document` instances.\n * @param embeddings An `Embeddings` instance used to generate embeddings for the documents.\n * @param client An instance of Voy client to use in the underlying operations.\n * @returns A promise that resolves with a new `VoyVectorStore` instance.\n */\n static fromDocuments(docs: Document[], embeddings: EmbeddingsInterface, client: VoyClient): Promise<VoyVectorStore>;\n}\nexport {};\n//# sourceMappingURL=voy.d.ts.map"],"mappings":";;;;;;KAIYK,SAAAA,GAAYC,KAAKL;;AAA7B;AAAwF;AAYxF,UARUM,WAAAA,CAQyB;EACvBF,UAAAA,EAAAA,MAAAA,EAAAA;EAEEE,QAAAA,EATAH,QASAG;;;;;;AAc8CE,cAjBvCD,cAAAA,SAAuBL,WAAAA,CAiBgBM;EAQuBC,MAAAA,EAxBvEL,SAwBuEK;EAATN,aAAAA,EAAAA,MAAAA,GAAAA,IAAAA;EAATK,QAAAA,EAtBnDF,WAsBmDE,EAAAA;EASzDA,gBAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAWwEP,WAAAA,CAAAA,MAAAA,EAxCxDG,SAwCwDH,EAAAA,UAAAA,EAxCjCA,mBAwCiCA;EAA6BG;;;;EAStDH,YAAAA,CAAAA,SAAAA,EA5C3BE,QA4C2BF,EAAAA,CAAAA,EA5CdO,OA4CcP,CAAAA,IAAAA,CAAAA;EAA6BG;;;;AAtD7B;;6CAiBRD,aAAaK;;;;;;;;+DAQKA,SAASL,SAASM;;;;;;;;;MAS3ED;;;;;;;;;;;8EAWwEP,6BAA6BG,YAAYI,QAAQD;;;;;;;;;6BASlGJ,wBAAwBF,6BAA6BG,YAAYI,QAAQD"}