chromadb 3.3.0 → 3.3.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.
@@ -20,6 +20,9 @@ type Database = {
20
20
  name: string;
21
21
  tenant: string;
22
22
  };
23
+ type DeleteCollectionRecordsResponse = {
24
+ deleted?: number;
25
+ };
23
26
  type EmbeddingFunctionConfiguration = {
24
27
  type: 'legacy';
25
28
  } | (EmbeddingFunctionNewConfiguration & {
@@ -177,6 +180,10 @@ type IntValueType$1 = {
177
180
  type Key$1 = 'Document' | 'Embedding' | 'Metadata' | 'Score' | {
178
181
  MetadataField: string;
179
182
  };
183
+ /**
184
+ * Quantization implementation for SPANN vector index.
185
+ */
186
+ type Quantization = 'none' | 'four_bit_rabit_q_with_u_search';
180
187
  /**
181
188
  * Schema representation for collection index configurations
182
189
  *
@@ -263,9 +270,9 @@ type SpannIndexConfig = {
263
270
  num_centers_to_merge_to?: number | null;
264
271
  num_samples_kmeans?: number | null;
265
272
  /**
266
- * Enable quantization for vector search (cloud-only feature)
273
+ * Quantization implementation for vector search (cloud-only feature)
267
274
  */
268
- quantize?: boolean;
275
+ quantize?: Quantization;
269
276
  reassign_neighbor_count?: number | null;
270
277
  search_nprobe?: number | null;
271
278
  search_rng_epsilon?: number | null;
@@ -602,6 +609,10 @@ declare class QueryResult<TMeta extends Metadata = Metadata> {
602
609
  */
603
610
  rows(): QueryRowResult<TMeta>[][];
604
611
  }
612
+ /**
613
+ * Result of a delete operation.
614
+ */
615
+ type DeleteResult = DeleteCollectionRecordsResponse;
605
616
  /**
606
617
  * Re-export IndexStatusResponse type for external use
607
618
  */
@@ -1274,7 +1285,6 @@ declare class Schema {
1274
1285
  serializeToJSON(): Schema$1;
1275
1286
  static deserializeFromJSON(json: Schema$1 | JsonDict | null, client: ChromaClient): Promise<Schema | undefined>;
1276
1287
  private setVectorIndexConfig;
1277
- private setFtsIndexConfig;
1278
1288
  private setIndexInDefaults;
1279
1289
  private setIndexForKey;
1280
1290
  private enableAllIndexesForKey;
@@ -1563,8 +1573,18 @@ interface Collection {
1563
1573
  embeddingFunction?: EmbeddingFunction;
1564
1574
  /** Collection schema describing index configuration */
1565
1575
  schema?: Schema;
1566
- /** Gets the total number of records in the collection */
1567
- count(): Promise<number>;
1576
+ /**
1577
+ * Gets the total number of records in the collection.
1578
+ * @param options - Optional settings
1579
+ */
1580
+ count(options?: {
1581
+ /**
1582
+ * Controls whether to read from the write-ahead log.
1583
+ * - ReadLevel.INDEX_AND_WAL: Read from both index and WAL (default)
1584
+ * - ReadLevel.INDEX_ONLY: Read only from index, faster but recent writes may not be visible
1585
+ */
1586
+ readLevel?: ReadLevel;
1587
+ }): Promise<number>;
1568
1588
  /**
1569
1589
  * Adds new records to the collection.
1570
1590
  * @param args - Record data to add
@@ -1696,7 +1716,9 @@ interface Collection {
1696
1716
  where?: Where;
1697
1717
  /** Document content-based filtering for deletion */
1698
1718
  whereDocument?: WhereDocument;
1699
- }): Promise<void>;
1719
+ /** Maximum number of records to delete. Can only be used with where or whereDocument filters. */
1720
+ limit?: number;
1721
+ }): Promise<DeleteResult>;
1700
1722
  /**
1701
1723
  * Performs hybrid search on the collection using expression builders.
1702
1724
  * @param searches - Single search payload or array of payloads
@@ -1934,4 +1956,4 @@ declare class ChromaRateLimitError extends Error {
1934
1956
  }
1935
1957
  declare function createErrorByType(type: string, message: string): InvalidCollectionError | InvalidArgumentError | undefined;
1936
1958
 
1937
- 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, type MetadataScalar, 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 };
1959
+ 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, type DeleteResult, 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, type MetadataScalar, 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 };
@@ -1515,7 +1515,8 @@ var pythonEmbeddingFunctions = {
1515
1515
  onnx_mini_lm_l6_v2: "default-embed",
1516
1516
  default: "default-embed",
1517
1517
  together_ai: "together-ai",
1518
- sentence_transformer: "sentence-transformer"
1518
+ sentence_transformer: "sentence-transformer",
1519
+ google_genai: "google-gemini"
1519
1520
  };
1520
1521
  var unsupportedEmbeddingFunctions = /* @__PURE__ */ new Set([
1521
1522
  "amazon_bedrock",
@@ -3276,9 +3277,19 @@ var Schema = class _Schema {
3276
3277
  "Cannot enable all index types globally. Must specify either config or key."
3277
3278
  );
3278
3279
  }
3279
- if (keyProvided && key && (key === EMBEDDING_KEY || key === DOCUMENT_KEY)) {
3280
+ if (keyProvided && key && key === EMBEDDING_KEY) {
3280
3281
  throw new Error(
3281
- `Cannot create index on special key '${key}'. These keys are managed automatically by the system.`
3282
+ `Cannot create index on special key '${key}'. This key is managed automatically by the system. Invoke createIndex(new VectorIndexConfig(...)) without specifying a key to configure the vector index globally.`
3283
+ );
3284
+ }
3285
+ if (keyProvided && key === DOCUMENT_KEY && !(config instanceof FtsIndexConfig)) {
3286
+ throw new Error(
3287
+ `Cannot create index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`
3288
+ );
3289
+ }
3290
+ if (keyProvided && key && key.startsWith("#") && key !== DOCUMENT_KEY) {
3291
+ throw new Error(
3292
+ "key cannot begin with '#'. Keys starting with '#' are reserved for system use."
3282
3293
  );
3283
3294
  }
3284
3295
  if (config instanceof VectorIndexConfig) {
@@ -3287,21 +3298,17 @@ var Schema = class _Schema {
3287
3298
  return this;
3288
3299
  }
3289
3300
  throw new Error(
3290
- "Vector index cannot be enabled on specific keys. Use createIndex(config=VectorIndexConfig(...)) without specifying a key to configure the vector index globally."
3301
+ "Vector index cannot be enabled on specific keys. Use createIndex(new VectorIndexConfig(...)) without specifying a key to configure the vector index globally."
3291
3302
  );
3292
3303
  }
3293
- if (config instanceof FtsIndexConfig) {
3294
- if (!keyProvided) {
3295
- this.setFtsIndexConfig(config);
3296
- return this;
3297
- }
3304
+ if (config instanceof FtsIndexConfig && (!keyProvided || key !== DOCUMENT_KEY)) {
3298
3305
  throw new Error(
3299
- "FTS index cannot be enabled on specific keys. Use createIndex(config=FtsIndexConfig(...)) without specifying a key to configure the FTS index globally."
3306
+ "FTS index can only be enabled on #document key. Use createIndex(new FtsIndexConfig(), '#document')"
3300
3307
  );
3301
3308
  }
3302
3309
  if (config instanceof SparseVectorIndexConfig && !keyProvided) {
3303
3310
  throw new Error(
3304
- "Sparse vector index must be created on a specific key. Please specify a key using: createIndex(config=SparseVectorIndexConfig(...), key='your_key')"
3311
+ "Sparse vector index must be created on a specific key. Please specify a key using: createIndex(new SparseVectorIndexConfig(...), 'your_key')"
3305
3312
  );
3306
3313
  }
3307
3314
  if (!configProvided && keyProvided && key) {
@@ -3324,22 +3331,32 @@ var Schema = class _Schema {
3324
3331
  "Cannot disable all indexes. Must specify either config or key."
3325
3332
  );
3326
3333
  }
3327
- if (keyProvided && key && (key === EMBEDDING_KEY || key === DOCUMENT_KEY)) {
3334
+ if (keyProvided && key && key === EMBEDDING_KEY) {
3335
+ throw new Error(
3336
+ "Cannot modify #embedding. Currently not supported"
3337
+ );
3338
+ }
3339
+ if (keyProvided && key === DOCUMENT_KEY && !(config instanceof FtsIndexConfig)) {
3340
+ throw new Error(
3341
+ `Cannot delete index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`
3342
+ );
3343
+ }
3344
+ if (keyProvided && key && key.startsWith("#") && key !== DOCUMENT_KEY) {
3328
3345
  throw new Error(
3329
- `Cannot delete index on special key '${key}'. These keys are managed automatically by the system.`
3346
+ "key cannot begin with '#'. Keys starting with '#' are reserved for system use."
3330
3347
  );
3331
3348
  }
3332
3349
  if (config instanceof VectorIndexConfig) {
3333
3350
  throw new Error("Deleting vector index is not currently supported.");
3334
3351
  }
3335
- if (config instanceof FtsIndexConfig) {
3336
- throw new Error("Deleting FTS index is not currently supported.");
3337
- }
3338
3352
  if (config instanceof SparseVectorIndexConfig) {
3339
3353
  throw new Error(
3340
3354
  "Deleting sparse vector index is not currently supported."
3341
3355
  );
3342
3356
  }
3357
+ if (config instanceof FtsIndexConfig && (!keyProvided || key !== DOCUMENT_KEY)) {
3358
+ throw new Error("Deleting FTS index is only supported on #document key.");
3359
+ }
3343
3360
  if (keyProvided && !configProvided && key) {
3344
3361
  throw new Error(
3345
3362
  `Cannot disable all index types for key '${key}'. Please specify a specific index configuration.`
@@ -3423,22 +3440,6 @@ var Schema = class _Schema {
3423
3440
  })
3424
3441
  );
3425
3442
  }
3426
- setFtsIndexConfig(config) {
3427
- const defaultsString = ensureStringValueType(this.defaults);
3428
- const currentDefaultsFts = defaultsString.ftsIndex ?? new FtsIndexType(false, new FtsIndexConfig());
3429
- defaultsString.ftsIndex = new FtsIndexType(
3430
- currentDefaultsFts.enabled,
3431
- config
3432
- );
3433
- const documentValueTypes = ensureValueTypes(this.keys[DOCUMENT_KEY]);
3434
- this.keys[DOCUMENT_KEY] = documentValueTypes;
3435
- const overrideString = ensureStringValueType(documentValueTypes);
3436
- const currentOverrideFts = overrideString.ftsIndex ?? new FtsIndexType(true, new FtsIndexConfig());
3437
- overrideString.ftsIndex = new FtsIndexType(
3438
- currentOverrideFts.enabled,
3439
- config
3440
- );
3441
- }
3442
3443
  setIndexInDefaults(config, enabled) {
3443
3444
  if (config instanceof FtsIndexConfig) {
3444
3445
  const valueType = ensureStringValueType(this.defaults);
@@ -4263,15 +4264,24 @@ var CollectionImpl = class _CollectionImpl {
4263
4264
  embeddings
4264
4265
  };
4265
4266
  }
4266
- validateDelete(ids, where, whereDocument) {
4267
+ validateDelete(ids, where, whereDocument, limit) {
4267
4268
  if (ids) validateIDs(ids);
4268
4269
  if (where) validateWhere(where);
4269
4270
  if (whereDocument) validateWhereDocument(whereDocument);
4271
+ if (limit !== void 0 && (!Number.isInteger(limit) || limit < 0)) {
4272
+ throw new Error("limit must be a non-negative integer");
4273
+ }
4274
+ if (limit !== void 0 && !where && !whereDocument) {
4275
+ throw new Error(
4276
+ "limit can only be specified when a where or whereDocument clause is provided"
4277
+ );
4278
+ }
4270
4279
  }
4271
- async count() {
4280
+ async count(options) {
4272
4281
  const { data } = await RecordService.collectionCount({
4273
4282
  client: this.apiClient,
4274
- path: await this.path()
4283
+ path: await this.path(),
4284
+ query: options?.readLevel ? { read_level: options.readLevel } : void 0
4275
4285
  });
4276
4286
  return data;
4277
4287
  }
@@ -4523,18 +4533,21 @@ var CollectionImpl = class _CollectionImpl {
4523
4533
  async delete({
4524
4534
  ids,
4525
4535
  where,
4526
- whereDocument
4536
+ whereDocument,
4537
+ limit
4527
4538
  }) {
4528
- this.validateDelete(ids, where, whereDocument);
4529
- await RecordService.collectionDelete({
4539
+ this.validateDelete(ids, where, whereDocument, limit);
4540
+ const { data } = await RecordService.collectionDelete({
4530
4541
  client: this.apiClient,
4531
4542
  path: await this.path(),
4532
4543
  body: {
4533
4544
  ids,
4534
4545
  where,
4535
- where_document: whereDocument
4546
+ where_document: whereDocument,
4547
+ limit
4536
4548
  }
4537
4549
  });
4550
+ return { deleted: data?.deleted ?? 0 };
4538
4551
  }
4539
4552
  async getIndexingStatus() {
4540
4553
  const { data } = await RecordService.indexingStatus({
package/dist/chromadb.mjs CHANGED
@@ -1515,7 +1515,8 @@ var pythonEmbeddingFunctions = {
1515
1515
  onnx_mini_lm_l6_v2: "default-embed",
1516
1516
  default: "default-embed",
1517
1517
  together_ai: "together-ai",
1518
- sentence_transformer: "sentence-transformer"
1518
+ sentence_transformer: "sentence-transformer",
1519
+ google_genai: "google-gemini"
1519
1520
  };
1520
1521
  var unsupportedEmbeddingFunctions = /* @__PURE__ */ new Set([
1521
1522
  "amazon_bedrock",
@@ -3276,9 +3277,19 @@ var Schema = class _Schema {
3276
3277
  "Cannot enable all index types globally. Must specify either config or key."
3277
3278
  );
3278
3279
  }
3279
- if (keyProvided && key && (key === EMBEDDING_KEY || key === DOCUMENT_KEY)) {
3280
+ if (keyProvided && key && key === EMBEDDING_KEY) {
3280
3281
  throw new Error(
3281
- `Cannot create index on special key '${key}'. These keys are managed automatically by the system.`
3282
+ `Cannot create index on special key '${key}'. This key is managed automatically by the system. Invoke createIndex(new VectorIndexConfig(...)) without specifying a key to configure the vector index globally.`
3283
+ );
3284
+ }
3285
+ if (keyProvided && key === DOCUMENT_KEY && !(config instanceof FtsIndexConfig)) {
3286
+ throw new Error(
3287
+ `Cannot create index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`
3288
+ );
3289
+ }
3290
+ if (keyProvided && key && key.startsWith("#") && key !== DOCUMENT_KEY) {
3291
+ throw new Error(
3292
+ "key cannot begin with '#'. Keys starting with '#' are reserved for system use."
3282
3293
  );
3283
3294
  }
3284
3295
  if (config instanceof VectorIndexConfig) {
@@ -3287,21 +3298,17 @@ var Schema = class _Schema {
3287
3298
  return this;
3288
3299
  }
3289
3300
  throw new Error(
3290
- "Vector index cannot be enabled on specific keys. Use createIndex(config=VectorIndexConfig(...)) without specifying a key to configure the vector index globally."
3301
+ "Vector index cannot be enabled on specific keys. Use createIndex(new VectorIndexConfig(...)) without specifying a key to configure the vector index globally."
3291
3302
  );
3292
3303
  }
3293
- if (config instanceof FtsIndexConfig) {
3294
- if (!keyProvided) {
3295
- this.setFtsIndexConfig(config);
3296
- return this;
3297
- }
3304
+ if (config instanceof FtsIndexConfig && (!keyProvided || key !== DOCUMENT_KEY)) {
3298
3305
  throw new Error(
3299
- "FTS index cannot be enabled on specific keys. Use createIndex(config=FtsIndexConfig(...)) without specifying a key to configure the FTS index globally."
3306
+ "FTS index can only be enabled on #document key. Use createIndex(new FtsIndexConfig(), '#document')"
3300
3307
  );
3301
3308
  }
3302
3309
  if (config instanceof SparseVectorIndexConfig && !keyProvided) {
3303
3310
  throw new Error(
3304
- "Sparse vector index must be created on a specific key. Please specify a key using: createIndex(config=SparseVectorIndexConfig(...), key='your_key')"
3311
+ "Sparse vector index must be created on a specific key. Please specify a key using: createIndex(new SparseVectorIndexConfig(...), 'your_key')"
3305
3312
  );
3306
3313
  }
3307
3314
  if (!configProvided && keyProvided && key) {
@@ -3324,22 +3331,32 @@ var Schema = class _Schema {
3324
3331
  "Cannot disable all indexes. Must specify either config or key."
3325
3332
  );
3326
3333
  }
3327
- if (keyProvided && key && (key === EMBEDDING_KEY || key === DOCUMENT_KEY)) {
3334
+ if (keyProvided && key && key === EMBEDDING_KEY) {
3335
+ throw new Error(
3336
+ "Cannot modify #embedding. Currently not supported"
3337
+ );
3338
+ }
3339
+ if (keyProvided && key === DOCUMENT_KEY && !(config instanceof FtsIndexConfig)) {
3340
+ throw new Error(
3341
+ `Cannot delete index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`
3342
+ );
3343
+ }
3344
+ if (keyProvided && key && key.startsWith("#") && key !== DOCUMENT_KEY) {
3328
3345
  throw new Error(
3329
- `Cannot delete index on special key '${key}'. These keys are managed automatically by the system.`
3346
+ "key cannot begin with '#'. Keys starting with '#' are reserved for system use."
3330
3347
  );
3331
3348
  }
3332
3349
  if (config instanceof VectorIndexConfig) {
3333
3350
  throw new Error("Deleting vector index is not currently supported.");
3334
3351
  }
3335
- if (config instanceof FtsIndexConfig) {
3336
- throw new Error("Deleting FTS index is not currently supported.");
3337
- }
3338
3352
  if (config instanceof SparseVectorIndexConfig) {
3339
3353
  throw new Error(
3340
3354
  "Deleting sparse vector index is not currently supported."
3341
3355
  );
3342
3356
  }
3357
+ if (config instanceof FtsIndexConfig && (!keyProvided || key !== DOCUMENT_KEY)) {
3358
+ throw new Error("Deleting FTS index is only supported on #document key.");
3359
+ }
3343
3360
  if (keyProvided && !configProvided && key) {
3344
3361
  throw new Error(
3345
3362
  `Cannot disable all index types for key '${key}'. Please specify a specific index configuration.`
@@ -3423,22 +3440,6 @@ var Schema = class _Schema {
3423
3440
  })
3424
3441
  );
3425
3442
  }
3426
- setFtsIndexConfig(config) {
3427
- const defaultsString = ensureStringValueType(this.defaults);
3428
- const currentDefaultsFts = defaultsString.ftsIndex ?? new FtsIndexType(false, new FtsIndexConfig());
3429
- defaultsString.ftsIndex = new FtsIndexType(
3430
- currentDefaultsFts.enabled,
3431
- config
3432
- );
3433
- const documentValueTypes = ensureValueTypes(this.keys[DOCUMENT_KEY]);
3434
- this.keys[DOCUMENT_KEY] = documentValueTypes;
3435
- const overrideString = ensureStringValueType(documentValueTypes);
3436
- const currentOverrideFts = overrideString.ftsIndex ?? new FtsIndexType(true, new FtsIndexConfig());
3437
- overrideString.ftsIndex = new FtsIndexType(
3438
- currentOverrideFts.enabled,
3439
- config
3440
- );
3441
- }
3442
3443
  setIndexInDefaults(config, enabled) {
3443
3444
  if (config instanceof FtsIndexConfig) {
3444
3445
  const valueType = ensureStringValueType(this.defaults);
@@ -4263,15 +4264,24 @@ var CollectionImpl = class _CollectionImpl {
4263
4264
  embeddings
4264
4265
  };
4265
4266
  }
4266
- validateDelete(ids, where, whereDocument) {
4267
+ validateDelete(ids, where, whereDocument, limit) {
4267
4268
  if (ids) validateIDs(ids);
4268
4269
  if (where) validateWhere(where);
4269
4270
  if (whereDocument) validateWhereDocument(whereDocument);
4271
+ if (limit !== void 0 && (!Number.isInteger(limit) || limit < 0)) {
4272
+ throw new Error("limit must be a non-negative integer");
4273
+ }
4274
+ if (limit !== void 0 && !where && !whereDocument) {
4275
+ throw new Error(
4276
+ "limit can only be specified when a where or whereDocument clause is provided"
4277
+ );
4278
+ }
4270
4279
  }
4271
- async count() {
4280
+ async count(options) {
4272
4281
  const { data } = await RecordService.collectionCount({
4273
4282
  client: this.apiClient,
4274
- path: await this.path()
4283
+ path: await this.path(),
4284
+ query: options?.readLevel ? { read_level: options.readLevel } : void 0
4275
4285
  });
4276
4286
  return data;
4277
4287
  }
@@ -4523,18 +4533,21 @@ var CollectionImpl = class _CollectionImpl {
4523
4533
  async delete({
4524
4534
  ids,
4525
4535
  where,
4526
- whereDocument
4536
+ whereDocument,
4537
+ limit
4527
4538
  }) {
4528
- this.validateDelete(ids, where, whereDocument);
4529
- await RecordService.collectionDelete({
4539
+ this.validateDelete(ids, where, whereDocument, limit);
4540
+ const { data } = await RecordService.collectionDelete({
4530
4541
  client: this.apiClient,
4531
4542
  path: await this.path(),
4532
4543
  body: {
4533
4544
  ids,
4534
4545
  where,
4535
- where_document: whereDocument
4546
+ where_document: whereDocument,
4547
+ limit
4536
4548
  }
4537
4549
  });
4550
+ return { deleted: data?.deleted ?? 0 };
4538
4551
  }
4539
4552
  async getIndexingStatus() {
4540
4553
  const { data } = await RecordService.indexingStatus({