chromadb 3.1.4 → 3.1.5

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.
@@ -1009,6 +1009,7 @@ declare class Schema {
1009
1009
  private enableAllIndexesForKey;
1010
1010
  private disableAllIndexesForKey;
1011
1011
  private validateSingleSparseVectorIndex;
1012
+ private validateSparseVectorConfig;
1012
1013
  private initializeDefaults;
1013
1014
  private initializeKeys;
1014
1015
  private serializeValueTypes;
@@ -1286,7 +1286,8 @@ var knownEmbeddingFunctions = /* @__PURE__ */ new Map();
1286
1286
  var pythonEmbeddingFunctions = {
1287
1287
  onnx_mini_lm_l6_v2: "default-embed",
1288
1288
  default: "default-embed",
1289
- together_ai: "together-ai"
1289
+ together_ai: "together-ai",
1290
+ sentence_transformer: "sentence-transformer"
1290
1291
  };
1291
1292
  var unsupportedEmbeddingFunctions = /* @__PURE__ */ new Set([
1292
1293
  "amazon_bedrock",
@@ -1297,7 +1298,6 @@ var unsupportedEmbeddingFunctions = /* @__PURE__ */ new Set([
1297
1298
  "instructor",
1298
1299
  "open_clip",
1299
1300
  "roboflow",
1300
- "sentence_transformer",
1301
1301
  "text2vec"
1302
1302
  ]);
1303
1303
  var knownSparseEmbeddingFunctions = /* @__PURE__ */ new Map();
@@ -2754,8 +2754,9 @@ var Schema = class _Schema {
2754
2754
  );
2755
2755
  }
2756
2756
  if (!configProvided && keyProvided && key) {
2757
- this.enableAllIndexesForKey(key);
2758
- return this;
2757
+ throw new Error(
2758
+ `Cannot enable all index types for key '${key}'. Please specify a specific index configuration.`
2759
+ );
2759
2760
  }
2760
2761
  if (configProvided && !keyProvided) {
2761
2762
  this.setIndexInDefaults(config, true);
@@ -2789,8 +2790,9 @@ var Schema = class _Schema {
2789
2790
  );
2790
2791
  }
2791
2792
  if (keyProvided && !configProvided && key) {
2792
- this.disableAllIndexesForKey(key);
2793
- return this;
2793
+ throw new Error(
2794
+ `Cannot disable all index types for key '${key}'. Please specify a specific index configuration.`
2795
+ );
2794
2796
  }
2795
2797
  if (keyProvided && configProvided && key) {
2796
2798
  this.setIndexForKey(key, config, false);
@@ -2907,6 +2909,7 @@ var Schema = class _Schema {
2907
2909
  setIndexForKey(key, config, enabled) {
2908
2910
  if (config instanceof SparseVectorIndexConfig && enabled) {
2909
2911
  this.validateSingleSparseVectorIndex(key);
2912
+ this.validateSparseVectorConfig(config);
2910
2913
  }
2911
2914
  const current = this.keys[key] = ensureValueTypes(this.keys[key]);
2912
2915
  if (config instanceof StringInvertedIndexConfig) {
@@ -2953,7 +2956,7 @@ var Schema = class _Schema {
2953
2956
  new VectorIndexType(true, new VectorIndexConfig())
2954
2957
  );
2955
2958
  current.sparseVector = new SparseVectorValueType(
2956
- new SparseVectorIndexType(true, new SparseVectorIndexConfig())
2959
+ new SparseVectorIndexType(false, new SparseVectorIndexConfig())
2957
2960
  );
2958
2961
  current.intValue = new IntValueType(
2959
2962
  new IntInvertedIndexType(true, new IntInvertedIndexConfig())
@@ -3003,6 +3006,13 @@ var Schema = class _Schema {
3003
3006
  }
3004
3007
  }
3005
3008
  }
3009
+ validateSparseVectorConfig(config) {
3010
+ if (config.sourceKey !== null && config.sourceKey !== void 0 && !config.embeddingFunction) {
3011
+ throw new Error(
3012
+ `If sourceKey is provided then embeddingFunction must also be provided since there is no default embedding function. Config: ${JSON.stringify(config)}`
3013
+ );
3014
+ }
3015
+ }
3006
3016
  initializeDefaults() {
3007
3017
  this.defaults.string = new StringValueType(
3008
3018
  new FtsIndexType(false, new FtsIndexConfig()),
package/dist/chromadb.mjs CHANGED
@@ -1286,7 +1286,8 @@ var knownEmbeddingFunctions = /* @__PURE__ */ new Map();
1286
1286
  var pythonEmbeddingFunctions = {
1287
1287
  onnx_mini_lm_l6_v2: "default-embed",
1288
1288
  default: "default-embed",
1289
- together_ai: "together-ai"
1289
+ together_ai: "together-ai",
1290
+ sentence_transformer: "sentence-transformer"
1290
1291
  };
1291
1292
  var unsupportedEmbeddingFunctions = /* @__PURE__ */ new Set([
1292
1293
  "amazon_bedrock",
@@ -1297,7 +1298,6 @@ var unsupportedEmbeddingFunctions = /* @__PURE__ */ new Set([
1297
1298
  "instructor",
1298
1299
  "open_clip",
1299
1300
  "roboflow",
1300
- "sentence_transformer",
1301
1301
  "text2vec"
1302
1302
  ]);
1303
1303
  var knownSparseEmbeddingFunctions = /* @__PURE__ */ new Map();
@@ -2754,8 +2754,9 @@ var Schema = class _Schema {
2754
2754
  );
2755
2755
  }
2756
2756
  if (!configProvided && keyProvided && key) {
2757
- this.enableAllIndexesForKey(key);
2758
- return this;
2757
+ throw new Error(
2758
+ `Cannot enable all index types for key '${key}'. Please specify a specific index configuration.`
2759
+ );
2759
2760
  }
2760
2761
  if (configProvided && !keyProvided) {
2761
2762
  this.setIndexInDefaults(config, true);
@@ -2789,8 +2790,9 @@ var Schema = class _Schema {
2789
2790
  );
2790
2791
  }
2791
2792
  if (keyProvided && !configProvided && key) {
2792
- this.disableAllIndexesForKey(key);
2793
- return this;
2793
+ throw new Error(
2794
+ `Cannot disable all index types for key '${key}'. Please specify a specific index configuration.`
2795
+ );
2794
2796
  }
2795
2797
  if (keyProvided && configProvided && key) {
2796
2798
  this.setIndexForKey(key, config, false);
@@ -2907,6 +2909,7 @@ var Schema = class _Schema {
2907
2909
  setIndexForKey(key, config, enabled) {
2908
2910
  if (config instanceof SparseVectorIndexConfig && enabled) {
2909
2911
  this.validateSingleSparseVectorIndex(key);
2912
+ this.validateSparseVectorConfig(config);
2910
2913
  }
2911
2914
  const current = this.keys[key] = ensureValueTypes(this.keys[key]);
2912
2915
  if (config instanceof StringInvertedIndexConfig) {
@@ -2953,7 +2956,7 @@ var Schema = class _Schema {
2953
2956
  new VectorIndexType(true, new VectorIndexConfig())
2954
2957
  );
2955
2958
  current.sparseVector = new SparseVectorValueType(
2956
- new SparseVectorIndexType(true, new SparseVectorIndexConfig())
2959
+ new SparseVectorIndexType(false, new SparseVectorIndexConfig())
2957
2960
  );
2958
2961
  current.intValue = new IntValueType(
2959
2962
  new IntInvertedIndexType(true, new IntInvertedIndexConfig())
@@ -3003,6 +3006,13 @@ var Schema = class _Schema {
3003
3006
  }
3004
3007
  }
3005
3008
  }
3009
+ validateSparseVectorConfig(config) {
3010
+ if (config.sourceKey !== null && config.sourceKey !== void 0 && !config.embeddingFunction) {
3011
+ throw new Error(
3012
+ `If sourceKey is provided then embeddingFunction must also be provided since there is no default embedding function. Config: ${JSON.stringify(config)}`
3013
+ );
3014
+ }
3015
+ }
3006
3016
  initializeDefaults() {
3007
3017
  this.defaults.string = new StringValueType(
3008
3018
  new FtsIndexType(false, new FtsIndexConfig()),