chromadb 3.4.2 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,8 +55,21 @@ type FloatListValueType$1 = {
55
55
  type FloatValueType$1 = {
56
56
  float_inverted_index?: null | FloatInvertedIndexType$1;
57
57
  };
58
+ /**
59
+ * Full-text search index algorithm.
60
+ *
61
+ * Controls which index format and query pipeline are used for
62
+ * document substring search within a collection.
63
+ */
64
+ type FtsAlgorithm = 'trigram' | 'token_bitmap';
58
65
  type FtsIndexConfig$1 = {
59
- [key: string]: never;
66
+ /**
67
+ * FTS index algorithm.
68
+ * Omitted from JSON when set to the default (Trigram) so that old
69
+ * servers/clients that do not know about this field can still
70
+ * deserialize the schema.
71
+ */
72
+ algorithm?: FtsAlgorithm;
60
73
  };
61
74
  type FtsIndexType$1 = {
62
75
  config: FtsIndexConfig$1;
@@ -209,10 +222,6 @@ type Schema$1 = {
209
222
  keys: {
210
223
  [key: string]: ValueTypes$1;
211
224
  };
212
- /**
213
- * ID of the attached function that created this output collection (if applicable)
214
- */
215
- source_attached_function_id?: string | null;
216
225
  };
217
226
  type SearchPayload = {
218
227
  filter?: {
@@ -284,6 +293,13 @@ type SpannIndexConfig = {
284
293
  write_rng_epsilon?: number | null;
285
294
  write_rng_factor?: number | null;
286
295
  };
296
+ /**
297
+ * Sparse vector index algorithm.
298
+ *
299
+ * Controls which posting list format and query engine are used for
300
+ * sparse vector search within a collection.
301
+ */
302
+ type SparseIndexAlgorithm = 'wand' | 'max_score';
287
303
  /**
288
304
  * Represents a sparse vector using parallel arrays for indices and values.
289
305
  *
@@ -307,6 +323,13 @@ type SparseVector = {
307
323
  values: Array<number>;
308
324
  };
309
325
  type SparseVectorIndexConfig$1 = {
326
+ /**
327
+ * Sparse index algorithm (cloud-only, tenant-gated).
328
+ * Omitted from JSON when set to the default (Wand) so that old
329
+ * servers/clients that do not know about this field can still
330
+ * deserialize the schema.
331
+ */
332
+ algorithm?: SparseIndexAlgorithm;
310
333
  /**
311
334
  * Whether this embedding is BM25
312
335
  */
@@ -396,10 +419,13 @@ type UserIdentity = GetUserIdentityResponse;
396
419
  * All committed writes will be visible. This is the default.
397
420
  * - INDEX_ONLY: Read only from the compacted index, skipping the WAL.
398
421
  * Recent writes that haven't been compacted may not be visible, but queries are faster.
422
+ * - INDEX_AND_BOUNDED_WAL: Read from the index and up to a server-configured number of
423
+ * WAL entries for bounded query latency.
399
424
  */
400
425
  declare const ReadLevel: {
401
426
  readonly INDEX_AND_WAL: "index_and_wal";
402
427
  readonly INDEX_ONLY: "index_only";
428
+ readonly INDEX_AND_BOUNDED_WAL: "index_and_bounded_wal";
403
429
  };
404
430
  type ReadLevel = (typeof ReadLevel)[keyof typeof ReadLevel];
405
431
 
@@ -1290,7 +1316,6 @@ declare class Schema {
1290
1316
  private setIndexForKey;
1291
1317
  private enableAllIndexesForKey;
1292
1318
  private disableAllIndexesForKey;
1293
- private validateSingleSparseVectorIndex;
1294
1319
  private validateSparseVectorConfig;
1295
1320
  private initializeDefaults;
1296
1321
  private initializeKeys;
@@ -1492,6 +1517,13 @@ declare class ChromaClient {
1492
1517
  * @throws Error if the collection does not exist
1493
1518
  */
1494
1519
  getCollectionByCrn(crn: string): Promise<Collection>;
1520
+ /**
1521
+ * Retrieves an existing collection by its ID.
1522
+ * @param id - The UUID of the collection to retrieve
1523
+ * @returns Promise resolving to the Collection instance
1524
+ * @throws Error if the collection does not exist
1525
+ */
1526
+ getCollectionById(id: string): Promise<Collection>;
1495
1527
  /**
1496
1528
  * Retrieves multiple collections by name.
1497
1529
  * @param items - Array of collection names or objects with name and optional embedding function (should match the ones used to create the collections)
@@ -1594,6 +1626,7 @@ interface Collection {
1594
1626
  * Controls whether to read from the write-ahead log.
1595
1627
  * - ReadLevel.INDEX_AND_WAL: Read from both index and WAL (default)
1596
1628
  * - ReadLevel.INDEX_ONLY: Read only from index, faster but recent writes may not be visible
1629
+ * - ReadLevel.INDEX_AND_BOUNDED_WAL: Read up to a server-configured number of WAL entries
1597
1630
  */
1598
1631
  readLevel?: ReadLevel;
1599
1632
  }): Promise<number>;
@@ -1747,6 +1780,7 @@ interface Collection {
1747
1780
  * Controls whether to read from the write-ahead log.
1748
1781
  * - ReadLevel.INDEX_AND_WAL: Read from both index and WAL (default)
1749
1782
  * - ReadLevel.INDEX_ONLY: Read only from index, faster but recent writes may not be visible
1783
+ * - ReadLevel.INDEX_AND_BOUNDED_WAL: Read up to a server-configured number of WAL entries
1750
1784
  */
1751
1785
  readLevel?: ReadLevel;
1752
1786
  }): Promise<SearchResult>;
package/dist/cjs/cli.cjs CHANGED
@@ -104,6 +104,9 @@ var main = async () => {
104
104
  await update();
105
105
  return;
106
106
  }
107
+ process.on("SIGINT", () => {
108
+ process.exit(0);
109
+ });
107
110
  bindings_default.cli(["chroma", ...args]);
108
111
  };
109
112
  main().finally();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli.ts","../../src/bindings.ts"],"sourcesContent":["#!/usr/bin/env node\nimport semver from \"semver\";\nimport binding from \"./bindings\";\n\ninterface NpmPackageData {\n \"dist-tags\": {\n latest: string;\n [tag: string]: string;\n };\n}\n\nconst getLatestVersion = async (packageName: string): Promise<string> => {\n const response = await fetch(`https://registry.npmjs.org/${packageName}`);\n if (!response.ok) {\n throw new Error(`Failed to fetch package data: ${response.statusText}`);\n }\n const data: NpmPackageData = await response.json();\n return data[\"dist-tags\"].latest;\n};\n\nconst update = async (): Promise<void> => {\n try {\n const installedVersion = process.env.CHROMADB_VERSION || \"0.0.0\";\n const latestVersion = await getLatestVersion(\"chromadb\");\n\n if (semver.lt(installedVersion, latestVersion)) {\n console.log(`\\nA new chromadb version (${latestVersion}) is available!`);\n console.log(\"\\n\\x1b[4mUpdat with npm\\x1b[0m\");\n console.log(\"npm install chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with pnpm\\x1b[0m\");\n console.log(\"pnpm add chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with yarn\\x1b[0m\");\n console.log(\"yarn add chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with bun\\x1b[0m\");\n console.log(\"bun add chromadb@latest\\n\");\n } else {\n console.log(\n `\\nYour chromadb version (${latestVersion}) is up-to-date!\\n`,\n );\n }\n } catch (error) {\n console.error(\"Error checking versions:\", error);\n }\n};\n\nconst main = async () => {\n const args: string[] = process.argv.slice(2);\n if (args.length > 0 && args[0] === \"update\") {\n await update();\n return;\n }\n\n binding.cli([\"chroma\", ...args]);\n};\n\nmain().finally();\n","import { createRequire } from \"module\";\nimport os from \"os\";\n\nconst require = createRequire(import.meta.url);\nconst platform = os.platform();\nconst arch = os.arch();\n\nlet binding: any;\n\nif (platform === \"darwin\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-darwin-arm64\");\n } else if (arch === \"x64\") {\n binding = require(\"chromadb-js-bindings-darwin-x64\");\n } else {\n throw new Error(`Unsupported architecture on macOS: ${arch}`);\n }\n} else if (platform === \"linux\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-linux-arm64-gnu\");\n } else if (arch === \"x64\") {\n binding = require(\"chromadb-js-bindings-linux-x64-gnu\");\n } else {\n throw new Error(`Unsupported architecture on Linux: ${arch}`);\n }\n} else if (platform === \"win32\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-win32-arm64-msvc\");\n } else {\n throw new Error(\n `Unsupported Windows architecture: ${arch}. Only ARM64 is supported.`,\n );\n }\n} else {\n throw new Error(`Unsupported platform: ${platform}`);\n}\n\nexport default binding;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oBAAmB;;;ACDnB,oBAA8B;AAC9B,gBAAe;AADf;AAGA,IAAMA,eAAU,6BAAc,YAAY,GAAG;AAC7C,IAAM,WAAW,UAAAC,QAAG,SAAS;AAC7B,IAAM,OAAO,UAAAA,QAAG,KAAK;AAErB,IAAI;AAEJ,IAAI,aAAa,UAAU;AACz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AEtC,cAAQ,IAAI,iCAAiC;AAC7C,cAAQ,IAAI,0BAA0B;AAEtC,cAAQ,IAAI,gCAAgC;AAC5C,cAAQ,IAAI,2BAA2B;AAAA,IACzC,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,yBAA4B,aAAa;AAAA;AAAA,MAC3C;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,4BAA4B,KAAK;AAAA,EACjD;AACF;AAEA,IAAM,OAAO,YAAY;AACvB,QAAM,OAAiB,QAAQ,KAAK,MAAM,CAAC;AAC3C,MAAI,KAAK,SAAS,KAAK,KAAK,CAAC,MAAM,UAAU;AAC3C,UAAM,OAAO;AACb;AAAA,EACF;AAEA,mBAAQ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AACjC;AAEA,KAAK,EAAE,QAAQ;","names":["require","os","semver"]}
1
+ {"version":3,"sources":["../../src/cli.ts","../../src/bindings.ts"],"sourcesContent":["#!/usr/bin/env node\nimport semver from \"semver\";\nimport binding from \"./bindings\";\n\ninterface NpmPackageData {\n \"dist-tags\": {\n latest: string;\n [tag: string]: string;\n };\n}\n\nconst getLatestVersion = async (packageName: string): Promise<string> => {\n const response = await fetch(`https://registry.npmjs.org/${packageName}`);\n if (!response.ok) {\n throw new Error(`Failed to fetch package data: ${response.statusText}`);\n }\n const data: NpmPackageData = await response.json();\n return data[\"dist-tags\"].latest;\n};\n\nconst update = async (): Promise<void> => {\n try {\n const installedVersion = process.env.CHROMADB_VERSION || \"0.0.0\";\n const latestVersion = await getLatestVersion(\"chromadb\");\n\n if (semver.lt(installedVersion, latestVersion)) {\n console.log(`\\nA new chromadb version (${latestVersion}) is available!`);\n console.log(\"\\n\\x1b[4mUpdat with npm\\x1b[0m\");\n console.log(\"npm install chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with pnpm\\x1b[0m\");\n console.log(\"pnpm add chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with yarn\\x1b[0m\");\n console.log(\"yarn add chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with bun\\x1b[0m\");\n console.log(\"bun add chromadb@latest\\n\");\n } else {\n console.log(\n `\\nYour chromadb version (${latestVersion}) is up-to-date!\\n`,\n );\n }\n } catch (error) {\n console.error(\"Error checking versions:\", error);\n }\n};\n\nconst main = async () => {\n const args: string[] = process.argv.slice(2);\n if (args.length > 0 && args[0] === \"update\") {\n await update();\n return;\n }\n\n process.on(\"SIGINT\", () => {\n process.exit(0);\n });\n\n binding.cli([\"chroma\", ...args]);\n};\n\nmain().finally();\n","import { createRequire } from \"module\";\nimport os from \"os\";\n\nconst require = createRequire(import.meta.url);\nconst platform = os.platform();\nconst arch = os.arch();\n\nlet binding: any;\n\nif (platform === \"darwin\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-darwin-arm64\");\n } else if (arch === \"x64\") {\n binding = require(\"chromadb-js-bindings-darwin-x64\");\n } else {\n throw new Error(`Unsupported architecture on macOS: ${arch}`);\n }\n} else if (platform === \"linux\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-linux-arm64-gnu\");\n } else if (arch === \"x64\") {\n binding = require(\"chromadb-js-bindings-linux-x64-gnu\");\n } else {\n throw new Error(`Unsupported architecture on Linux: ${arch}`);\n }\n} else if (platform === \"win32\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-win32-arm64-msvc\");\n } else {\n throw new Error(\n `Unsupported Windows architecture: ${arch}. Only ARM64 is supported.`,\n );\n }\n} else {\n throw new Error(`Unsupported platform: ${platform}`);\n}\n\nexport default binding;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oBAAmB;;;ACDnB,oBAA8B;AAC9B,gBAAe;AADf;AAGA,IAAMA,eAAU,6BAAc,YAAY,GAAG;AAC7C,IAAM,WAAW,UAAAC,QAAG,SAAS;AAC7B,IAAM,OAAO,UAAAA,QAAG,KAAK;AAErB,IAAI;AAEJ,IAAI,aAAa,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0BAA0B;AAEtC,cAAQ,IAAI,iCAAiC;AAC7C,cAAQ,IAAI,0BAA0B;AAEtC,cAAQ,IAAI,gCAAgC;AAC5C,cAAQ,IAAI,2BAA2B;AAAA,IACzC,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,yBAA4B,aAAa;AAAA;AAAA,MAC3C;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,4BAA4B,KAAK;AAAA,EACjD;AACF;AAEA,IAAM,OAAO,YAAY;AACvB,QAAM,OAAiB,QAAQ,KAAK,MAAM,CAAC;AAC3C,MAAI,KAAK,SAAS,KAAK,KAAK,CAAC,MAAM,UAAU;AAC3C,UAAM,OAAO;AACb;AAAA,EACF;AAEA,UAAQ,GAAG,UAAU,MAAM;AACzB,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AAED,mBAAQ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AACjC;AAEA,KAAK,EAAE,QAAQ;","names":["require","os","semver"]}
package/dist/cli.mjs CHANGED
@@ -81,6 +81,9 @@ var main = async () => {
81
81
  await update();
82
82
  return;
83
83
  }
84
+ process.on("SIGINT", () => {
85
+ process.exit(0);
86
+ });
84
87
  bindings_default.cli(["chroma", ...args]);
85
88
  };
86
89
  main().finally();
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts","../src/bindings.ts"],"sourcesContent":["#!/usr/bin/env node\nimport semver from \"semver\";\nimport binding from \"./bindings\";\n\ninterface NpmPackageData {\n \"dist-tags\": {\n latest: string;\n [tag: string]: string;\n };\n}\n\nconst getLatestVersion = async (packageName: string): Promise<string> => {\n const response = await fetch(`https://registry.npmjs.org/${packageName}`);\n if (!response.ok) {\n throw new Error(`Failed to fetch package data: ${response.statusText}`);\n }\n const data: NpmPackageData = await response.json();\n return data[\"dist-tags\"].latest;\n};\n\nconst update = async (): Promise<void> => {\n try {\n const installedVersion = process.env.CHROMADB_VERSION || \"0.0.0\";\n const latestVersion = await getLatestVersion(\"chromadb\");\n\n if (semver.lt(installedVersion, latestVersion)) {\n console.log(`\\nA new chromadb version (${latestVersion}) is available!`);\n console.log(\"\\n\\x1b[4mUpdat with npm\\x1b[0m\");\n console.log(\"npm install chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with pnpm\\x1b[0m\");\n console.log(\"pnpm add chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with yarn\\x1b[0m\");\n console.log(\"yarn add chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with bun\\x1b[0m\");\n console.log(\"bun add chromadb@latest\\n\");\n } else {\n console.log(\n `\\nYour chromadb version (${latestVersion}) is up-to-date!\\n`,\n );\n }\n } catch (error) {\n console.error(\"Error checking versions:\", error);\n }\n};\n\nconst main = async () => {\n const args: string[] = process.argv.slice(2);\n if (args.length > 0 && args[0] === \"update\") {\n await update();\n return;\n }\n\n binding.cli([\"chroma\", ...args]);\n};\n\nmain().finally();\n","import { createRequire } from \"module\";\nimport os from \"os\";\n\nconst require = createRequire(import.meta.url);\nconst platform = os.platform();\nconst arch = os.arch();\n\nlet binding: any;\n\nif (platform === \"darwin\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-darwin-arm64\");\n } else if (arch === \"x64\") {\n binding = require(\"chromadb-js-bindings-darwin-x64\");\n } else {\n throw new Error(`Unsupported architecture on macOS: ${arch}`);\n }\n} else if (platform === \"linux\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-linux-arm64-gnu\");\n } else if (arch === \"x64\") {\n binding = require(\"chromadb-js-bindings-linux-x64-gnu\");\n } else {\n throw new Error(`Unsupported architecture on Linux: ${arch}`);\n }\n} else if (platform === \"win32\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-win32-arm64-msvc\");\n } else {\n throw new Error(\n `Unsupported Windows architecture: ${arch}. Only ARM64 is supported.`,\n );\n }\n} else {\n throw new Error(`Unsupported platform: ${platform}`);\n}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AAiB,UAAU;AAEvD,QAAI,OAAO,GAAG,kBAAkB,aAAa,GAAG;AAC9C,cAAQ,IAAI;AAAA,0BAA6B,aAAa,iBAAiB;AACvE,cAAQ,IAAI,gCAAgC;AAC5C,cAAQ,IAAI,6BAA6B;AAEzC,cAAQ,IAAI,iCAAiC;AAC7C,cAAQ,IAAI,0BAA0B;AAEtC,cAAQ,IAAI,iCAAiC;AAC7C,cAAQ,IAAI,0BAA0B;AAEtC,cAAQ,IAAI,gCAAgC;AAC5C,cAAQ,IAAI,2BAA2B;AAAA,IACzC,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,yBAA4B,aAAa;AAAA;AAAA,MAC3C;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,4BAA4B,KAAK;AAAA,EACjD;AACF;AAEA,IAAM,OAAO,YAAY;AACvB,QAAM,OAAiB,QAAQ,KAAK,MAAM,CAAC;AAC3C,MAAI,KAAK,SAAS,KAAK,KAAK,CAAC,MAAM,UAAU;AAC3C,UAAM,OAAO;AACb;AAAA,EACF;AAEA,mBAAQ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AACjC;AAEA,KAAK,EAAE,QAAQ;","names":["require"]}
1
+ {"version":3,"sources":["../src/cli.ts","../src/bindings.ts"],"sourcesContent":["#!/usr/bin/env node\nimport semver from \"semver\";\nimport binding from \"./bindings\";\n\ninterface NpmPackageData {\n \"dist-tags\": {\n latest: string;\n [tag: string]: string;\n };\n}\n\nconst getLatestVersion = async (packageName: string): Promise<string> => {\n const response = await fetch(`https://registry.npmjs.org/${packageName}`);\n if (!response.ok) {\n throw new Error(`Failed to fetch package data: ${response.statusText}`);\n }\n const data: NpmPackageData = await response.json();\n return data[\"dist-tags\"].latest;\n};\n\nconst update = async (): Promise<void> => {\n try {\n const installedVersion = process.env.CHROMADB_VERSION || \"0.0.0\";\n const latestVersion = await getLatestVersion(\"chromadb\");\n\n if (semver.lt(installedVersion, latestVersion)) {\n console.log(`\\nA new chromadb version (${latestVersion}) is available!`);\n console.log(\"\\n\\x1b[4mUpdat with npm\\x1b[0m\");\n console.log(\"npm install chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with pnpm\\x1b[0m\");\n console.log(\"pnpm add chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with yarn\\x1b[0m\");\n console.log(\"yarn add chromadb@latest\");\n\n console.log(\"\\n\\x1b[4mUpdat with bun\\x1b[0m\");\n console.log(\"bun add chromadb@latest\\n\");\n } else {\n console.log(\n `\\nYour chromadb version (${latestVersion}) is up-to-date!\\n`,\n );\n }\n } catch (error) {\n console.error(\"Error checking versions:\", error);\n }\n};\n\nconst main = async () => {\n const args: string[] = process.argv.slice(2);\n if (args.length > 0 && args[0] === \"update\") {\n await update();\n return;\n }\n\n process.on(\"SIGINT\", () => {\n process.exit(0);\n });\n\n binding.cli([\"chroma\", ...args]);\n};\n\nmain().finally();\n","import { createRequire } from \"module\";\nimport os from \"os\";\n\nconst require = createRequire(import.meta.url);\nconst platform = os.platform();\nconst arch = os.arch();\n\nlet binding: any;\n\nif (platform === \"darwin\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-darwin-arm64\");\n } else if (arch === \"x64\") {\n binding = require(\"chromadb-js-bindings-darwin-x64\");\n } else {\n throw new Error(`Unsupported architecture on macOS: ${arch}`);\n }\n} else if (platform === \"linux\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-linux-arm64-gnu\");\n } else if (arch === \"x64\") {\n binding = require(\"chromadb-js-bindings-linux-x64-gnu\");\n } else {\n throw new Error(`Unsupported architecture on Linux: ${arch}`);\n }\n} else if (platform === \"win32\") {\n if (arch === \"arm64\") {\n binding = require(\"chromadb-js-bindings-win32-arm64-msvc\");\n } else {\n throw new Error(\n `Unsupported Windows architecture: ${arch}. Only ARM64 is supported.`,\n );\n }\n} else {\n throw new Error(`Unsupported platform: ${platform}`);\n}\n\nexport default binding;\n"],"mappings":";;;;AACA,OAAO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kBAAkB,aAAa,GAAG;AAC9C,cAAQ,IAAI;AAAA,0BAA6B,aAAa,iBAAiB;AACvE,cAAQ,IAAI,gCAAgC;AAC5C,cAAQ,IAAI,6BAA6B;AAEzC,cAAQ,IAAI,iCAAiC;AAC7C,cAAQ,IAAI,0BAA0B;AAEtC,cAAQ,IAAI,iCAAiC;AAC7C,cAAQ,IAAI,0BAA0B;AAEtC,cAAQ,IAAI,gCAAgC;AAC5C,cAAQ,IAAI,2BAA2B;AAAA,IACzC,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,yBAA4B,aAAa;AAAA;AAAA,MAC3C;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,4BAA4B,KAAK;AAAA,EACjD;AACF;AAEA,IAAM,OAAO,YAAY;AACvB,QAAM,OAAiB,QAAQ,KAAK,MAAM,CAAC;AAC3C,MAAI,KAAK,SAAS,KAAK,KAAK,CAAC,MAAM,UAAU;AAC3C,UAAM,OAAO;AACb;AAAA,EACF;AAEA,UAAQ,GAAG,UAAU,MAAM;AACzB,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AAED,mBAAQ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AACjC;AAEA,KAAK,EAAE,QAAQ;","names":["require"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chromadb",
3
- "version": "3.4.2",
3
+ "version": "3.5.0",
4
4
  "description": "A JavaScript interface for chroma",
5
5
  "keywords": [
6
6
  "chroma",
@@ -30,10 +30,24 @@
30
30
  "src",
31
31
  "dist"
32
32
  ],
33
+ "scripts": {
34
+ "test": "jest --runInBand",
35
+ "test:functional": "jest --runInBand --testPathIgnorePatterns=test/auth.*.test.ts",
36
+ "test:update": "jest --runInBand --updateSnapshot",
37
+ "prebuild": "rimraf dist",
38
+ "build": "tsup",
39
+ "watch": "tsup --watch",
40
+ "genapi": "node --loader ts-node/esm scripts/gen-api.ts",
41
+ "prettier": "prettier --write .",
42
+ "release": "run-s build test && npm publish",
43
+ "release_alpha": "run-s build test && npm publish --tag alpha",
44
+ "release_dev": "run-s build test && npm version ${NEW_VERSION} --no-git-tag-version && npm publish"
45
+ },
33
46
  "dependencies": {
34
47
  "semver": "^7.7.1"
35
48
  },
36
49
  "devDependencies": {
50
+ "@chroma-core/default-embed": "workspace:^",
37
51
  "@hey-api/client-fetch": "^0.10.0",
38
52
  "@hey-api/openapi-ts": "^0.67.3",
39
53
  "@jest/globals": "^29.7.0",
@@ -56,33 +70,19 @@
56
70
  "tsd": "^0.28.1",
57
71
  "tsup": "^8.3.5",
58
72
  "typescript": "^5.0.4",
59
- "wait-on": "^8.0.3",
60
- "@chroma-core/default-embed": "^0.1.9"
73
+ "wait-on": "^8.0.3"
61
74
  },
62
75
  "optionalDependencies": {
63
- "chromadb-js-bindings-darwin-arm64": "^1.3.2",
64
- "chromadb-js-bindings-darwin-x64": "^1.3.2",
65
- "chromadb-js-bindings-linux-arm64-gnu": "^1.3.2",
66
- "chromadb-js-bindings-linux-x64-gnu": "^1.3.2",
67
- "chromadb-js-bindings-win32-x64-msvc": "^1.3.2"
76
+ "chromadb-js-bindings-darwin-arm64": "^1.3.4",
77
+ "chromadb-js-bindings-darwin-x64": "^1.3.4",
78
+ "chromadb-js-bindings-linux-arm64-gnu": "^1.3.4",
79
+ "chromadb-js-bindings-linux-x64-gnu": "^1.3.4",
80
+ "chromadb-js-bindings-win32-x64-msvc": "^1.3.4"
68
81
  },
69
82
  "engines": {
70
83
  "node": ">=20"
71
84
  },
72
85
  "bin": {
73
86
  "chroma": "dist/cli.mjs"
74
- },
75
- "scripts": {
76
- "test": "jest --runInBand",
77
- "test:functional": "jest --runInBand --testPathIgnorePatterns=test/auth.*.test.ts",
78
- "test:update": "jest --runInBand --updateSnapshot",
79
- "prebuild": "rimraf dist",
80
- "build": "tsup",
81
- "watch": "tsup --watch",
82
- "genapi": "node --loader ts-node/esm scripts/gen-api.ts",
83
- "prettier": "prettier --write .",
84
- "release": "run-s build test && npm publish",
85
- "release_alpha": "run-s build test && npm publish --tag alpha",
86
- "release_dev": "run-s build test && npm version ${NEW_VERSION} --no-git-tag-version && npm publish"
87
87
  }
88
- }
88
+ }
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
3
  import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
4
- import type { GetUserIdentityData, GetUserIdentityResponse2, GetUserIdentityError, GetCollectionByCrnData, GetCollectionByCrnResponse, GetCollectionByCrnError, HealthcheckData, HealthcheckResponse, HealthcheckError, HeartbeatData, HeartbeatResponse2, HeartbeatError, PreFlightChecksData, PreFlightChecksResponse, PreFlightChecksError, ResetData, ResetResponse, ResetError, CreateTenantData, CreateTenantResponse2, CreateTenantError, GetTenantData, GetTenantResponse2, GetTenantError, UpdateTenantData, UpdateTenantResponse2, UpdateTenantError, ListDatabasesData, ListDatabasesResponse, ListDatabasesError, CreateDatabaseData, CreateDatabaseResponse2, CreateDatabaseError, DeleteDatabaseData, DeleteDatabaseResponse2, DeleteDatabaseError, GetDatabaseData, GetDatabaseResponse, GetDatabaseError, ListCollectionsData, ListCollectionsResponse, ListCollectionsError, CreateCollectionData, CreateCollectionResponse, CreateCollectionError, DeleteCollectionData, DeleteCollectionResponse2, DeleteCollectionError, GetCollectionData, GetCollectionResponse, GetCollectionError, UpdateCollectionData, UpdateCollectionResponse2, UpdateCollectionError, CollectionAddData, CollectionAddResponse, DetachFunctionData, DetachFunctionResponse2, DetachFunctionError, CollectionCountData, CollectionCountResponse, CollectionCountError, CollectionDeleteData, CollectionDeleteResponse, CollectionDeleteError, ForkCollectionData, ForkCollectionResponse, ForkCollectionError, ForkCountData, ForkCountResponse2, ForkCountError, AttachFunctionData, AttachFunctionResponse2, AttachFunctionError, GetAttachedFunctionData, GetAttachedFunctionResponse2, GetAttachedFunctionError, CollectionGetData, CollectionGetResponse, CollectionGetError, IndexingStatusData, IndexingStatusResponse, IndexingStatusError, CollectionQueryData, CollectionQueryResponse, CollectionQueryError, CollectionSearchData, CollectionSearchResponse, CollectionSearchError, CollectionUpdateData, CollectionUpdateResponse, CollectionUpsertData, CollectionUpsertResponse, CollectionUpsertError, CountCollectionsData, CountCollectionsResponse, CountCollectionsError, VersionData, VersionResponse } from './types.gen';
4
+ import type { GetUserIdentityData, GetUserIdentityResponse2, GetUserIdentityError, GetCollectionByCrnData, GetCollectionByCrnResponse, GetCollectionByCrnError, HealthcheckData, HealthcheckResponse, HealthcheckError, HeartbeatData, HeartbeatResponse2, HeartbeatError, PreFlightChecksData, PreFlightChecksResponse, PreFlightChecksError, ResetData, ResetResponse, ResetError, CreateTenantData, CreateTenantResponse2, CreateTenantError, GetTenantData, GetTenantResponse2, GetTenantError, UpdateTenantData, UpdateTenantResponse2, UpdateTenantError, ListDatabasesData, ListDatabasesResponse, ListDatabasesError, CreateDatabaseData, CreateDatabaseResponse2, CreateDatabaseError, DeleteDatabaseData, DeleteDatabaseResponse2, DeleteDatabaseError, GetDatabaseData, GetDatabaseResponse, GetDatabaseError, ListCollectionsData, ListCollectionsResponse, ListCollectionsError, CreateCollectionData, CreateCollectionResponse, CreateCollectionError, GetCollectionByIdData, GetCollectionByIdResponse, GetCollectionByIdError, DeleteCollectionData, DeleteCollectionResponse2, DeleteCollectionError, GetCollectionData, GetCollectionResponse, GetCollectionError, UpdateCollectionData, UpdateCollectionResponse2, UpdateCollectionError, CollectionAddData, CollectionAddResponse, AddAttachedFunctionInputData, AddAttachedFunctionInputResponse2, AddAttachedFunctionInputError, DetachFunctionData, DetachFunctionResponse2, DetachFunctionError, CollectionCountData, CollectionCountResponse, CollectionCountError, CollectionDeleteData, CollectionDeleteResponse, CollectionDeleteError, ForkCollectionData, ForkCollectionResponse, ForkCollectionError, ForkCountData, ForkCountResponse2, ForkCountError, AttachFunctionData, AttachFunctionResponse2, AttachFunctionError, GetAttachedFunctionData, GetAttachedFunctionResponse2, GetAttachedFunctionError, CollectionGetData, CollectionGetResponse, CollectionGetError, IndexingStatusData, IndexingStatusResponse, IndexingStatusError, CollectionQueryData, CollectionQueryResponse, CollectionQueryError, CollectionSearchData, CollectionSearchResponse, CollectionSearchError, CollectionUpdateData, CollectionUpdateResponse, CollectionUpsertData, CollectionUpsertResponse, CollectionUpsertError, CountCollectionsData, CountCollectionsResponse, CountCollectionsError, VersionData, VersionResponse } from './types.gen';
5
5
  import { client as _heyApiClient } from './client.gen';
6
6
 
7
7
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
@@ -94,6 +94,23 @@ export class CollectionService {
94
94
  });
95
95
  }
