chromadb 3.2.0 → 3.2.2

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.
@@ -86,6 +86,12 @@ type HnswIndexConfig = {
86
86
  sync_threshold?: number | null;
87
87
  };
88
88
  type Include = 'distances' | 'documents' | 'embeddings' | 'metadatas' | 'uris';
89
+ type IndexStatusResponse = {
90
+ num_indexed_ops: number;
91
+ num_unindexed_ops: number;
92
+ op_indexing_progress: number;
93
+ total_ops: number;
94
+ };
89
95
  type IntInvertedIndexConfig$1 = {
90
96
  [key: string]: never;
91
97
  };
@@ -366,6 +372,19 @@ type VectorIndexType$1 = {
366
372
  * User identity information including tenant and database access.
367
373
  */
368
374
  type UserIdentity = GetUserIdentityResponse;
375
+ /**
376
+ * Read level controls whether queries read from the write-ahead log (WAL).
377
+ *
378
+ * - INDEX_AND_WAL: Read from both the compacted index and the WAL.
379
+ * All committed writes will be visible. This is the default.
380
+ * - INDEX_ONLY: Read only from the compacted index, skipping the WAL.
381
+ * Recent writes that haven't been compacted may not be visible, but queries are faster.
382
+ */
383
+ declare const ReadLevel: {
384
+ readonly INDEX_AND_WAL: "index_and_wal";
385
+ readonly INDEX_ONLY: "index_only";
386
+ };
387
+ type ReadLevel = (typeof ReadLevel)[keyof typeof ReadLevel];
369
388
 
370
389
  /**
371
390
  * Metadata that can be associated with a collection.
@@ -567,6 +586,10 @@ declare class QueryResult<TMeta extends Metadata = Metadata> {
567
586
  */
568
587
  rows(): QueryRowResult<TMeta>[][];
569
588
  }
589
+ /**
590
+ * Re-export IndexStatusResponse type for external use
591
+ */
592
+ type IndexingStatus = IndexStatusResponse;
570
593
 
571
594
  /**
572
595
  * Supported vector space types.
@@ -842,7 +865,7 @@ interface RrfOptions {
842
865
  weights?: number[];
843
866
  normalize?: boolean;
844
867
  }
845
- declare const Rrf: ({ ranks, k, weights, normalize }: RrfOptions) => RankExpression;
868
+ declare const Rrf: ({ ranks, k, weights, normalize, }: RrfOptions) => RankExpression;
846
869
  declare const Sum: (...inputs: RankInput[]) => RankExpression;
847
870
  declare const Sub: (left: RankInput, right: RankInput) => RankExpression;
848
871
  declare const Mul: (...inputs: RankInput[]) => RankExpression;
@@ -1642,7 +1665,19 @@ interface Collection {
1642
1665
  * @param searches - Single search payload or array of payloads
1643
1666
  * @returns Promise resolving to column-major search results
1644
1667
  */
1645
- search(searches: SearchLike | SearchLike[]): Promise<SearchResult>;
1668
+ search(searches: SearchLike | SearchLike[], options?: {
1669
+ /**
1670
+ * Controls whether to read from the write-ahead log.
1671
+ * - ReadLevel.INDEX_AND_WAL: Read from both index and WAL (default)
1672
+ * - ReadLevel.INDEX_ONLY: Read only from index, faster but recent writes may not be visible
1673
+ */
1674
+ readLevel?: ReadLevel;
1675
+ }): Promise<SearchResult>;
1676
+ /**
1677
+ * Gets the indexing status of the collection.
1678
+ * @returns Promise resolving to indexing status information
1679
+ */
1680
+ getIndexingStatus(): Promise<IndexingStatus>;
1646
1681
  }
1647
1682
 
1648
1683
  declare function withChroma(userNextConfig?: any): any;
@@ -1862,4 +1897,4 @@ declare class ChromaRateLimitError extends Error {
1862
1897
  }
1863
1898
  declare function createErrorByType(type: string, message: string): InvalidCollectionError | InvalidArgumentError | undefined;
1864
1899
 
