UNPKG

@langchain/community

Version:
1 lines • 3.8 kB
{"version":3,"file":"xata.d.ts","names":["BaseClient","EmbeddingsInterface","VectorStore","Document","XataClientArgs","XataClient","XataFilter","XataVectorSearch","Promise"],"sources":["../../src/vectorstores/xata.d.ts"],"sourcesContent":["import { BaseClient } from \"@xata.io/client\";\nimport type { EmbeddingsInterface } from \"@langchain/core/embeddings\";\nimport { VectorStore } from \"@langchain/core/vectorstores\";\nimport { Document } from \"@langchain/core/documents\";\n/**\n * Interface for the arguments required to create a XataClient. Includes\n * the client instance and the table name.\n */\nexport interface XataClientArgs<XataClient> {\n readonly client: XataClient;\n readonly table: string;\n}\n/**\n * Type for the filter object used in Xata database queries.\n */\ntype XataFilter = object;\n/**\n * Class for interacting with a Xata database as a VectorStore. Provides\n * methods to add documents and vectors to the database, delete entries,\n * and perform similarity searches.\n */\nexport declare class XataVectorSearch<XataClient extends BaseClient> extends VectorStore {\n FilterType: XataFilter;\n private readonly client;\n private readonly table;\n _vectorstoreType(): string;\n constructor(embeddings: EmbeddingsInterface, args: XataClientArgs<XataClient>);\n /**\n * Method to add documents to the Xata database. Maps the page content of\n * each document, embeds the documents using the embeddings, and adds the\n * vectors to the database.\n * @param documents Array of documents to be added.\n * @param options Optional object containing an array of ids.\n * @returns Promise resolving to an array of ids of the added documents.\n */\n addDocuments(documents: Document[], options?: {\n ids?: string[];\n }): Promise<string[]>;\n /**\n * Method to add vectors to the Xata database. Maps each vector to a row\n * with the document's content, embedding, and metadata. Creates or\n * replaces these rows in the Xata database.\n * @param vectors Array of vectors to be added.\n * @param documents Array of documents corresponding to the vectors.\n * @param options Optional object containing an array of ids.\n * @returns Promise resolving to an array of ids of the added vectors.\n */\n addVectors(vectors: number[][], documents: Document[], options?: {\n ids?: string[];\n }): Promise<string[]>;\n /**\n * Method to delete entries from the Xata database. Deletes the entries\n * with the provided ids.\n * @param params Object containing an array of ids of the entries to be deleted.\n * @returns Promise resolving to void.\n */\n delete(params: {\n ids: string[];\n }): Promise<void>;\n /**\n * Method to perform a similarity search in the Xata database. Returns the\n * k most similar documents along with their scores.\n * @param query Query vector for the similarity search.\n * @param k Number of most similar documents to return.\n * @param filter Optional filter for the search.\n * @returns Promise resolving to an array of tuples, each containing a Document and its score.\n */\n similaritySearchVectorWithScore(query: number[], k: number, filter?: XataFilter | undefined): Promise<[Document, number][]>;\n}\nexport {};\n//# sourceMappingURL=xata.d.ts.map"],"mappings":";;;;;;;;;AAQA;AAGC;AAUoBO,UAbJH,cAaoBC,CAAAA,UAAAA,CAAAA,CAAAA;EAAoBL,SAAAA,MAAAA,EAZpCK,UAYoCL;EACzCM,SAAAA,KAAAA,EAAAA,MAAAA;;;;;KAPXA,UAAAA,GAsBGE,MAAAA;;;;;;AA8B0FA,cA9C7ED,gBA8C6EC,CAAAA,mBA9CzCR,UA8CyCQ,CAAAA,SA9CrBN,WAAAA,CA8CqBM;EA9CrBN,UAAAA,EAC7DI,UAD6DJ;EAAW,iBAAA,MAAA;;;0BAK5DD,2BAA2BG,eAAeC;;;;;;;;;0BAS1CF;;MAEpBK;;;;;;;;;;6CAUuCL;;MAEvCK;;;;;;;;;MASAA;;;;;;;;;uEASiEF,yBAAyBE,SAASL"}