chromadb 3.4.3 → 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;
@@ -1601,6 +1626,7 @@ interface Collection {
1601
1626
  * Controls whether to read from the write-ahead log.
1602
1627
  * - ReadLevel.INDEX_AND_WAL: Read from both index and WAL (default)
1603
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
1604
1630
  */
1605
1631
  readLevel?: ReadLevel;
1606
1632
  }): Promise<number>;
@@ -1754,6 +1780,7 @@ interface Collection {
1754
1780
  * Controls whether to read from the write-ahead log.
1755
1781
  * - ReadLevel.INDEX_AND_WAL: Read from both index and WAL (default)
1756
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
1757
1784
  */
1758
1785
  readLevel?: ReadLevel;
1759
1786
  }): Promise<SearchResult>;
package/dist/cjs/cli.cjs CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chromadb",
3
- "version": "3.4.3",
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.3",
64
- "chromadb-js-bindings-darwin-x64": "^1.3.3",
65
- "chromadb-js-bindings-linux-arm64-gnu": "^1.3.3",
66
- "chromadb-js-bindings-linux-x64-gnu": "^1.3.3",
67
- "chromadb-js-bindings-win32-x64-msvc": "^1.3.3"
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, GetCollectionByIdData, GetCollectionByIdResponse, GetCollectionByIdError, 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> & {
@@ -609,6 +609,27 @@ export class RecordService {
609
609
  }
610
610
 
611
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
+
612
633
  /**
613
634
  * Detach function
614
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
  */
@@ -1530,6 +1564,52 @@ export type CollectionAddResponses = {
1530
1564
 
1531
1565
  export type CollectionAddResponse = CollectionAddResponses[keyof CollectionAddResponses];
1532
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
+
1533
1613
  export type DetachFunctionData = {
1534
1614
  body: DetachFunctionRequest;
1535
1615
  path: {
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
  },
package/src/schema.ts CHANGED
@@ -251,72 +251,72 @@ export class SparseVectorIndexConfig {
251
251
  }
252
252
 
253
253
  export class FtsIndexType {
254
- constructor(public enabled: boolean, public config: FtsIndexConfig) { }
254
+ constructor(public enabled: boolean, public config: FtsIndexConfig) {}
255
255
  }
256
256
 
257
257
  export class StringInvertedIndexType {
258
258
  constructor(
259
259
  public enabled: boolean,
260
260
  public config: StringInvertedIndexConfig,
261
- ) { }
261
+ ) {}
262
262
  }
263
263
 
264
264
  export class VectorIndexType {
265
- constructor(public enabled: boolean, public config: VectorIndexConfig) { }
265
+ constructor(public enabled: boolean, public config: VectorIndexConfig) {}
266
266
  }
267
267
 
268
268
  export class SparseVectorIndexType {
269
269
  constructor(
270
270
  public enabled: boolean,
271
271
  public config: SparseVectorIndexConfig,
272
- ) { }
272
+ ) {}
273
273
  }
274
274
 
275
275
  export class IntInvertedIndexType {
276
- constructor(public enabled: boolean, public config: IntInvertedIndexConfig) { }
276
+ constructor(public enabled: boolean, public config: IntInvertedIndexConfig) {}
277
277
  }
278
278
 
279
279
  export class FloatInvertedIndexType {
280
280
  constructor(
281
281
  public enabled: boolean,
282
282
  public config: FloatInvertedIndexConfig,
283
- ) { }
283
+ ) {}
284
284
  }
285
285
 
286
286
  export class BoolInvertedIndexType {
287
287
  constructor(
288
288
  public enabled: boolean,
289
289
  public config: BoolInvertedIndexConfig,
290
- ) { }
290
+ ) {}
291
291
  }
292
292
 
293
293
  export class StringValueType {
294
294
  constructor(
295
295
  public ftsIndex: FtsIndexType | null = null,
296
296
  public stringInvertedIndex: StringInvertedIndexType | null = null,
297
- ) { }
297
+ ) {}
298
298
  }
299
299
 
300
300
  export class FloatListValueType {
301
- constructor(public vectorIndex: VectorIndexType | null = null) { }
301
+ constructor(public vectorIndex: VectorIndexType | null = null) {}
302
302
  }
303
303
 
304
304
  export class SparseVectorValueType {
305
- constructor(public sparseVectorIndex: SparseVectorIndexType | null = null) { }
305
+ constructor(public sparseVectorIndex: SparseVectorIndexType | null = null) {}
306
306
  }
307
307
 
308
308
  export class IntValueType {
309
- constructor(public intInvertedIndex: IntInvertedIndexType | null = null) { }
309
+ constructor(public intInvertedIndex: IntInvertedIndexType | null = null) {}
310
310
  }
311
311
 
312
312
  export class FloatValueType {
313
313
  constructor(
314
314
  public floatInvertedIndex: FloatInvertedIndexType | null = null,
315
- ) { }
315
+ ) {}
316
316
  }
317
317
 
318
318
  export class BoolValueType {
319
- constructor(public boolInvertedIndex: BoolInvertedIndexType | null = null) { }
319
+ constructor(public boolInvertedIndex: BoolInvertedIndexType | null = null) {}
320
320
  }
321
321
 
322
322
  export class ValueTypes {
@@ -351,11 +351,11 @@ const cloneObject = <T>(value: T): T => {
351
351
  return Array.isArray(value)
352
352
  ? (value.map((item) => cloneObject(item)) as T)
353
353
  : (Object.fromEntries(
354
- Object.entries(value as Record<string, unknown>).map(([k, v]) => [
355
- k,
356
- cloneObject(v),
357
- ]),
358
- ) as T);
354
+ Object.entries(value as Record<string, unknown>).map(([k, v]) => [
355
+ k,
356
+ cloneObject(v),
357
+ ]),
358
+ ) as T);
359
359
  };