1865
- export { Abs, AdminClient, type AdminClientArgs, AdminCloudClient, Aggregate, type AggregateInput, type AggregateJSON, type AnyEmbeddingFunction, type BaseRecordSet, BoolInvertedIndexConfig, BoolInvertedIndexType, BoolValueType, ChromaClient, type ChromaClientArgs, ChromaClientError, ChromaConnectionError, ChromaError, ChromaForbiddenError, ChromaNotFoundError, ChromaQuotaExceededError, ChromaRateLimitError, ChromaServerError, ChromaUnauthorizedError, ChromaUniqueError, ChromaValueError, CloudClient, Cmek, CmekProvider, type Collection, type CollectionConfiguration, type CollectionMetadata, type CreateCollectionConfiguration, DOCUMENT_KEY, Div, EMBEDDING_KEY, type EmbeddingFunction, type EmbeddingFunctionClass, type EmbeddingFunctionSpace, Exp, FloatInvertedIndexConfig, FloatInvertedIndexType, FloatListValueType, FloatValueType, FtsIndexConfig, FtsIndexType, GetResult, GroupBy, type GroupByInput, type GroupByJSON, type HNSWConfiguration, IncludeEnum, type IndexConfig, IntInvertedIndexConfig, IntInvertedIndexType, IntValueType, InvalidArgumentError, InvalidCollectionError, K, Key, type KeyFactory, Knn, type KnnOptions, Limit, type LimitInput, type LimitOptions, type ListDatabasesArgs, Log, Max, MaxK, type Metadata, Min, MinK, Mul, type PreparedInsertRecordSet, type PreparedRecordSet, type QueryRecordSet, QueryResult, type QueryRowResult, RankExpression, type RankInput, type RankLiteral, type RecordSet, Rrf, type RrfOptions, Schema, Search, type SearchInit, type SearchLike, SearchResult, type SearchResultRow, Select, type SelectInput, type SelectKeyInput, type SparseEmbeddingFunction, type SparseEmbeddingFunctionClass, type SparseVector, SparseVectorIndexConfig, type SparseVectorIndexConfigOptions, SparseVectorIndexType, SparseVectorValueType, StringInvertedIndexConfig, StringInvertedIndexType, StringValueType, Sub, Sum, type UpdateCollectionConfiguration, type UpdateHNSWConfiguration, type UpdateSPANNConfiguration, type UserIdentity, Val, ValueTypes, VectorIndexConfig, type VectorIndexConfigOptions, VectorIndexType, type Where, type WhereDocument, WhereExpression, type WhereInput, type WhereJSON, baseRecordSetFields, createErrorByType, getDefaultEFConfig, getEmbeddingFunction, getSparseEmbeddingFunction, knownEmbeddingFunctions, knownSparseEmbeddingFunctions, processCreateCollectionConfig, processUpdateCollectionConfig, recordSetFields, registerEmbeddingFunction, registerSparseEmbeddingFunction, serializeEmbeddingFunction, toSearch, withChroma };
1900
+ export { Abs, AdminClient, type AdminClientArgs, AdminCloudClient, Aggregate, type AggregateInput, type AggregateJSON, type AnyEmbeddingFunction, type BaseRecordSet, BoolInvertedIndexConfig, BoolInvertedIndexType, BoolValueType, ChromaClient, type ChromaClientArgs, ChromaClientError, ChromaConnectionError, ChromaError, ChromaForbiddenError, ChromaNotFoundError, ChromaQuotaExceededError, ChromaRateLimitError, ChromaServerError, ChromaUnauthorizedError, ChromaUniqueError, ChromaValueError, CloudClient, Cmek, CmekProvider, type Collection, type CollectionConfiguration, type CollectionMetadata, type CreateCollectionConfiguration, DOCUMENT_KEY, Div, EMBEDDING_KEY, type EmbeddingFunction, type EmbeddingFunctionClass, type EmbeddingFunctionSpace, Exp, FloatInvertedIndexConfig, FloatInvertedIndexType, FloatListValueType, FloatValueType, FtsIndexConfig, FtsIndexType, GetResult, GroupBy, type GroupByInput, type GroupByJSON, type HNSWConfiguration, IncludeEnum, type IndexConfig, type IndexingStatus, IntInvertedIndexConfig, IntInvertedIndexType, IntValueType, InvalidArgumentError, InvalidCollectionError, K, Key, type KeyFactory, Knn, type KnnOptions, Limit, type LimitInput, type LimitOptions, type ListDatabasesArgs, Log, Max, MaxK, type Metadata, Min, MinK, Mul, type PreparedInsertRecordSet, type PreparedRecordSet, type QueryRecordSet, QueryResult, type QueryRowResult, RankExpression, type RankInput, type RankLiteral, ReadLevel, type RecordSet, Rrf, type RrfOptions, Schema, Search, type SearchInit, type SearchLike, SearchResult, type SearchResultRow, Select, type SelectInput, type SelectKeyInput, type SparseEmbeddingFunction, type SparseEmbeddingFunctionClass, type SparseVector, SparseVectorIndexConfig, type SparseVectorIndexConfigOptions, SparseVectorIndexType, SparseVectorValueType, StringInvertedIndexConfig, StringInvertedIndexType, StringValueType, Sub, Sum, type UpdateCollectionConfiguration, type UpdateHNSWConfiguration, type UpdateSPANNConfiguration, type UserIdentity, Val, ValueTypes, VectorIndexConfig, type VectorIndexConfigOptions, VectorIndexType, type Where, type WhereDocument, WhereExpression, type WhereInput, type WhereJSON, baseRecordSetFields, createErrorByType, getDefaultEFConfig, getEmbeddingFunction, getSparseEmbeddingFunction, knownEmbeddingFunctions, knownSparseEmbeddingFunctions, processCreateCollectionConfig, processUpdateCollectionConfig, recordSetFields, registerEmbeddingFunction, registerSparseEmbeddingFunction, serializeEmbeddingFunction, toSearch, withChroma };
@@ -24,6 +24,10 @@ if (typeof globalThis.Deno !== "undefined") {
24
24
  }
