UNPKG

@langchain/community

Version:
1 lines • 9.08 kB
{"version":3,"file":"rockset.d.cts","names":["MainApi","CreateCollectionRequest","EmbeddingsInterface","VectorStore","Document","RocksetStoreError","Error","RocksetStoreDestroyedError","SimilarityMetric","RocksetLibArgs","RocksetStore","Promise"],"sources":["../../src/vectorstores/rockset.d.ts"],"sourcesContent":["import { MainApi } from \"@rockset/client\";\nimport type { CreateCollectionRequest } from \"@rockset/client/dist/codegen/api.js\";\nimport type { EmbeddingsInterface } from \"@langchain/core/embeddings\";\nimport { VectorStore } from \"@langchain/core/vectorstores\";\nimport { Document } from \"@langchain/core/documents\";\n/**\n * Generic Rockset vector storage error\n */\nexport declare class RocksetStoreError extends Error {\n /**\n * Constructs a RocksetStoreError\n * @param message The error message\n */\n constructor(message: string);\n}\n/**\n * Error that is thrown when a RocksetStore function is called\n * after `destroy()` is called (meaning the collection would be\n * deleted).\n */\nexport declare class RocksetStoreDestroyedError extends RocksetStoreError {\n constructor();\n}\n/**\n * Functions to measure vector distance/similarity by.\n * See https://rockset.com/docs/vector-functions/#vector-distance-functions\n * @enum SimilarityMetric\n */\nexport declare const SimilarityMetric: {\n readonly CosineSimilarity: \"COSINE_SIM\";\n readonly EuclideanDistance: \"EUCLIDEAN_DIST\";\n readonly DotProduct: \"DOT_PRODUCT\";\n};\nexport type SimilarityMetric = (typeof SimilarityMetric)[keyof typeof SimilarityMetric];\n/**\n * Vector store arguments\n * @interface RocksetStore\n */\nexport interface RocksetLibArgs {\n /**\n * The rockset client object constructed with `rocksetConfigure`\n * @type {MainAPI}\n */\n client: MainApi;\n /**\n * The name of the Rockset collection to store vectors\n * @type {string}\n */\n collectionName: string;\n /**\n * The name of othe Rockset workspace that holds @member collectionName\n * @type {string}\n */\n workspaceName?: string;\n /**\n * The name of the collection column to contain page contnent of documents\n * @type {string}\n */\n textKey?: string;\n /**\n * The name of the collection column to contain vectors\n * @type {string}\n */\n embeddingKey?: string;\n /**\n * The SQL `WHERE` clause to filter by\n * @type {string}\n */\n filter?: string;\n /**\n * The metric used to measure vector relationship\n * @type {SimilarityMetric}\n */\n similarityMetric?: SimilarityMetric;\n}\n/**\n * Exposes Rockset's vector store/search functionality\n */\nexport declare class RocksetStore extends VectorStore {\n FilterType: string;\n client: MainApi;\n collectionName: string;\n workspaceName: string;\n textKey: string;\n embeddingKey: string;\n filter?: string;\n private _similarityMetric;\n private similarityOrder;\n private destroyed;\n /**\n * Gets a string representation of the type of this VectorStore\n * @returns {\"rockset\"}\n */\n _vectorstoreType(): \"rockset\";\n /**\n * Constructs a new RocksetStore\n * @param {Embeddings} embeddings Object used to embed queries and\n * page content\n * @param {RocksetLibArgs} args\n */\n constructor(embeddings: EmbeddingsInterface, args: RocksetLibArgs);\n /**\n * Sets the object's similarity order based on what\n * SimilarityMetric is being used\n */\n private setSimilarityOrder;\n /**\n * Embeds and adds Documents to the store.\n * @param {Documents[]} documents The documents to store\n * @returns {Promise<string[]?>} The _id's of the documents added\n */\n addDocuments(documents: Document[]): Promise<string[] | undefined>;\n /**\n * Adds vectors to the store given their corresponding Documents\n * @param {number[][]} vectors The vectors to store\n * @param {Document[]} documents The Documents they represent\n * @return {Promise<string[]?>} The _id's of the added documents\n */\n addVectors(vectors: number[][], documents: Document[]): Promise<string[] | undefined>;\n /**\n * Deletes Rockset documements given their _id's\n * @param {string[]} ids The IDS to remove documents with\n */\n delete(ids: string[]): Promise<void>;\n /**\n * Gets the most relevant documents to a query along\n * with their similarity score. The returned documents\n * are ordered by similarity (most similar at the first\n * index)\n * @param {number[]} query The embedded query to search\n * the store by\n * @param {number} k The number of documents to retreive\n * @param {string?} filter The SQL `WHERE` clause to filter by\n */\n similaritySearchVectorWithScore(query: number[], k: number, filter?: string): Promise<[Document, number][]>;\n /**\n * Constructs and returns a RocksetStore object given texts to store.\n * @param {string[]} texts The texts to store\n * @param {object[] | object} metadatas The metadatas that correspond\n * to @param texts\n * @param {Embeddings} embeddings The object used to embed queries\n * and page content\n * @param {RocksetLibArgs} dbConfig The options to be passed into the\n * RocksetStore constructor\n * @returns {RocksetStore}\n */\n static fromTexts(texts: string[], metadatas: object[] | object, embeddings: EmbeddingsInterface, dbConfig: RocksetLibArgs): Promise<RocksetStore>;\n /**\n * Constructs, adds docs to, and returns a RocksetStore object\n * @param {Document[]} docs The Documents to store\n * @param {Embeddings} embeddings The object used to embed queries\n * and page content\n * @param {RocksetLibArgs} dbConfig The options to be passed into the\n * RocksetStore constructor\n * @returns {RocksetStore}\n */\n static fromDocuments(docs: Document[], embeddings: EmbeddingsInterface, dbConfig: RocksetLibArgs): Promise<RocksetStore>;\n private static collectionExists;\n private static collectionReady;\n /**\n * Deletes the collection this RocksetStore uses\n * @param {boolean?} waitUntilDeletion Whether to sleep until the\n * collection is ready to be\n * queried\n */\n destroy(waitUntilDeletion?: boolean): Promise<void>;\n /**\n * Checks if this RocksetStore has been destroyed.\n * @throws {RocksetStoreDestroyederror} if it has.\n */\n private checkIfDestroyed;\n /**\n * Creates a new Rockset collection and returns a RocksetStore that\n * uses it\n * @param {Embeddings} embeddings Object used to embed queries and\n * page content\n * @param {RocksetLibArgs} dbConfig The options to be passed into the\n * RocksetStore constructor\n * @param {CreateCollectionRequest?} collectionOptions The arguments to sent with the\n * HTTP request when creating the\n * collection. Setting a field mapping\n * that `VECTOR_ENFORCE`s is recommended\n * when using this function. See\n * https://rockset.com/docs/vector-functions/#vector_enforce\n * @returns {RocsketStore}\n */\n static withNewCollection(embeddings: EmbeddingsInterface, dbConfig: RocksetLibArgs, collectionOptions?: CreateCollectionRequest): Promise<RocksetStore>;\n get similarityMetric(): SimilarityMetric;\n set similarityMetric(metric: SimilarityMetric);\n}\n//# sourceMappingURL=rockset.d.ts.map"],"mappings":";;;;;;;;;;AAQA;AAYqBO,cAZAF,iBAAAA,SAA0BC,KAAK,CAYID;EAQnCG;AAKrB;AAKA;AAwCA;EAEYR,WAAAA,CAAAA,OAAAA,EAAAA,MAAAA;;;;;;;AA2CeW,cAvGNJ,0BAAAA,SAAmCF,iBAAiB,CAuG9CM;EAWgEP,WAAAA,CAAAA;;;;;;;AAsBpCF,cAhIlCM,gBAgIkCN,EAAAA;EAA+BO,SAAAA,gBAAAA,EAAAA,YAAAA;EAAyBC,SAAAA,iBAAAA,EAAAA,gBAAAA;EAARC,SAAAA,UAAAA,EAAAA,aAAAA;CAS7DA;AAqBDT,KAzJ7BM,gBAAAA,GAyJ6BN,CAAAA,OAzJFM,gBAyJEN,CAAAA,CAAAA,MAAAA,OAzJ6BM,gBAyJ7BN,CAAAA;;;;;AACbM,UArJXC,cAAAA,CAqJWD;EACKA;;AA9GoB;;UAnCzCR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA8BWQ;;;;;cAKFE,YAAAA,SAAqBP,WAAAA;;UAE9BH;;;;;;;;;;;;;;;;;;;;0BAoBgBE,2BAA2BO;;;;;;;;;;;0BAW3BL,aAAaO;;;;;;;6CAOMP,aAAaO;;;;;yBAKjCA;;;;;;;;;;;gFAWuDA,SAASP;;;;;;;;;;;;8EAYXF,+BAA+BO,iBAAiBE,QAAQD;;;;;;;;;;6BAUzGN,wBAAwBF,+BAA+BO,iBAAiBE,QAAQD;;;;;;;;;wCASrEC;;;;;;;;;;;;;;;;;;;;;uCAqBDT,+BAA+BO,oCAAoCR,0BAA0BU,QAAQD;0BAClHF;+BACKA"}