@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 5.74 kB
Source Map (JSON)
{"version":3,"file":"libsql.d.ts","names":["Document","EmbeddingsInterface","VectorStore","Client","InStatement","WhereCondition","MetadataDefault","Record","LibSQLVectorStoreArgs","LibSQLVectorStore","Metadata","Promise"],"sources":["../../src/vectorstores/libsql.d.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\nimport type { EmbeddingsInterface } from \"@langchain/core/embeddings\";\nimport { VectorStore } from \"@langchain/core/vectorstores\";\nimport type { Client, InStatement } from \"@libsql/client\";\nimport { WhereCondition } from \"../utils/sqlite_where_builder.js\";\ntype MetadataDefault = Record<string, any>;\n/**\n * Interface for LibSQLVectorStore configuration options.\n */\nexport interface LibSQLVectorStoreArgs {\n db: Client;\n /** Name of the table to store vectors. Defaults to \"vectors\". */\n table?: string;\n /** Name of the column to store embeddings. Defaults to \"embedding\". */\n column?: string;\n}\n/**\n * A vector store using LibSQL/Turso for storage and retrieval.\n */\nexport declare class LibSQLVectorStore<Metadata extends MetadataDefault = MetadataDefault> extends VectorStore {\n FilterType: string | InStatement | WhereCondition<Metadata>;\n private db;\n private readonly table;\n private readonly column;\n /**\n * Returns the type of vector store.\n * @returns {string} The string \"libsql\".\n */\n _vectorstoreType(): string;\n /**\n * Initializes a new instance of the LibSQLVectorStore.\n * @param {EmbeddingsInterface} embeddings - The embeddings interface to use.\n * @param {Client} db - The LibSQL client instance.\n * @param {LibSQLVectorStoreArgs} options - Configuration options for the vector store.\n */\n constructor(embeddings: EmbeddingsInterface, options: LibSQLVectorStoreArgs);\n /**\n * Adds documents to the vector store.\n * @param {Document<Metadata>[]} documents - The documents to add.\n * @returns {Promise<string[]>} The IDs of the added documents.\n */\n addDocuments(documents: Document<Metadata>[]): Promise<string[]>;\n /**\n * Adds vectors to the vector store.\n * @param {number[][]} vectors - The vectors to add.\n * @param {Document<Metadata>[]} documents - The documents associated with the vectors.\n * @returns {Promise<string[]>} The IDs of the added vectors.\n */\n addVectors(vectors: number[][], documents: Document<Metadata>[]): Promise<string[]>;\n /**\n * Performs a similarity search using a vector query and returns documents with their scores.\n * @param {number[]} query - The query vector.\n * @param {number} k - The number of results to return.\n * @returns {Promise<[Document<Metadata>, number][]>} An array of tuples containing the similar documents and their scores.\n */\n similaritySearchVectorWithScore(query: number[], k: number, filter?: this[\"FilterType\"]): Promise<[Document<Metadata>, number][]>;\n /**\n * Deletes vectors from the store.\n * @param {Object} params - Delete parameters.\n * @param {string[] | number[]} [params.ids] - The ids of the vectors to delete.\n * @returns {Promise<void>}\n */\n delete(params: {\n ids?: string[] | number[];\n deleteAll?: boolean;\n }): Promise<void>;\n /**\n * Creates a new LibSQLVectorStore instance from texts.\n * @param {string[]} texts - The texts to add to the store.\n * @param {object[] | object} metadatas - The metadata for the texts.\n * @param {EmbeddingsInterface} embeddings - The embeddings interface to use.\n * @param {Client} dbClient - The LibSQL client instance.\n * @param {LibSQLVectorStoreArgs} [options] - Configuration options for the vector store.\n * @returns {Promise<LibSQLVectorStore>} A new LibSQLVectorStore instance.\n */\n static fromTexts<Metadata extends MetadataDefault = MetadataDefault>(texts: string[], metadatas: Metadata[] | Metadata, embeddings: EmbeddingsInterface, options: LibSQLVectorStoreArgs): Promise<LibSQLVectorStore<Metadata>>;\n /**\n * Creates a new LibSQLVectorStore instance from documents.\n * @param {Document[]} docs - The documents to add to the store.\n * @param {EmbeddingsInterface} embeddings - The embeddings interface to use.\n * @param {Client} dbClient - The LibSQL client instance.\n * @param {LibSQLVectorStoreArgs} [options] - Configuration options for the vector store.\n * @returns {Promise<LibSQLVectorStore>} A new LibSQLVectorStore instance.\n */\n static fromDocuments<Metadata extends MetadataDefault = MetadataDefault>(docs: Document<Metadata>[], embeddings: EmbeddingsInterface, options: LibSQLVectorStoreArgs): Promise<LibSQLVectorStore<Metadata>>;\n}\nexport {};\n//# sourceMappingURL=libsql.d.ts.map"],"mappings":";;;;;;;KAKKM,eAAAA,GAAkBC;;AAD2C;AAKlE;AAUqBE,UAVJD,qBAAAA,CAUqBE;EAAkBJ,EAAAA,EAThDH,MASgDG;EAAkBA;EACjDF,KAAAA,CAAAA,EAAAA,MAAAA;EAA6BM;EAAfL,MAAAA,CAAAA,EAAAA,MAAAA;;;;;AAqBYM,cAtB9BF,iBAsB8BE,CAAAA,iBAtBKL,eAsBLK,GAtBuBL,eAsBvBK,CAAAA,SAtBgDT,WAAAA,CAsBhDS;EAOKD,UAAAA,EAAAA,MAAAA,GA5B/BN,WA4B+BM,GA5BjBL,cA4BiBK,CA5BFA,QA4BEA,CAAAA;EAATV,QAAAA,EAAAA;EAAuBW,iBAAAA,KAAAA;EAO0CD,iBAAAA,MAAAA;EAATV;;;;EAoB/CM,gBAAAA,CAAAA,CAAAA,EAAAA,MAAAA;EAA6CI;;;;;;EAAyFC,WAAAA,CAAAA,UAAAA,EAxClKV,mBAwCkKU,EAAAA,OAAAA,EAxCpIH,qBAwCoIG;EASpJL;;;;;EAAyGE,YAAAA,CAAAA,SAAAA,EA3CvHR,QA2CuHQ,CA3C9GE,QA2C8GF,CAAAA,EAAAA,CAAAA,EA3ChGG,OA2CgGH,CAAAA,MAAAA,EAAAA,CAAAA;EAAkDE;;;;AAjEvF;;6CA6B/DV,SAASU,cAAcC;;;;;;;4FAOwBA,SAASX,SAASU;;;;;;;;;;MAUxGC;;;;;;;;;;oCAU8BL,kBAAkBA,6CAA6CI,aAAaA,sBAAsBT,8BAA8BO,wBAAwBG,QAAQF,kBAAkBC;;;;;;;;;wCAS9KJ,kBAAkBA,uBAAuBN,SAASU,yBAAyBT,8BAA8BO,wBAAwBG,QAAQF,kBAAkBC"}