25
25
 
26
26
  // src/types.ts
27
+ var ReadLevel = {
28
+ INDEX_AND_WAL: "index_and_wal",
29
+ INDEX_ONLY: "index_only"
30
+ };
27
31
  var baseRecordSetFields = [
28
32
  "ids",
29
33
  "embeddings",
@@ -640,6 +644,15 @@ var DefaultService = class {
640
644
  }
641
645
  });
642
646
  }
647
+ /**
648
+ * Retrieves the indexing status of a collection.
649
+ */
650
+ static indexingStatus(options) {
651
+ return (options.client ?? client).get({
652
+ url: "/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/indexing_status",
653
+ ...options
654
+ });
655
+ }
643
656
  /**
644
657
  * Query a collection in a variety of ways, including vector search, metadata filtering, and full-text search
645
658
  */
@@ -1636,7 +1649,9 @@ var WhereExpression = class _WhereExpression extends WhereExpressionBase {
1636
1649
  return void 0;
1637
1650
  }
1638
1651
  if (!isPlainObject(input)) {
1639
- throw new TypeError("Where input must be a WhereExpression or plain object");
1652
+ throw new TypeError(
1653
+ "Where input must be a WhereExpression or plain object"
1654
+ );
1640
1655
  }
1641
1656
  return parseWhereDict(input);
1642
1657
  }
@@ -1722,7 +1737,10 @@ var comparisonOperatorMap = /* @__PURE__ */ new Map([
1722
1737
  ["$in", (key, value) => new ComparisonWhere(key, "$in", value)],
1723
1738
  ["$nin", (key, value) => new ComparisonWhere(key, "$nin", value)],
1724
1739
  ["$contains", (key, value) => new ComparisonWhere(key, "$contains", value)],
1725
- ["$not_contains", (key, value) => new ComparisonWhere(key, "$not_contains", value)],
1740
+ [
1741
+ "$not_contains",
1742
+ (key, value) => new ComparisonWhere(key, "$not_contains", value)
1743
+ ],
1726
1744
  ["$regex", (key, value) => new ComparisonWhere(key, "$regex", value)],
1727
1745
  ["$not_regex", (key, value) => new ComparisonWhere(key, "$not_regex", value)]
1728
1746
  ]);
@@ -1745,7 +1763,10 @@ var parseWhereDict = (data) => {
1745
1763
  if (conditions.length === 1) {
1746
1764
  return conditions[0];
1747
1765
  }
1748
- return conditions.slice(1).reduce((acc, condition) => AndWhere.combine(acc, condition), conditions[0]);
1766
+ return conditions.slice(1).reduce(
1767
+ (acc, condition) => AndWhere.combine(acc, condition),
1768
+ conditions[0]
1769
+ );
1749
1770
  }