96
96
 
97
+ /**
98
+ * Get collection by ID
99
+ * Returns a collection by its UUID within a specific tenant and database.
100
+ */
101
+ public static getCollectionById<ThrowOnError extends boolean = true>(options: Options<GetCollectionByIdData, ThrowOnError>) {
102
+ return (options.client ?? _heyApiClient).get<GetCollectionByIdResponse, GetCollectionByIdError, ThrowOnError>({
103
+ security: [
104
+ {
105
+ name: 'x-chroma-token',
106
+ type: 'apiKey'
107
+ }
108
+ ],
109
+ url: '/api/v2/tenants/{tenant}/databases/{database}/collections/by-id/{collection_id}',
110
+ ...options
111
+ });
112
+ }
113
+
97
114
  /**
98
115
  * Delete collection
99
116
  * Deletes a collection in a database.
@@ -592,6 +609,27 @@ export class RecordService {
592
609
  }
593
610
 
594
611
  export class FunctionService {
612
+ /**
613
+ * Add attached function input
614
+ * Adds a new input collection to an existing async attached function.
615
+ */
616
+ public static addAttachedFunctionInput<ThrowOnError extends boolean = true>(options: Options<AddAttachedFunctionInputData, ThrowOnError>) {
617
+ return (options.client ?? _heyApiClient).post<AddAttachedFunctionInputResponse2, AddAttachedFunctionInputError, ThrowOnError>({
618
+ security: [
619
+ {
620
+ name: 'x-chroma-token',
621
+ type: 'apiKey'
622
+ }
623
+ ],
624
+ url: '/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/attached_functions/{name}/add_input',
625
+ ...options,
626
+ headers: {
627
+ 'Content-Type': 'application/json',
628
+ ...options?.headers
629
+ }
630
+ });
631
+ }
632
+
595
633
  /**
596
634
  * Detach function
597
635
  * Detaches a function from a collection.
@@ -1,5 +1,14 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
+ export type AddAttachedFunctionInputRequest = {
4
+ input_collection_id: CollectionUuid;
5
+ };
6
+
7
+ export type AddAttachedFunctionInputResponse = {
8
+ attached_function: AttachedFunctionApiResponse;
9
+ created: boolean;
10
+ };
11
+
3
12
  /**
4
13
  * Payload for adding records to a collection.
5
14
  *
@@ -270,8 +279,22 @@ export type ForkCountResponse = {
270
279
  count: number;
271
280
  };
272
281
 
282
+ /**
283
+ * Full-text search index algorithm.
284
+ *
285
+ * Controls which index format and query pipeline are used for
286
+ * document substring search within a collection.
287
+ */
288
+ export type FtsAlgorithm = 'trigram' | 'token_bitmap';
289
+
273
290
  export type FtsIndexConfig = {
274
- [key: string]: never;
291
+ /**
292
+ * FTS index algorithm.
293
+ * Omitted from JSON when set to the default (Trigram) so that old
294
+ * servers/clients that do not know about this field can still
295
+ * deserialize the schema.
296
+ */
297
+ algorithm?: FtsAlgorithm;
275
298
  };
