@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 7.83 kB
Source Map (JSON)
{"version":3,"file":"upstash.d.ts","names":["EmbeddingsInterface","VectorStore","Index","UpstashIndex","QueryResult","DocumentInterface","AsyncCaller","AsyncCallerParams","UpstashVectorLibArgs","UpstashMetadata","Record","UpstashQueryMetadata","UpstashDeleteParams","UpstashVectorStore","Promise"],"sources":["../../src/vectorstores/upstash.d.ts"],"sourcesContent":["import { EmbeddingsInterface } from \"@langchain/core/embeddings\";\nimport { VectorStore } from \"@langchain/core/vectorstores\";\nimport { Index as UpstashIndex, type QueryResult } from \"@upstash/vector\";\nimport { DocumentInterface } from \"@langchain/core/documents\";\nimport { AsyncCaller, AsyncCallerParams } from \"@langchain/core/utils/async_caller\";\n/**\n * This interface defines the arguments for the UpstashVectorStore class.\n */\nexport interface UpstashVectorLibArgs extends AsyncCallerParams {\n index: UpstashIndex;\n filter?: string;\n namespace?: string;\n}\nexport type UpstashMetadata = Record<string, any>;\nexport type UpstashQueryMetadata = UpstashMetadata & {\n _pageContentLC: any;\n};\n/**\n * Type that defines the parameters for the delete method.\n * It can either contain the target id(s) or the deleteAll config to reset all the vectors.\n */\nexport type UpstashDeleteParams = {\n ids: string | string[];\n deleteAll?: never;\n} | {\n deleteAll: boolean;\n ids?: never;\n};\n/**\n * The main class that extends the 'VectorStore' class. It provides\n * methods for interacting with Upstash index, such as adding documents,\n * deleting documents, performing similarity search and more.\n */\nexport declare class UpstashVectorStore extends VectorStore {\n FilterType: string;\n index: UpstashIndex;\n caller: AsyncCaller;\n useUpstashEmbeddings?: boolean;\n filter?: this[\"FilterType\"];\n namespace?: string;\n _vectorstoreType(): string;\n constructor(embeddings: EmbeddingsInterface, args: UpstashVectorLibArgs);\n /**\n * This method adds documents to Upstash database. Documents are first converted to vectors\n * using the provided embeddings instance, and then upserted to the database.\n * @param documents Array of Document objects to be added to the database.\n * @param options Optional object containing array of ids for the documents.\n * @returns Promise that resolves with the ids of the provided documents when the upsert operation is done.\n */\n addDocuments(documents: DocumentInterface[], options?: {\n ids?: string[];\n useUpstashEmbeddings?: boolean;\n }): Promise<string[]>;\n /**\n * This method adds the provided vectors to Upstash database.\n * @param vectors Array of vectors to be added to the Upstash database.\n * @param documents Array of Document objects, each associated with a vector.\n * @param options Optional object containing the array of ids foor the vectors.\n * @returns Promise that resolves with the ids of the provided documents when the upsert operation is done.\n */\n addVectors(vectors: number[][], documents: DocumentInterface[], options?: {\n ids?: string[];\n }): Promise<string[]>;\n /**\n * This method adds the provided documents to Upstash database. The pageContent of the documents will be embedded by Upstash Embeddings.\n * @param documents Array of Document objects to be added to the Upstash database.\n * @param options Optional object containing the array of ids for the documents.\n * @returns Promise that resolves with the ids of the provided documents when the upsert operation is done.\n */\n protected _addData(documents: DocumentInterface[], options?: {\n ids?: string[];\n }): Promise<string[]>;\n /**\n * This method deletes documents from the Upstash database. You can either\n * provide the target ids, or delete all vectors in the database.\n * @param params Object containing either array of ids of the documents or boolean deleteAll.\n * @returns Promise that resolves when the specified documents have been deleted from the database.\n */\n delete(params: UpstashDeleteParams): Promise<void>;\n protected _runUpstashQuery(query: number[] | string, k: number, filter?: this[\"FilterType\"], options?: {\n includeVectors: boolean;\n }): Promise<QueryResult<UpstashQueryMetadata>[]>;\n /**\n * This method performs a similarity search in the Upstash database\n * over the existing vectors.\n * @param query Query vector for the similarity search.\n * @param k The number of similar vectors to return as result.\n * @returns Promise that resolves with an array of tuples, each containing\n * Document object and similarity score. The length of the result will be\n * maximum of 'k' and vectors in the index.\n */\n similaritySearchVectorWithScore(query: number[] | string, k: number, filter?: this[\"FilterType\"]): Promise<[DocumentInterface, number][]>;\n /**\n * This method creates a new UpstashVector instance from an array of texts.\n * The texts are initially converted to Document instances and added to Upstash\n * database.\n * @param texts The texts to create the documents from.\n * @param metadatas The metadata values associated with the texts.\n * @param embeddings Embedding interface of choice, to create the text embeddings.\n * @param dbConfig Object containing the Upstash database configs.\n * @returns Promise that resolves with a new UpstashVector instance.\n */\n static fromTexts(texts: string[], metadatas: UpstashMetadata | UpstashMetadata[], embeddings: EmbeddingsInterface, dbConfig: UpstashVectorLibArgs): Promise<UpstashVectorStore>;\n /**\n * This method creates a new UpstashVector instance from an array of Document instances.\n * @param docs The docs to be added to Upstash database.\n * @param embeddings Embedding interface of choice, to create the embeddings.\n * @param dbConfig Object containing the Upstash database configs.\n * @returns Promise that resolves with a new UpstashVector instance\n */\n static fromDocuments(docs: DocumentInterface[], embeddings: EmbeddingsInterface, dbConfig: UpstashVectorLibArgs): Promise<UpstashVectorStore>;\n /**\n * This method creates a new UpstashVector instance from an existing index.\n * @param embeddings Embedding interface of the choice, to create the embeddings.\n * @param dbConfig Object containing the Upstash database configs.\n * @returns\n */\n static fromExistingIndex(embeddings: EmbeddingsInterface, dbConfig: UpstashVectorLibArgs): Promise<UpstashVectorStore>;\n}\n//# sourceMappingURL=upstash.d.ts.map"],"mappings":";;;;;;;;;;AAQA;AAKYS,UALKD,oBAAAA,SAA6BD,iBAKV,CAAA;EACxBI,KAAAA,EALDR,KAKCQ;EAOAC,MAAAA,CAAAA,EAAAA,MAAAA;EAYSC,SAAAA,CAAAA,EAAAA,MAAAA;;AAGTP,KAvBAG,eAAAA,GAAkBC,MAuBlBJ,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA;AAKgBN,KA3BhBW,oBAAAA,GAAuBF,eA2BPT,GAAAA;EAA2BQ,cAAAA,EAAAA,GAAAA;CAQ3BH;;;;;AAsBpBS,KAlDIF,mBAAAA,GAkDJE;EAOWF,GAAAA,EAAAA,MAAAA,GAAAA,MAAAA,EAAAA;EAAsBE,SAAAA,CAAAA,EAAAA,KAAAA;CAGbH,GAAAA;EAAZP,SAAAA,EAAAA,OAAAA;EAARU,GAAAA,CAAAA,EAAAA,KAAAA;CAUwGT;;;;;;AAWgDQ,cArE3IA,kBAAAA,SAA2BZ,WAAAA,CAqEgHY;EAARC,UAAAA,EAAAA,MAAAA;EAQzHT,KAAAA,EA3EpBF,KA2EoBE;EAAiC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