1750
1771
  if ("$or" in data) {
1751
1772
  if (Object.keys(data).length !== 1) {
@@ -1765,7 +1786,10 @@ var parseWhereDict = (data) => {
1765
1786
  if (conditions.length === 1) {
1766
1787
  return conditions[0];
1767
1788
  }
1768
- return conditions.slice(1).reduce((acc, condition) => OrWhere.combine(acc, condition), conditions[0]);
1789
+ return conditions.slice(1).reduce(
1790
+ (acc, condition) => OrWhere.combine(acc, condition),
1791
+ conditions[0]
1792
+ );
1769
1793
  }
1770
1794
  const entries = Object.entries(data);
1771
1795
  if (entries.length !== 1) {
@@ -1777,7 +1801,9 @@ var parseWhereDict = (data) => {
1777
1801
  }
1778
1802
  const operatorEntries = Object.entries(value);
1779
1803
  if (operatorEntries.length !== 1) {
1780
- throw new Error(`Operator dictionary for field "${field}" must contain exactly one operator`);
1804
+ throw new Error(
1805
+ `Operator dictionary for field "${field}" must contain exactly one operator`
1806
+ );
1781
1807
  }
1782
1808
  const [operator, operand] = operatorEntries[0];
1783
1809
  const factory = comparisonOperatorMap.get(operator);
@@ -1972,7 +1998,9 @@ var RankExpressionBase = class {
1972
1998
  }
1973
1999
  const expressions = [
1974
2000
  this,
1975
- ...others.map((item, index) => requireRank(item, `multiply operand ${index}`))
2001
+ ...others.map(
2002
+ (item, index) => requireRank(item, `multiply operand ${index}`)
2003
+ )
1976
2004
  ];
1977
2005
  return MulRankExpression.create(expressions);
1978
2006
  }
@@ -2029,7 +2057,9 @@ var RankExpression = class _RankExpression extends RankExpressionBase {
2029
2057
  if (isPlainObject(input)) {
2030
2058
  return new RawRankExpression(input);
2031
2059
  }
2032
- throw new TypeError("Rank input must be a RankExpression, number, or plain object");
2060
+ throw new TypeError(
2061
+ "Rank input must be a RankExpression, number, or plain object"
2062
+ );
2033
2063
  }
2034
2064
  };
2035
2065
  var RawRankExpression = class extends RankExpression {
@@ -2285,14 +2315,21 @@ var requireRank = (input, context) => {
2285
2315
  };
2286
2316
  var Val = (value) => new ValueRankExpression(requireNumber(value, "Val requires a numeric value"));
2287
2317
  var Knn = (options) => new KnnRankExpression(normalizeKnnOptions(options));
2288
- var Rrf = ({ ranks, k = 60, weights, normalize = false }) => {
2318
+ var Rrf = ({
2319
+ ranks,
2320
+ k = 60,
2321
+ weights,
2322
+ normalize = false
2323
+ }) => {
2289
2324
  if (!Number.isInteger(k) || k <= 0) {
2290
2325
  throw new TypeError("Rrf k must be a positive integer");
2291
2326
  }
2292
2327
  if (!Array.isArray(ranks) || ranks.length === 0) {
2293
2328
  throw new TypeError("Rrf requires at least one rank expression");
2294
2329
  }
2295
- const expressions = ranks.map((rank, index) => requireRank(rank, `ranks[${index}]`));
2330
+ const expressions = ranks.map(
2331
+ (rank, index) => requireRank(rank, `ranks[${index}]`)
2332
+ );
2296
2333
  let weightValues = weights ? weights.slice() : new Array(expressions.length).fill(1);
2297
2334
  if (weightValues.length !== expressions.length) {
2298
2335
  throw new Error("Number of weights must match number of ranks");
@@ -2303,7 +2340,9 @@ var Rrf = ({ ranks, k = 60, weights, normalize = false }) => {
2303
2340
  if (normalize) {
2304
2341
  const total = weightValues.reduce((sum, value) => sum + value, 0);
2305
2342
  if (total <= 0) {
2306
- throw new Error("Weights must sum to a positive value when normalize=true");
2343
+ throw new Error(
2344
+ "Weights must sum to a positive value when normalize=true"
2345
+ );
2307
2346
  }
2308
2347
  weightValues = weightValues.map((value) => value / total);
2309
2348
  }
@@ -2320,18 +2359,28 @@ var Sum = (...inputs) => {
2320
2359
  if (inputs.length === 0) {
2321
2360
  throw new Error("Sum requires at least one rank expression");
2322
2361
  }
2323
- const expressions = inputs.map((rank, index) => requireRank(rank, `Sum operand ${index}`));
2362
+ const expressions = inputs.map(
2363
+ (rank, index) => requireRank(rank, `Sum operand ${index}`)
2364
+ );
2324
2365
  return SumRankExpression.create(expressions);
2325
2366
  };
2326
- var Sub = (left, right) => new SubRankExpression(requireRank(left, "Sub left"), requireRank(right, "Sub right"));
2367
+ var Sub = (left, right) => new SubRankExpression(
2368
+ requireRank(left, "Sub left"),
2369
+ requireRank(right, "Sub right")
2370
+ );
2327
2371
  var Mul = (...inputs) => {
2328
2372
  if (inputs.length === 0) {
2329
2373
  throw new Error("Mul requires at least one rank expression");
2330
2374
  }
2331
- const expressions = inputs.map((rank, index) => requireRank(rank, `Mul operand ${index}`));
2375
+ const expressions = inputs.map(
2376
+ (rank, index) => requireRank(rank, `Mul operand ${index}`)
2377
+ );
2332
2378
  return MulRankExpression.create(expressions);
2333
2379
  };
2334
- var Div = (left, right) => new DivRankExpression(requireRank(left, "Div left"), requireRank(right, "Div right"));
2380
+ var Div = (left, right) => new DivRankExpression(
2381
+ requireRank(left, "Div left"),
2382
+ requireRank(right, "Div right")
2383
+ );
2335
2384
  var Abs = (input) => requireRank(input, "Abs").abs();
2336
2385
  var Exp = (input) => requireRank(input, "Exp").exp();
2337
2386
  var Log = (input) => requireRank(input, "Log").log();
@@ -2339,14 +2388,18 @@ var Max = (...inputs) => {
2339
2388
  if (inputs.length === 0) {
2340
2389
  throw new Error("Max requires at least one rank expression");
2341
2390
  }
2342
- const expressions = inputs.map((rank, index) => requireRank(rank, `Max operand ${index}`));
2391
+ const expressions = inputs.map(
2392
+ (rank, index) => requireRank(rank, `Max operand ${index}`)
2393
+ );
2343
2394
  return MaxRankExpression.create(expressions);
2344
2395
  };
2345
2396
  var Min = (...inputs) => {
2346
2397
  if (inputs.length === 0) {
2347
2398
  throw new Error("Min requires at least one rank expression");
2348
2399
  }
2349
- const expressions = inputs.map((rank, index) => requireRank(rank, `Min operand ${index}`));
2400
+ const expressions = inputs.map(
2401
+ (rank, index) => requireRank(rank, `Min operand ${index}`)
2402
+ );
2350
2403
  return MinRankExpression.create(expressions);
2351
2404
  };
2352
2405
 
@@ -2459,7 +2512,9 @@ var GroupBy = class _GroupBy {
2459
2512
  Aggregate.from(data.aggregate)
2460
2513
  );
2461
2514
  }
2462
- throw new TypeError("GroupBy input must be a GroupBy instance or plain object");
2515
+ throw new TypeError(
2516
+ "GroupBy input must be a GroupBy instance or plain object"
2517
+ );
2463
2518
  }
2464
2519
  toJSON() {
2465
2520
  return {
@@ -2568,7 +2623,9 @@ var normalizePayloadArray = (payload, count) => {
2568
2623
  if (payload.length === count) {
2569
2624
  return payload.map((item) => item ? item.slice() : null);
2570
2625
  }
2571
- const result = payload.map((item) => item ? item.slice() : null);
2626
+ const result = payload.map(
2627
+ (item) => item ? item.slice() : null
2628
+ );
2572
2629
  while (result.length < count) {
2573
2630
  result.push(null);
2574
2631
  }
@@ -2580,7 +2637,10 @@ var SearchResult = class {
2580
2637
  const payloadCount = this.ids.length;
2581
2638
  this.documents = normalizePayloadArray(response.documents, payloadCount);
2582
2639
  this.embeddings = normalizePayloadArray(response.embeddings, payloadCount);
2583
- const rawMetadatas = normalizePayloadArray(response.metadatas, payloadCount);
2640
+ const rawMetadatas = normalizePayloadArray(
2641
+ response.metadatas,
2642
+ payloadCount
2643
+ );
2584
2644
  this.metadatas = rawMetadatas.map((payload) => {
2585
2645
  if (!payload) {
2586
2646
  return null;
@@ -3285,7 +3345,9 @@ var Schema = class _Schema {
3285
3345
  validateSparseVectorConfig(config) {
3286
3346
  if (config.sourceKey !== null && config.sourceKey !== void 0 && !config.embeddingFunction) {
3287
3347
  throw new Error(
3288
- `If sourceKey is provided then embeddingFunction must also be provided since there is no default embedding function. Config: ${JSON.stringify(config)}`
3348
+ `If sourceKey is provided then embeddingFunction must also be provided since there is no default embedding function. Config: ${JSON.stringify(
3349
+ config
3350
+ )}`
3289
3351
  );
3290
3352
  }
3291
3353
  }
@@ -4094,7 +4156,7 @@ var CollectionImpl = class _CollectionImpl {
4094
4156
  uris: data.uris ?? []
4095
4157
  });
4096
4158
  }
4097
- async search(searches) {
4159
+ async search(searches, options) {
4098
4160
  const items = Array.isArray(searches) ? searches : [searches];
4099
4161
  if (items.length === 0) {
4100
4162
  throw new ChromaValueError(
@@ -4110,7 +4172,10 @@ var CollectionImpl = class _CollectionImpl {
4110
4172
  const { data } = await DefaultService.collectionSearch({
4111
4173
  client: this.apiClient,
4112
4174
  path: await this.path(),
4113
- body: { searches: payloads }
4175
+ body: {
4176
+ searches: payloads,
4177
+ read_level: options?.readLevel
4178
+ }
4114
4179
  });
4115
4180
  return new SearchResult(data);
4116
4181
  }
@@ -4244,6 +4309,13 @@ var CollectionImpl = class _CollectionImpl {
4244
4309
  }
4245
4310
  });
4246
4311
  }
4312
+ async getIndexingStatus() {
4313
+ const { data } = await DefaultService.indexingStatus({
4314
+ client: this.apiClient,
4315
+ path: await this.path()
4316
+ });
4317
+ return data;
4318
+ }
4247
4319
  };
4248
4320
 
4249
4321
  // src/next.ts
@@ -4333,7 +4405,9 @@ var chromaFetch = async (input, init) => {
4333
4405
  if (error instanceof ChromaQuotaExceededError || error instanceof ChromaClientError) {
4334
4406
  throw error;
4335
4407
  }
4336
- throw new ChromaClientError(`Unprocessable Entity: ${response.statusText}`);
4408
+ throw new ChromaClientError(
4409
+ `Unprocessable Entity: ${response.statusText}`
4410
+ );
4337
4411
  }
4338
4412
  case 429:
4339
4413
  throw new ChromaRateLimitError("Rate limit exceeded");
@@ -5000,6 +5074,7 @@ export {
5000
5074
  Mul,
5001
5075
  QueryResult,
5002
5076
  RankExpression,
5077
+ ReadLevel,
5003
5078
  Rrf,
5004
5079
  Schema,
5005
5080
  Search,
package/dist/chromadb.mjs CHANGED
@@ -24,6 +24,10 @@ if (typeof globalThis.Deno !== "undefined") {
24
24
  }
25
25
 
26
26
  // src/types.ts
27
+ var ReadLevel = {
28
+ INDEX_AND_WAL: "index_and_wal",
29
+ INDEX_ONLY: "index_only"
30
+ };
27
31
  var baseRecordSetFields = [
28
32
  "ids",
29
33
  "embeddings",
@@ -640,6 +644,15 @@ var DefaultService = class {
640
644
  }
641
645
  });
642
646
  }
647
+ /**
648
+ * Retrieves the indexing status of a collection.
649
+ */
650
+ static indexingStatus(options) {
651
+ return (options.client ?? client).get({
652
+ url: "/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/indexing_status",
653
+ ...options
654
+ });
655
+ }
643
656
  /**
644
657
  * Query a collection in a variety of ways, including vector search, metadata filtering, and full-text search
645
658
  */
@@ -1636,7 +1649,9 @@ var WhereExpression = class _WhereExpression extends WhereExpressionBase {
1636
1649
  return void 0;
1637
1650
  }
1638
1651
  if (!isPlainObject(input)) {
1639
- throw new TypeError("Where input must be a WhereExpression or plain object");
1652
+ throw new TypeError(
1653
+ "Where input must be a WhereExpression or plain object"
1654
+ );
1640
1655
  }
1641
1656
  return parseWhereDict(input);
1642
1657
  }
@@ -1722,7 +1737,10 @@ var comparisonOperatorMap = /* @__PURE__ */ new Map([
1722
1737
  ["$in", (key, value) => new ComparisonWhere(key, "$in", value)],
1723
1738
  ["$nin", (key, value) => new ComparisonWhere(key, "$nin", value)],
1724
1739
  ["$contains", (key, value) => new ComparisonWhere(key, "$contains", value)],
1725
- ["$not_contains", (key, value) => new ComparisonWhere(key, "$not_contains", value)],
1740
+ [
1741
+ "$not_contains",
1742
+ (key, value) => new ComparisonWhere(key, "$not_contains", value)
1743
+ ],
1726
1744
  ["$regex", (key, value) => new ComparisonWhere(key, "$regex", value)],
1727
1745
  ["$not_regex", (key, value) => new ComparisonWhere(key, "$not_regex", value)]
1728
1746
  ]);
@@ -1745,7 +1763,10 @@ var parseWhereDict = (data) => {
1745
1763
  if (conditions.length === 1) {
1746
1764
  return conditions[0];
1747
1765
  }
1748
- return conditions.slice(1).reduce((acc, condition) => AndWhere.combine(acc, condition), conditions[0]);
1766
+ return conditions.slice(1).reduce(
1767
+ (acc, condition) => AndWhere.combine(acc, condition),
1768
+ conditions[0]
1769
+ );
1749
1770
  }
1750
1771
  if ("$or" in data) {
1751
1772
  if (Object.keys(data).length !== 1) {
@@ -1765,7 +1786,10 @@ var parseWhereDict = (data) => {
1765
1786
  if (conditions.length === 1) {
1766
1787
  return conditions[0];
1767
1788
  }
1768
- return conditions.slice(1).reduce((acc, condition) => OrWhere.combine(acc, condition), conditions[0]);
1789
+ return conditions.slice(1).reduce(
1790
+ (acc, condition) => OrWhere.combine(acc, condition),
1791
+ conditions[0]
1792
+ );
1769
1793
  }
1770
1794
  const entries = Object.entries(data);
1771
1795
  if (entries.length !== 1) {
@@ -1777,7 +1801,9 @@ var parseWhereDict = (data) => {
1777
1801
  }
1778
1802
  const operatorEntries = Object.entries(value);
1779
1803
  if (operatorEntries.length !== 1) {
1780
- throw new Error(`Operator dictionary for field "${field}" must contain exactly one operator`);
1804
+ throw new Error(
1805
+ `Operator dictionary for field "${field}" must contain exactly one operator`
1806
+ );
1781
1807
  }
1782
1808
  const [operator, operand] = operatorEntries[0];
1783
1809
  const factory = comparisonOperatorMap.get(operator);
@@ -1972,7 +1998,9 @@ var RankExpressionBase = class {
1972
1998
  }
1973
1999
  const expressions = [
1974
2000
  this,
1975
- ...others.map((item, index) => requireRank(item, `multiply operand ${index}`))
2001
+ ...others.map(
2002
+ (item, index) => requireRank(item, `multiply operand ${index}`)
2003
+ )
1976
2004
  ];
1977
2005
  return MulRankExpression.create(expressions);
1978
2006
  }
@@ -2029,7 +2057,9 @@ var RankExpression = class _RankExpression extends RankExpressionBase {
2029
2057
  if (isPlainObject(input)) {
2030
2058
  return new RawRankExpression(input);
2031
2059
  }
2032
- throw new TypeError("Rank input must be a RankExpression, number, or plain object");
2060
+ throw new TypeError(
2061
+ "Rank input must be a RankExpression, number, or plain object"
2062
+ );
2033
2063
  }
2034
2064
  };
2035
2065
  var RawRankExpression = class extends RankExpression {
@@ -2285,14 +2315,21 @@ var requireRank = (input, context) => {
2285
2315
  };
2286
2316
  var Val = (value) => new ValueRankExpression(requireNumber(value, "Val requires a numeric value"));
2287
2317
  var Knn = (options) => new KnnRankExpression(normalizeKnnOptions(options));
2288
- var Rrf = ({ ranks, k = 60, weights, normalize = false }) => {
2318
+ var Rrf = ({
2319
+ ranks,
2320
+ k = 60,
2321
+ weights,
2322
+ normalize = false
2323
+ }) => {
2289
2324
  if (!Number.isInteger(k) || k <= 0) {
2290
2325
  throw new TypeError("Rrf k must be a positive integer");
2291
2326
  }
2292
2327
  if (!Array.isArray(ranks) || ranks.length === 0) {
2293
2328
  throw new TypeError("Rrf requires at least one rank expression");
2294
2329
  }
2295
- const expressions = ranks.map((rank, index) => requireRank(rank, `ranks[${index}]`));
2330
+ const expressions = ranks.map(
2331
+ (rank, index) => requireRank(rank, `ranks[${index}]`)
2332
+ );
2296
2333
  let weightValues = weights ? weights.slice() : new Array(expressions.length).fill(1);
2297
2334
  if (weightValues.length !== expressions.length) {
2298
2335
  throw new Error("Number of weights must match number of ranks");
@@ -2303,7 +2340,9 @@ var Rrf = ({ ranks, k = 60, weights, normalize = false }) => {
2303
2340
  if (normalize) {
2304
2341
  const total = weightValues.reduce((sum, value) => sum + value, 0);
2305
2342
  if (total <= 0) {
2306
- throw new Error("Weights must sum to a positive value when normalize=true");
2343
+ throw new Error(
2344
+ "Weights must sum to a positive value when normalize=true"
2345
+ );
2307
2346
  }
2308
2347
  weightValues = weightValues.map((value) => value / total);
2309
2348
  }
@@ -2320,18 +2359,28 @@ var Sum = (...inputs) => {
2320
2359
  if (inputs.length === 0) {
2321
2360
  throw new Error("Sum requires at least one rank expression");
2322
2361
  }
2323
- const expressions = inputs.map((rank, index) => requireRank(rank, `Sum operand ${index}`));
2362
+ const expressions = inputs.map(
2363
+ (rank, index) => requireRank(rank, `Sum operand ${index}`)
2364
+ );
2324
2365
  return SumRankExpression.create(expressions);
2325
2366
  };
2326
- var Sub = (left, right) => new SubRankExpression(requireRank(left, "Sub left"), requireRank(right, "Sub right"));
2367
+ var Sub = (left, right) => new SubRankExpression(
2368
+ requireRank(left, "Sub left"),
2369
+ requireRank(right, "Sub right")
2370
+ );
2327
2371
  var Mul = (...inputs) => {
2328
2372
  if (inputs.length === 0) {
2329
2373
  throw new Error("Mul requires at least one rank expression");
2330
2374
  }
2331
- const expressions = inputs.map((rank, index) => requireRank(rank, `Mul operand ${index}`));
2375
+ const expressions = inputs.map(
2376
+ (rank, index) => requireRank(rank, `Mul operand ${index}`)
2377
+ );
2332
2378
  return MulRankExpression.create(expressions);
2333
2379
  };
2334
- var Div = (left, right) => new DivRankExpression(requireRank(left, "Div left"), requireRank(right, "Div right"));
2380
+ var Div = (left, right) => new DivRankExpression(
2381
+ requireRank(left, "Div left"),
2382
+ requireRank(right, "Div right")
2383
+ );
2335
2384
  var Abs = (input) => requireRank(input, "Abs").abs();
2336
2385
  var Exp = (input) => requireRank(input, "Exp").exp();
2337
2386
  var Log = (input) => requireRank(input, "Log").log();
@@ -2339,14 +2388,18 @@ var Max = (...inputs) => {
2339
2388
  if (inputs.length === 0) {
2340
2389
  throw new Error("Max requires at least one rank expression");
2341
2390
  }
2342
- const expressions = inputs.map((rank, index) => requireRank(rank, `Max operand ${index}`));
2391
+ const expressions = inputs.map(
2392
+ (rank, index) => requireRank(rank, `Max operand ${index}`)
2393
+ );
2343
2394
  return MaxRankExpression.create(expressions);
2344
2395
  };
2345
2396
  var Min = (...inputs) => {
2346
2397
  if (inputs.length === 0) {
2347
2398
  throw new Error("Min requires at least one rank expression");
2348
2399
  }
2349
- const expressions = inputs.map((rank, index) => requireRank(rank, `Min operand ${index}`));
2400
+ const expressions = inputs.map(
2401
+ (rank, index) => requireRank(rank, `Min operand ${index}`)
2402
+ );
2350
2403
  return MinRankExpression.create(expressions);
2351
2404
  };
2352
2405
 
@@ -2459,7 +2512,9 @@ var GroupBy = class _GroupBy {
2459
2512
  Aggregate.from(data.aggregate)
2460
2513
  );
2461
2514
  }
2462
- throw new TypeError("GroupBy input must be a GroupBy instance or plain object");
2515
+ throw new TypeError(
2516
+ "GroupBy input must be a GroupBy instance or plain object"
2517
+ );
2463
2518
  }
2464
2519
  toJSON() {
2465
2520
  return {
@@ -2568,7 +2623,9 @@ var normalizePayloadArray = (payload, count) => {
2568
2623
  if (payload.length === count) {
2569
2624
  return payload.map((item) => item ? item.slice() : null);
2570
2625
  }
2571
- const result = payload.map((item) => item ? item.slice() : null);
2626
+ const result = payload.map(
2627
+ (item) => item ? item.slice() : null
2628
+ );
2572
2629
  while (result.length < count) {
2573
2630
  result.push(null);
2574
2631
  }
@@ -2580,7 +2637,10 @@ var SearchResult = class {
2580
2637
  const payloadCount = this.ids.length;
2581
2638
  this.documents = normalizePayloadArray(response.documents, payloadCount);
2582
2639
  this.embeddings = normalizePayloadArray(response.embeddings, payloadCount);
2583
- const rawMetadatas = normalizePayloadArray(response.metadatas, payloadCount);
2640
+ const rawMetadatas = normalizePayloadArray(
2641
+ response.metadatas,
2642
+ payloadCount
2643
+ );
2584
2644
  this.metadatas = rawMetadatas.map((payload) => {
2585
2645
  if (!payload) {
2586
2646
  return null;
@@ -3285,7 +3345,9 @@ var Schema = class _Schema {
3285
3345
  validateSparseVectorConfig(config) {
3286
3346
  if (config.sourceKey !== null && config.sourceKey !== void 0 && !config.embeddingFunction) {
3287
3347
  throw new Error(
3288
- `If sourceKey is provided then embeddingFunction must also be provided since there is no default embedding function. Config: ${JSON.stringify(config)}`
3348
+ `If sourceKey is provided then embeddingFunction must also be provided since there is no default embedding function. Config: ${JSON.stringify(
3349
+ config
3350
+ )}`
3289
3351
  );
3290
3352
  }
3291
3353
  }
@@ -4094,7 +4156,7 @@ var CollectionImpl = class _CollectionImpl {
4094
4156
  uris: data.uris ?? []
4095
4157
  });
4096
4158
  }
4097
- async search(searches) {
4159
+ async search(searches, options) {
4098
4160
  const items = Array.isArray(searches) ? searches : [searches];
4099
4161
  if (items.length === 0) {
4100
4162
  throw new ChromaValueError(
@@ -4110,7 +4172,10 @@ var CollectionImpl = class _CollectionImpl {
4110
4172
  const { data } = await DefaultService.collectionSearch({
4111
4173
  client: this.apiClient,
4112
4174
  path: await this.path(),
4113
- body: { searches: payloads }
4175
+ body: {
4176
+ searches: payloads,
4177
+ read_level: options?.readLevel
4178
+ }
4114
4179
  });
4115
4180
  return new SearchResult(data);
4116
4181
  }
@@ -4244,6 +4309,13 @@ var CollectionImpl = class _CollectionImpl {
4244
4309
  }
4245
4310
  });
4246
4311
  }
4312
+ async getIndexingStatus() {
4313
+ const { data } = await DefaultService.indexingStatus({
4314
+ client: this.apiClient,
4315
+ path: await this.path()
4316
+ });
4317
+ return data;
4318
+ }
4247
4319
  };
4248
4320
 
4249
4321
  // src/next.ts
@@ -4333,7 +4405,9 @@ var chromaFetch = async (input, init) => {
4333
4405
  if (error instanceof ChromaQuotaExceededError || error instanceof ChromaClientError) {
4334
4406
  throw error;
4335
4407
  }
4336
- throw new ChromaClientError(`Unprocessable Entity: ${response.statusText}`);
4408
+ throw new ChromaClientError(
4409
+ `Unprocessable Entity: ${response.statusText}`
4410
+ );
4337
4411
  }
4338
4412
  case 429:
4339
4413
  throw new ChromaRateLimitError("Rate limit exceeded");
@@ -5000,6 +5074,7 @@ export {
5000
5074
  Mul,
5001
5075
  QueryResult,
5002
5076
  RankExpression,
5077
+ ReadLevel,
5003
5078
  Rrf,
5004
5079
  Schema,
5005
5080
  Search,