chromadb 3.3.1 → 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.
- package/dist/chromadb.d.ts +29 -7
- package/dist/chromadb.legacy-esm.js +52 -39
- package/dist/chromadb.mjs +52 -39
- package/dist/chromadb.mjs.map +1 -1
- package/dist/cjs/chromadb.cjs +52 -39
- package/dist/cjs/chromadb.cjs.map +1 -1
- package/dist/cjs/chromadb.d.cts +29 -7
- package/package.json +1 -1
- package/src/api/sdk.gen.ts +2 -2
- package/src/api/types.gen.ts +13 -3
- package/src/collection.ts +41 -13
- package/src/embedding-function.ts +1 -0
- package/src/schema.ts +0 -14
- package/src/types.ts +6 -0
package/dist/cjs/chromadb.cjs
CHANGED
|
@@ -1634,7 +1634,8 @@ var pythonEmbeddingFunctions = {
|
|
|
1634
1634
|
onnx_mini_lm_l6_v2: "default-embed",
|
|
1635
1635
|
default: "default-embed",
|
|
1636
1636
|
together_ai: "together-ai",
|
|
1637
|
-
sentence_transformer: "sentence-transformer"
|
|
1637
|
+
sentence_transformer: "sentence-transformer",
|
|
1638
|
+
google_genai: "google-gemini"
|
|
1638
1639
|
};
|
|
1639
1640
|
var unsupportedEmbeddingFunctions = /* @__PURE__ */ new Set([
|
|
1640
1641
|
"amazon_bedrock",
|
|
@@ -3395,9 +3396,19 @@ var Schema = class _Schema {
|
|
|
3395
3396
|
"Cannot enable all index types globally. Must specify either config or key."
|
|
3396
3397
|
);
|
|
3397
3398
|
}
|
|
3398
|
-
if (keyProvided && key &&
|
|
3399
|
+
if (keyProvided && key && key === EMBEDDING_KEY) {
|
|
3399
3400
|
throw new Error(
|
|
3400
|
-
`Cannot create index on special key '${key}'.
|
|
3401
|
+
`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.`
|
|
3402
|
+
);
|
|
3403
|
+
}
|
|
3404
|
+
if (keyProvided && key === DOCUMENT_KEY && !(config instanceof FtsIndexConfig)) {
|
|
3405
|
+
throw new Error(
|
|
3406
|
+
`Cannot create index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`
|
|
3407
|
+
);
|
|
3408
|
+
}
|
|
3409
|
+
if (keyProvided && key && key.startsWith("#") && key !== DOCUMENT_KEY) {
|
|
3410
|
+
throw new Error(
|
|
3411
|
+
"key cannot begin with '#'. Keys starting with '#' are reserved for system use."
|
|
3401
3412
|
);
|
|
3402
3413
|
}
|
|
3403
3414
|
if (config instanceof VectorIndexConfig) {
|
|
@@ -3406,21 +3417,17 @@ var Schema = class _Schema {
|
|
|
3406
3417
|
return this;
|
|
3407
3418
|
}
|
|
3408
3419
|
throw new Error(
|
|
3409
|
-
"Vector index cannot be enabled on specific keys. Use createIndex(
|
|
3420
|
+
"Vector index cannot be enabled on specific keys. Use createIndex(new VectorIndexConfig(...)) without specifying a key to configure the vector index globally."
|
|
3410
3421
|
);
|
|
3411
3422
|
}
|
|
3412
|
-
if (config instanceof FtsIndexConfig) {
|
|
3413
|
-
if (!keyProvided) {
|
|
3414
|
-
this.setFtsIndexConfig(config);
|
|
3415
|
-
return this;
|
|
3416
|
-
}
|
|
3423
|
+
if (config instanceof FtsIndexConfig && (!keyProvided || key !== DOCUMENT_KEY)) {
|
|
3417
3424
|
throw new Error(
|
|
3418
|
-
"FTS index
|
|
3425
|
+
"FTS index can only be enabled on #document key. Use createIndex(new FtsIndexConfig(), '#document')"
|
|
3419
3426
|
);
|
|
3420
3427
|
}
|
|
3421
3428
|
if (config instanceof SparseVectorIndexConfig && !keyProvided) {
|
|
3422
3429
|
throw new Error(
|
|
3423
|
-
"Sparse vector index must be created on a specific key. Please specify a key using: createIndex(
|
|
3430
|
+
"Sparse vector index must be created on a specific key. Please specify a key using: createIndex(new SparseVectorIndexConfig(...), 'your_key')"
|
|
3424
3431
|
);
|
|
3425
3432
|
}
|
|
3426
3433
|
if (!configProvided && keyProvided && key) {
|
|
@@ -3443,22 +3450,32 @@ var Schema = class _Schema {
|
|
|
3443
3450
|
"Cannot disable all indexes. Must specify either config or key."
|
|
3444
3451
|
);
|
|
3445
3452
|
}
|
|
3446
|
-
if (keyProvided && key &&
|
|
3453
|
+
if (keyProvided && key && key === EMBEDDING_KEY) {
|
|
3454
|
+
throw new Error(
|
|
3455
|
+
"Cannot modify #embedding. Currently not supported"
|
|
3456
|
+
);
|
|
3457
|
+
}
|
|
3458
|
+
if (keyProvided && key === DOCUMENT_KEY && !(config instanceof FtsIndexConfig)) {
|
|
3459
|
+
throw new Error(
|
|
3460
|
+
`Cannot delete index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`
|
|
3461
|
+
);
|
|
3462
|
+
}
|
|
3463
|
+
if (keyProvided && key && key.startsWith("#") && key !== DOCUMENT_KEY) {
|
|
3447
3464
|
throw new Error(
|
|
3448
|
-
|
|
3465
|
+
"key cannot begin with '#'. Keys starting with '#' are reserved for system use."
|
|
3449
3466
|
);
|
|
3450
3467
|
}
|
|
3451
3468
|
if (config instanceof VectorIndexConfig) {
|
|
3452
3469
|
throw new Error("Deleting vector index is not currently supported.");
|
|
3453
3470
|
}
|
|
3454
|
-
if (config instanceof FtsIndexConfig) {
|
|
3455
|
-
throw new Error("Deleting FTS index is not currently supported.");
|
|
3456
|
-
}
|
|
3457
3471
|
if (config instanceof SparseVectorIndexConfig) {
|
|
3458
3472
|
throw new Error(
|
|
3459
3473
|
"Deleting sparse vector index is not currently supported."
|
|
3460
3474
|
);
|
|
3461
3475
|
}
|
|
3476
|
+
if (config instanceof FtsIndexConfig && (!keyProvided || key !== DOCUMENT_KEY)) {
|
|
3477
|
+
throw new Error("Deleting FTS index is only supported on #document key.");
|
|
3478
|
+
}
|
|
3462
3479
|
if (keyProvided && !configProvided && key) {
|
|
3463
3480
|
throw new Error(
|
|
3464
3481
|
`Cannot disable all index types for key '${key}'. Please specify a specific index configuration.`
|
|
@@ -3542,22 +3559,6 @@ var Schema = class _Schema {
|
|
|
3542
3559
|
})
|
|
3543
3560
|
);
|
|
3544
3561
|
}
|
|
3545
|
-
setFtsIndexConfig(config) {
|
|
3546
|
-
const defaultsString = ensureStringValueType(this.defaults);
|
|
3547
|
-
const currentDefaultsFts = defaultsString.ftsIndex ?? new FtsIndexType(false, new FtsIndexConfig());
|
|
3548
|
-
defaultsString.ftsIndex = new FtsIndexType(
|
|
3549
|
-
currentDefaultsFts.enabled,
|
|
3550
|
-
config
|
|
3551
|
-
);
|
|
3552
|
-
const documentValueTypes = ensureValueTypes(this.keys[DOCUMENT_KEY]);
|
|
3553
|
-
this.keys[DOCUMENT_KEY] = documentValueTypes;
|
|
3554
|
-
const overrideString = ensureStringValueType(documentValueTypes);
|
|
3555
|
-
const currentOverrideFts = overrideString.ftsIndex ?? new FtsIndexType(true, new FtsIndexConfig());
|
|
3556
|
-
overrideString.ftsIndex = new FtsIndexType(
|
|
3557
|
-
currentOverrideFts.enabled,
|
|
3558
|
-
config
|
|
3559
|
-
);
|
|
3560
|
-
}
|
|
3561
3562
|
setIndexInDefaults(config, enabled) {
|
|
3562
3563
|
if (config instanceof FtsIndexConfig) {
|
|
3563
3564
|
const valueType = ensureStringValueType(this.defaults);
|
|
@@ -4382,15 +4383,24 @@ var CollectionImpl = class _CollectionImpl {
|
|
|
4382
4383
|
embeddings
|
|
4383
4384
|
};
|
|
4384
4385
|
}
|
|
4385
|
-
validateDelete(ids, where, whereDocument) {
|
|
4386
|
+
validateDelete(ids, where, whereDocument, limit) {
|
|
4386
4387
|
if (ids) validateIDs(ids);
|
|
4387
4388
|
if (where) validateWhere(where);
|
|
4388
4389
|
if (whereDocument) validateWhereDocument(whereDocument);
|
|
4390
|
+
if (limit !== void 0 && (!Number.isInteger(limit) || limit < 0)) {
|
|
4391
|
+
throw new Error("limit must be a non-negative integer");
|
|
4392
|
+
}
|
|
4393
|
+
if (limit !== void 0 && !where && !whereDocument) {
|
|
4394
|
+
throw new Error(
|
|
4395
|
+
"limit can only be specified when a where or whereDocument clause is provided"
|
|
4396
|
+
);
|
|
4397
|
+
}
|
|
4389
4398
|
}
|
|
4390
|
-
async count() {
|
|
4399
|
+
async count(options) {
|
|
4391
4400
|
const { data } = await RecordService.collectionCount({
|
|
4392
4401
|
client: this.apiClient,
|
|
4393
|
-
path: await this.path()
|
|
4402
|
+
path: await this.path(),
|
|
4403
|
+
query: options?.readLevel ? { read_level: options.readLevel } : void 0
|
|
4394
4404
|
});
|
|
4395
4405
|
return data;
|
|
4396
4406
|
}
|
|
@@ -4642,18 +4652,21 @@ var CollectionImpl = class _CollectionImpl {
|
|
|
4642
4652
|
async delete({
|
|
4643
4653
|
ids,
|
|
4644
4654
|
where,
|
|
4645
|
-
whereDocument
|
|
4655
|
+
whereDocument,
|
|
4656
|
+
limit
|
|
4646
4657
|
}) {
|
|
4647
|
-
this.validateDelete(ids, where, whereDocument);
|
|
4648
|
-
await RecordService.collectionDelete({
|
|
4658
|
+
this.validateDelete(ids, where, whereDocument, limit);
|
|
4659
|
+
const { data } = await RecordService.collectionDelete({
|
|
4649
4660
|
client: this.apiClient,
|
|
4650
4661
|
path: await this.path(),
|
|
4651
4662
|
body: {
|
|
4652
4663
|
ids,
|
|
4653
4664
|
where,
|
|
4654
|
-
where_document: whereDocument
|
|
4665
|
+
where_document: whereDocument,
|
|
4666
|
+
limit
|
|
4655
4667
|
}
|
|
4656
4668
|
});
|
|
4669
|
+
return { deleted: data?.deleted ?? 0 };
|
|
4657
4670
|
}
|
|
4658
4671
|
async getIndexingStatus() {
|
|
4659
4672
|
const { data } = await RecordService.indexingStatus({
|