276
299
 
277
300
  export type FtsIndexType = {
@@ -478,7 +501,7 @@ export type RawWhereFields = {
478
501
  where_document?: unknown;
479
502
  };
480
503
 
481
- export type ReadLevel = 'index_and_wal' | 'index_only';
504
+ export type ReadLevel = 'index_and_wal' | 'index_only' | 'index_and_bounded_wal';
482
505
 
483
506
  /**
484
507
  * Schema representation for collection index configurations
@@ -503,10 +526,6 @@ export type Schema = {
503
526
  keys: {
504
527
  [key: string]: ValueTypes;
505
528
  };
506
- /**
507
- * ID of the attached function that created this output collection (if applicable)
508
- */
509
- source_attached_function_id?: string | null;
510
529
  };
511
530
 
512
531
  export type SearchPayload = {
@@ -592,6 +611,14 @@ export type SpannIndexConfig = {
592
611
  write_rng_factor?: number | null;
593
612
  };
594
613
 
614
+ /**
615
+ * Sparse vector index algorithm.
616
+ *
617
+ * Controls which posting list format and query engine are used for
618
+ * sparse vector search within a collection.
619
+ */
620
+ export type SparseIndexAlgorithm = 'wand' | 'max_score';
621
+
595
622
  /**
596
623
  * Represents a sparse vector using parallel arrays for indices and values.
597
624
  *
@@ -616,6 +643,13 @@ export type SparseVector = {
616
643
  };
617
644
 
618
645
  export type SparseVectorIndexConfig = {
646
+ /**
647
+ * Sparse index algorithm (cloud-only, tenant-gated).
648
+ * Omitted from JSON when set to the default (Wand) so that old
649
+ * servers/clients that do not know about this field can still
650
+ * deserialize the schema.
651
+ */
652
+ algorithm?: SparseIndexAlgorithm;
619
653
  /**
620
654
  * Whether this embedding is BM25
621
655
  */
@@ -1307,6 +1341,52 @@ export type CreateCollectionResponses = {
1307
1341
 
1308
1342
  export type CreateCollectionResponse = CreateCollectionResponses[keyof CreateCollectionResponses];
1309
1343
 
1344
+ export type GetCollectionByIdData = {
1345
+ body?: never;
1346
+ path: {
1347
+ /**
1348
+ * Tenant ID
1349
+ */
1350
+ tenant: string;
1351
+ /**
1352
+ * Database name
1353
+ */
1354
+ database: string;
1355
+ /**
1356
+ * Collection UUID
1357
+ */
1358
+ collection_id: string;
1359
+ };
1360
+ query?: never;
1361
+ url: '/api/v2/tenants/{tenant}/databases/{database}/collections/by-id/{collection_id}';
1362
+ };
1363
+
1364
+ export type GetCollectionByIdErrors = {
1365
+ /**
1366
+ * Unauthorized
1367
+ */
1368
+ 401: ErrorResponse;
1369
+ /**
1370
+ * Collection not found
1371
+ */
1372
+ 404: ErrorResponse;
1373
+ /**
1374
+ * Server error
1375
+ */
1376
+ 500: ErrorResponse;
1377
+ };
1378
+
1379
+ export type GetCollectionByIdError = GetCollectionByIdErrors[keyof GetCollectionByIdErrors];
1380
+
1381
+ export type GetCollectionByIdResponses = {
1382
+ /**
1383
+ * Collection found
1384
+ */
1385
+ 200: Collection;
1386
+ };
1387
+
1388
+ export type GetCollectionByIdResponse = GetCollectionByIdResponses[keyof GetCollectionByIdResponses];
1389
+
1310
1390
  export type DeleteCollectionData = {
1311
1391
  body?: never;
1312
1392
  path: {
@@ -1484,6 +1564,52 @@ export type CollectionAddResponses = {
1484
1564
 
1485
1565
  export type CollectionAddResponse = CollectionAddResponses[keyof CollectionAddResponses];
1486
1566
 
1567
+ export type AddAttachedFunctionInputData = {
1568
+ body: AddAttachedFunctionInputRequest;
1569
+ path: {
1570
+ /**
1571
+ * Tenant UUID
1572
+ */
1573
+ tenant: string;
1574
+ /**
1575
+ * Database name
1576
+ */
1577
+ database: string;
1578
+ /**
1579
+ * Collection UUID
1580
+ */
1581
+ collection_id: string;
1582
+ /**
1583
+ * Function name
1584
+ */
1585
+ name: string;
1586
+ };
1587
+ query?: never;
1588
+ url: '/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/attached_functions/{name}/add_input';
1589
+ };
1590
+
1591
+ export type AddAttachedFunctionInputErrors = {
1592
+ /**
1593
+ * Unauthorized
1594
+ */
1595
+ 401: ErrorResponse;
1596
+ /**
1597
+ * Server error
1598
+ */
1599
+ 500: ErrorResponse;
1600
+ };
1601
+
1602
+ export type AddAttachedFunctionInputError = AddAttachedFunctionInputErrors[keyof AddAttachedFunctionInputErrors];
1603
+
1604
+ export type AddAttachedFunctionInputResponses = {
1605
+ /**
1606
+ * Attached function input added successfully
1607
+ */
1608
+ 200: AddAttachedFunctionInputResponse;
1609
+ };
1610
+
1611
+ export type AddAttachedFunctionInputResponse2 = AddAttachedFunctionInputResponses[keyof AddAttachedFunctionInputResponses];
1612
+
1487
1613
  export type DetachFunctionData = {
1488
1614
  body: DetachFunctionRequest;
1489
1615
  path: {
@@ -440,6 +440,38 @@ export class ChromaClient {
440
440
  });
441
441
  }
442
442
 
443
+ /**
444
+ * Retrieves an existing collection by its ID.
445
+ * @param id - The UUID of the collection to retrieve
446
+ * @returns Promise resolving to the Collection instance
447
+ * @throws Error if the collection does not exist
448
+ */
449
+ public async getCollectionById(id: string): Promise<Collection> {
450
+ const { data } = await CollectionService.getCollectionById({
451
+ client: this.apiClient,
452
+ path: { ...(await this._path()), collection_id: id },
453
+ });
454
+ const schema = await Schema.deserializeFromJSON(data.schema ?? null, this);
455
+ const schemaEmbeddingFunction = resolveSchemaEmbeddingFunction(schema);
456
+ const resolvedEmbeddingFunction =
457
+ (await getEmbeddingFunction({
458
+ efConfig: data.configuration_json.embedding_function ?? undefined,
459
+ client: this,
460
+ })) ?? schemaEmbeddingFunction;
461
+ return new CollectionImpl({
462
+ chromaClient: this,
463
+ apiClient: this.apiClient,
464
+ name: data.name,
465
+ tenant: data.tenant,
466
+ database: data.database,
467
+ configuration: data.configuration_json,
468
+ metadata: deserializeMetadata(data.metadata ?? undefined) ?? undefined,
469
+ embeddingFunction: resolvedEmbeddingFunction,
470
+ id: data.id,
471
+ schema,
472
+ });
473
+ }
474
+
443
475
  /**
444
476
  * Retrieves multiple collections by name.
445
477
  * @param items - Array of collection names or objects with name and optional embedding function (should match the ones used to create the collections)
package/src/cli.ts CHANGED
@@ -53,6 +53,10 @@ const main = async () => {
53
53
  return;
54
54
  }
55
55
 
56
+ process.on("SIGINT", () => {
57
+ process.exit(0);
58
+ });
59
+
56
60
  binding.cli(["chroma", ...args]);
57
61
  };
58
62
 
package/src/collection.ts CHANGED
@@ -80,6 +80,7 @@ export interface Collection {
80
80
  * Controls whether to read from the write-ahead log.
81
81
  * - ReadLevel.INDEX_AND_WAL: Read from both index and WAL (default)
82
82
  * - ReadLevel.INDEX_ONLY: Read only from index, faster but recent writes may not be visible
83
+ * - ReadLevel.INDEX_AND_BOUNDED_WAL: Read up to a server-configured number of WAL entries
83
84
  */
84
85
  readLevel?: ReadLevel;
85
86
  }): Promise<number>;
@@ -231,6 +232,7 @@ export interface Collection {
231
232
  * Controls whether to read from the write-ahead log.
232
233
  * - ReadLevel.INDEX_AND_WAL: Read from both index and WAL (default)
233
234
  * - ReadLevel.INDEX_ONLY: Read only from index, faster but recent writes may not be visible
235
+ * - ReadLevel.INDEX_AND_BOUNDED_WAL: Read up to a server-configured number of WAL entries
234
236
  */
235
237
  readLevel?: ReadLevel;
236
238
  },