360
360
 
361
361
  const resolveEmbeddingFunctionName = (
@@ -520,7 +520,11 @@ export class Schema {
520
520
  }
521
521
 
522
522
  // Only allow #document with FtsIndexConfig
523
- if (keyProvided && key === DOCUMENT_KEY && !(config instanceof FtsIndexConfig)) {
523
+ if (
524
+ keyProvided &&
525
+ key === DOCUMENT_KEY &&
526
+ !(config instanceof FtsIndexConfig)
527
+ ) {
524
528
  throw new Error(
525
529
  `Cannot create index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`,
526
530
  );
@@ -545,7 +549,10 @@ export class Schema {
545
549
  }
546
550
 
547
551
  // FTS index is only allowed on #document key
548
- if (config instanceof FtsIndexConfig && (!keyProvided || key !== DOCUMENT_KEY)) {
552
+ if (
553
+ config instanceof FtsIndexConfig &&
554
+ (!keyProvided || key !== DOCUMENT_KEY)
555
+ ) {
549
556
  throw new Error(
550
557
  "FTS index can only be enabled on #document key. Use createIndex(new FtsIndexConfig(), '#document')",
551
558
  );
@@ -586,13 +593,15 @@ export class Schema {
586
593
 
587
594
  // Disallow using special internal key #embedding
588
595
  if (keyProvided && key && key === EMBEDDING_KEY) {
589
- throw new Error(
590
- "Cannot modify #embedding. Currently not supported",
591
- );
596
+ throw new Error("Cannot modify #embedding. Currently not supported");
592
597
  }
593
598
 
594
599
  // Only allow #document with FtsIndexConfig (to disable FTS)
595
- if (keyProvided && key === DOCUMENT_KEY && !(config instanceof FtsIndexConfig)) {
600
+ if (
601
+ keyProvided &&
602
+ key === DOCUMENT_KEY &&
603
+ !(config instanceof FtsIndexConfig)
604
+ ) {
596
605
  throw new Error(
597
606
  `Cannot delete index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`,
598
607
  );
@@ -619,7 +628,10 @@ export class Schema {
619
628
  }
620
629
 
621
630
  // FTS deletion is only allowed on #document key
622
- if (config instanceof FtsIndexConfig && (!keyProvided || key !== DOCUMENT_KEY)) {
631
+ if (
632
+ config instanceof FtsIndexConfig &&
633
+ (!keyProvided || key !== DOCUMENT_KEY)
634
+ ) {
623
635
  throw new Error("Deleting FTS index is only supported on #document key.");
624
636
  }
625
637
 
@@ -769,7 +781,6 @@ export class Schema {
769
781
  enabled: boolean,
770
782
  ): void {
771
783
  if (config instanceof SparseVectorIndexConfig && enabled) {
772
- this.validateSingleSparseVectorIndex(key);
773
784
  this.validateSparseVectorConfig(config);
774
785
  }
775
786
 
@@ -865,18 +876,6 @@ export class Schema {
865
876
  );
866
877
  }
867
878
 
868
- private validateSingleSparseVectorIndex(targetKey: string): void {
869
- for (const [existingKey, valueTypes] of Object.entries(this.keys)) {
870
- if (existingKey === targetKey) continue;
871
- const sparseIndex = valueTypes.sparseVector?.sparseVectorIndex;
872
- if (sparseIndex?.enabled) {
873
- throw new Error(
874
- `Cannot enable sparse vector index on key '${targetKey}'. A sparse vector index is already enabled on key '${existingKey}'. Only one sparse vector index is allowed per collection.`,
875
- );
876
- }
877
- }
878
- }
879
-
880
879
  private validateSparseVectorConfig(config: SparseVectorIndexConfig): void {
881
880
  // Validate that if source_key is provided then embedding_function is also provided
882
881
  // since there is no default embedding function
@@ -1087,7 +1086,8 @@ export class Schema {
1087
1086
  !embeddingFunction.supportedSpaces().includes(resolvedSpace)
1088
1087
  ) {
1089
1088
  console.warn(
1090
- `Space '${resolvedSpace}' is not supported by embedding function '${resolveEmbeddingFunctionName(embeddingFunction) ?? "unknown"
1089
+ `Space '${resolvedSpace}' is not supported by embedding function '${
1090
+ resolveEmbeddingFunctionName(embeddingFunction) ?? "unknown"
1091
1091
  }'. Supported spaces: ${embeddingFunction
1092
1092
  .supportedSpaces()
1093
1093
  .join(", ")}`,
package/src/types.ts CHANGED
@@ -18,10 +18,13 @@ export type UserIdentity = GetUserIdentityResponse;
18
18
  * All committed writes will be visible. This is the default.
19
19
  * - INDEX_ONLY: Read only from the compacted index, skipping the WAL.
20
20
  * Recent writes that haven't been compacted may not be visible, but queries are faster.
21
+ * - INDEX_AND_BOUNDED_WAL: Read from the index and up to a server-configured number of
22
+ * WAL entries for bounded query latency.
21
23
  */
22
24
  export const ReadLevel = {
23
25
  INDEX_AND_WAL: "index_and_wal",
24
26
  INDEX_ONLY: "index_only",
27
+ INDEX_AND_BOUNDED_WAL: "index_and_bounded_wal",
25
28
  } as const;
26
29
 
27
30
  export type ReadLevel = (typeof ReadLevel)[keyof typeof ReadLevel];