{"version":3,"file":"chroma.d.ts","names":["ChromaClient","ChromaClientT","ChromaClientArgs","Collection","CollectionConfiguration","CollectionMetadata","Where","EmbeddingsInterface","VectorStore","Document","SharedChromaLibArgs","Omit","ChromaLibArgs","ChromaDeleteParams","T","Chroma","Promise","Record"],"sources":["../../src/vectorstores/chroma.d.ts"],"sourcesContent":["import type { ChromaClient as ChromaClientT, ChromaClientArgs, Collection, CollectionConfiguration, CollectionMetadata, Where } from \"chromadb\";\nimport type { EmbeddingsInterface } from \"@langchain/core/embeddings\";\nimport { VectorStore } from \"@langchain/core/vectorstores\";\nimport { Document } from \"@langchain/core/documents\";\ntype SharedChromaLibArgs = {\n    numDimensions?: number;\n    collectionName?: string;\n    filter?: object;\n    collectionMetadata?: CollectionMetadata;\n    collectionConfiguration?: CollectionConfiguration;\n    chromaCloudAPIKey?: string;\n    clientParams?: Omit<ChromaClientArgs, \"path\">;\n};\n/**\n * Defines the arguments that can be passed to the `Chroma` class\n * constructor. It can either contain a `url` for the Chroma database, the\n * number of dimensions for the vectors (`numDimensions`), a\n * `collectionName` for the collection to be used in the database, and a\n * `filter` object; or it can contain an `index` which is an instance of\n * `ChromaClientT`, along with the `numDimensions`, `collectionName`, and\n * `filter`.\n */\nexport type ChromaLibArgs = ({\n    url?: string;\n} & SharedChromaLibArgs) | ({\n    index?: ChromaClientT;\n} & SharedChromaLibArgs);\n/**\n * Defines the parameters for the `delete` method in the `Chroma` class.\n * It can either contain an array of `ids` of the documents to be deleted\n * or a `filter` object to specify the documents to be deleted.\n */\nexport interface ChromaDeleteParams<T> {\n    ids?: string[];\n    filter?: T;\n}\n/**\n * Chroma vector store integration.\n *\n * Setup:\n * Install `@langchain/community` and `chromadb`.\n *\n * ```bash\n * npm install @langchain/community chromadb\n * ```\n *\n * ## [Constructor args](https://api.js.langchain.com/classes/langchain_community_vectorstores_chroma.Chroma.html#constructor)\n *\n * <details open>\n * <summary><strong>Instantiate</strong></summary>\n *\n * ```typescript\n * import { Chroma } from '@langchain/community/vectorstores/chroma';\n * // Or other embeddings\n * import { OpenAIEmbeddings } from '@langchain/openai';\n *\n * const embeddings = new OpenAIEmbeddings({\n *   model: \"text-embedding-3-small\",\n * })\n *\n * const vectorStore = new Chroma(\n *   embeddings,\n *   {\n *     collectionName: \"foo\",\n *     host: \"localhost\",\n *   }\n * );\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Add documents</strong></summary>\n *\n * ```typescript\n * import type { Document } from '@langchain/core/documents';\n *\n * const document1 = { pageContent: \"foo\", metadata: { baz: \"bar\" } };\n * const document2 = { pageContent: \"thud\", metadata: { bar: \"baz\" } };\n * const document3 = { pageContent: \"I will be deleted :(\", metadata: {} };\n *\n * const documents: Document[] = [document1, document2, document3];\n * const ids = [\"1\", \"2\", \"3\"];\n * await vectorStore.addDocuments(documents, { ids });\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Delete documents</strong></summary>\n *\n * ```typescript\n * await vectorStore.delete({ ids: [\"3\"] });\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>Similarity search</strong></summary>\n *\n * ```typescript\n * const results = await vectorStore.similaritySearch(\"thud\", 1);\n * for (const doc of results) {\n *   console.log(`* ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);\n * }\n * // Output: * thud [{\"baz\":\"bar\"}]\n * ```\n * </details>\n *\n * <br />\n *\n *\n * <details>\n * <summary><strong>Similarity search with filter</strong></summary>\n *\n * ```typescript\n * const resultsWithFilter = await vectorStore.similaritySearch(\"thud\", 1, { baz: \"bar\" });\n *\n * for (const doc of resultsWithFilter) {\n *   console.log(`* ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);\n * }\n * // Output: * foo [{\"baz\":\"bar\"}]\n * ```\n * </details>\n *\n * <br />\n *\n *\n * <details>\n * <summary><strong>Similarity search with score</strong></summary>\n *\n * ```typescript\n * const resultsWithScore = await vectorStore.similaritySearchWithScore(\"qux\", 1);\n * for (const [doc, score] of resultsWithScore) {\n *   console.log(`* [SIM=${score.toFixed(6)}] ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);\n * }\n * // Output: * [SIM=0.000000] qux [{\"bar\":\"baz\",\"baz\":\"bar\"}]\n * ```\n * </details>\n *\n * <br />\n *\n * <details>\n * <summary><strong>As a retriever</strong></summary>\n *\n * ```typescript\n * const retriever = vectorStore.asRetriever({\n *   searchType: \"mmr\", // Leave blank for standard similarity search\n *   k: 1,\n * });\n * const resultAsRetriever = await retriever.invoke(\"thud\");\n * console.log(resultAsRetriever);\n *\n * // Output: [Document({ metadata: { \"baz\":\"bar\" }, pageContent: \"thud\" })]\n * ```\n * </details>\n *\n * <br />\n */\nexport declare class Chroma extends VectorStore {\n    FilterType: Where;\n    index?: ChromaClientT;\n    collection?: Collection;\n    collectionName: string;\n    collectionMetadata?: CollectionMetadata;\n    numDimensions?: number;\n    clientParams?: Omit<ChromaClientArgs, \"path\">;\n    url: string;\n    filter?: object;\n    _vectorstoreType(): string;\n    constructor(embeddings: EmbeddingsInterface, args: ChromaLibArgs);\n    /**\n     * Adds documents to the Chroma database. The documents are first\n     * converted to vectors using the `embeddings` instance, and then added to\n     * the database.\n     * @param documents An array of `Document` instances to be added to the database.\n     * @param options Optional. An object containing an array of `ids` for the documents.\n     * @returns A promise that resolves when the documents have been added to the database.\n     */\n    addDocuments(documents: Document[], options?: {\n        ids?: string[];\n    }): Promise<string[]>;\n    /**\n     * Ensures that a collection exists in the Chroma database. If the\n     * collection does not exist, it is created.\n     * @returns A promise that resolves with the `Collection` instance.\n     */\n    ensureCollection(): Promise<Collection>;\n    /**\n     * Adds vectors to the Chroma 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     * @param options Optional. An object containing an array of `ids` for the vectors.\n     * @returns A promise that resolves with an array of document IDs when the vectors have been added to the database.\n     */\n    addVectors(vectors: number[][], documents: Document[], options?: {\n        ids?: string[];\n    }): Promise<string[]>;\n    /**\n     * Deletes documents from the Chroma database. The documents to be deleted\n     * can be specified by providing an array of `ids` or a `filter` object.\n     * @param params An object containing either an array of `ids` of the documents to be deleted or a `filter` object to specify the documents to be deleted.\n     * @returns A promise that resolves when the specified documents have been deleted from the database.\n     */\n    delete(params: ChromaDeleteParams<this[\"FilterType\"]>): Promise<void>;\n    /**\n     * Searches for vectors in the Chroma database that are similar to the\n     * provided query vector. The search can be filtered using the provided\n     * `filter` object or the `filter` property of the `Chroma` instance.\n     * @param query The query vector.\n     * @param k The number of similar vectors to return.\n     * @param filter Optional. A `filter` object to filter the search results.\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, filter?: this[\"FilterType\"]): Promise<[Document<Record<string, any>>, number][]>;\n    /**\n     * Creates a new `Chroma` instance from an array of text strings. The text\n     * strings are converted to `Document` instances and added to the Chroma\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 dbConfig A `ChromaLibArgs` object containing the configuration for the Chroma database.\n     * @returns A promise that resolves with a new `Chroma` instance.\n     */\n    static fromTexts(texts: string[], metadatas: object[] | object, embeddings: EmbeddingsInterface, dbConfig: ChromaLibArgs): Promise<Chroma>;\n    /**\n     * Creates a new `Chroma` instance from an array of `Document` instances.\n     * The documents are added to the Chroma database.\n     * @param docs An array of `Document` instances.\n     * @param embeddings An `Embeddings` instance used to generate embeddings for the documents.\n     * @param dbConfig A `ChromaLibArgs` object containing the configuration for the Chroma database.\n     * @returns A promise that resolves with a new `Chroma` instance.\n     */\n    static fromDocuments(docs: Document[], embeddings: EmbeddingsInterface, dbConfig: ChromaLibArgs): Promise<Chroma>;\n    /**\n     * Creates a new `Chroma` instance from an existing collection in the\n     * Chroma database.\n     * @param embeddings An `Embeddings` instance used to generate embeddings for the documents.\n     * @param dbConfig A `ChromaLibArgs` object containing the configuration for the Chroma database.\n     * @returns A promise that resolves with a new `Chroma` instance.\n     */\n    static fromExistingCollection(embeddings: EmbeddingsInterface, dbConfig: ChromaLibArgs): Promise<Chroma>;\n    /** @ignore */\n    static imports(): Promise<{\n        ChromaClient: typeof ChromaClientT;\n    }>;\n}\nexport {};\n//# sourceMappingURL=chroma.d.ts.map"],"mappings":";;;;;;KAIKU,mBAAAA;;EAAAA,cAAAA,CAAAA,EAAAA,MAAmB;EAICL,MAAAA,CAAAA,EAAAA,MAAAA;EACKD,kBAAAA,CAAAA,EADLC,kBACKD;EAENF,uBAAAA,CAAAA,EAFME,uBAENF;EAALS,iBAAAA,CAAAA,EAAAA,MAAAA;EAAI,YAAA,CAAA,EAAJA,IAAI,CAACT,gBAAD,EAAA,MAAA,CAAA;AAWvB,CAAA;;;;AAIuB;AAMvB;AAkIA;;;;AAKyBG,KAjJbO,aAAAA,GAiJaP,CAAAA;EAEDH,GAAAA,CAAAA,EAAAA,MAAAA;CAALS,GAjJfD,mBAiJeC,CAAAA,GAAAA,CAAAA;EAISJ,KAAAA,CAAAA,EApJhBN,YAoJgBM;CAA2BK,GAnJnDF,mBAmJmDE,CAAAA;;;;;;AA4B/CI,UAzKSH,kBAyKTG,CAAAA,CAAAA,CAAAA,CAAAA;EAOWH,GAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAAyCG,MAAAA,CAAAA,EA9K/CF,CA8K+CE;;;;;;;;;;;;;;;;;;;;AA9Cb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA1BD,MAAAA,SAAeP,WAAAA;cACpBF;UACJL;eACKE;;uBAEQE;;iBAENM,KAAKT;;;;0BAIIK,2BAA2BK;;;;;;;;;0BAS3BH;;MAEpBO;;;;;;sBAMgBA,QAAQb;;;;;;;;;6CASeM;;MAEvCO;;;;;;;iBAOWH,yCAAyCG;;;;;;;;;;4FAUkCA,SAASP,SAASQ;;;;;;;;;;;8EAWhCV,+BAA+BK,gBAAgBI,QAAQD;;;;;;;;;6BASxGN,wBAAwBF,+BAA+BK,gBAAgBI,QAAQD;;;;;;;;4CAQhER,+BAA+BK,gBAAgBI,QAAQD;;oBAE/EC;yBACOf"}