chromadb 3.1.2 → 3.1.3

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.
@@ -688,7 +688,7 @@ declare const registerSparseEmbeddingFunction: (name: string, fn: SparseEmbeddin
688
688
  * @param efConfig - Configuration for the embedding function
689
689
  * @returns EmbeddingFunction instance or undefined if it cannot be constructed
690
690
  */
691
- declare const getEmbeddingFunction: (collectionName: string, efConfig?: EmbeddingFunctionConfiguration) => Promise<EmbeddingFunction | undefined>;
691
+ declare const getEmbeddingFunction: (collectionName: string, efConfig?: EmbeddingFunctionConfiguration, debug?: boolean) => Promise<EmbeddingFunction | undefined>;
692
692
  /**
693
693
  * Retrieves and instantiates a sparse embedding function from configuration.
694
694
  * @param collectionName - Name of the collection (for error messages)
@@ -1325,7 +1325,7 @@ var registerSparseEmbeddingFunction = (name, fn) => {
1325
1325
  }
1326
1326
  knownSparseEmbeddingFunctions.set(name, fn);
1327
1327
  };
1328
- var getEmbeddingFunction = async (collectionName, efConfig) => {
1328
+ var getEmbeddingFunction = async (collectionName, efConfig, debug) => {
1329
1329
  if (!efConfig) {
1330
1330
  console.warn(
1331
1331
  `No embedding function configuration found for collection ${collectionName}. 'add' and 'query' will fail unless you provide them embeddings directly.`
@@ -1354,6 +1354,17 @@ var getEmbeddingFunction = async (collectionName, efConfig) => {
1354
1354
  return void 0;
1355
1355
  }
1356
1356
  const packageName = pythonEmbeddingFunctions[efConfig.name] || efConfig.name;
1357
+ if (debug) {
1358
+ console.log("DEBUFFING");
1359
+ console.log(packageName);
1360
+ }
1361
+ if (packageName === "default-embed") {
1362
+ console.log("INSIDE HIT");
1363
+ if (debug) {
1364
+ console.log("FROM DEBUG");
1365
+ }
1366
+ await getDefaultEFConfig();
1367
+ }
1357
1368
  let embeddingFunction = knownEmbeddingFunctions.get(packageName);
1358
1369
  if (!embeddingFunction) {
1359
1370
  try {
@@ -1364,7 +1375,7 @@ var getEmbeddingFunction = async (collectionName, efConfig) => {
1364
1375
  }
1365
1376
  if (!embeddingFunction) {
1366
1377
  console.warn(
1367
- `Collection ${collectionName} was created with the ${packageName} embedding function. However, the @chroma-core/${packageName} package is not install. 'add' and 'query' will fail unless you provide them embeddings directly, or install the @chroma-core/${packageName} package.`
1378
+ `Collection ${collectionName} was created with the ${packageName} embedding function. However, the @chroma-core/${packageName} package is not installed. 'add' and 'query' will fail unless you provide them embeddings directly, or install the @chroma-core/${packageName} package.`
1368
1379
  );
1369
1380
  return void 0;
1370
1381
  }
@@ -1459,8 +1470,8 @@ var serializeEmbeddingFunction = ({
1459
1470
  var getDefaultEFConfig = async () => {
1460
1471
  try {
1461
1472
  const { DefaultEmbeddingFunction } = await import("@chroma-core/default-embed");
1462
- if (!knownEmbeddingFunctions.has(new DefaultEmbeddingFunction().name)) {
1463
- registerEmbeddingFunction("default", DefaultEmbeddingFunction);
1473
+ if (!knownEmbeddingFunctions.has("default-embed")) {
1474
+ registerEmbeddingFunction("default-embed", DefaultEmbeddingFunction);
1464
1475
  }
1465
1476
  } catch (e) {
1466
1477
  console.warn(
@@ -3300,11 +3311,12 @@ var Schema = class _Schema {
3300
3311
  hnsw: json.hnsw ? cloneObject(json.hnsw) : null,
3301
3312
  spann: json.spann ? cloneObject(json.spann) : null
3302
3313
  });
3303
- const embeddingFunction = await getEmbeddingFunction(
3314
+ console.log("SCHEMA THING 1");
3315
+ config.embeddingFunction = await getEmbeddingFunction(
3304
3316
  "schema deserialization",
3305
- json.embedding_function
3317
+ json.embedding_function,
3318
+ true
3306
3319
  );
3307
- config.embeddingFunction = embeddingFunction;
3308
3320
  if (!config.space && config.embeddingFunction?.defaultSpace) {
3309
3321
  config.space = config.embeddingFunction.defaultSpace();
3310
3322
  }
package/dist/chromadb.mjs CHANGED
@@ -1325,7 +1325,7 @@ var registerSparseEmbeddingFunction = (name, fn) => {
1325
1325
  }
1326
1326
  knownSparseEmbeddingFunctions.set(name, fn);
1327
1327
  };
1328
- var getEmbeddingFunction = async (collectionName, efConfig) => {
1328
+ var getEmbeddingFunction = async (collectionName, efConfig, debug) => {
1329
1329
  if (!efConfig) {
1330
1330
  console.warn(
1331
1331
  `No embedding function configuration found for collection ${collectionName}. 'add' and 'query' will fail unless you provide them embeddings directly.`
@@ -1354,6 +1354,17 @@ var getEmbeddingFunction = async (collectionName, efConfig) => {
1354
1354
  return void 0;
1355
1355
  }
1356
1356
  const packageName = pythonEmbeddingFunctions[efConfig.name] || efConfig.name;
1357
+ if (debug) {
1358
+ console.log("DEBUFFING");
1359
+ console.log(packageName);
1360
+ }
1361
+ if (packageName === "default-embed") {
1362
+ console.log("INSIDE HIT");
1363
+ if (debug) {
1364
+ console.log("FROM DEBUG");
1365
+ }
1366
+ await getDefaultEFConfig();
1367
+ }
1357
1368
  let embeddingFunction = knownEmbeddingFunctions.get(packageName);
1358
1369
  if (!embeddingFunction) {
1359
1370
  try {
@@ -1364,7 +1375,7 @@ var getEmbeddingFunction = async (collectionName, efConfig) => {
1364
1375
  }
1365
1376
  if (!embeddingFunction) {
1366
1377
  console.warn(
1367
- `Collection ${collectionName} was created with the ${packageName} embedding function. However, the @chroma-core/${packageName} package is not install. 'add' and 'query' will fail unless you provide them embeddings directly, or install the @chroma-core/${packageName} package.`
1378
+ `Collection ${collectionName} was created with the ${packageName} embedding function. However, the @chroma-core/${packageName} package is not installed. 'add' and 'query' will fail unless you provide them embeddings directly, or install the @chroma-core/${packageName} package.`
1368
1379
  );
1369
1380
  return void 0;
1370
1381
  }
@@ -1459,8 +1470,8 @@ var serializeEmbeddingFunction = ({
1459
1470
  var getDefaultEFConfig = async () => {
1460
1471
  try {
1461
1472
  const { DefaultEmbeddingFunction } = await import("@chroma-core/default-embed");
1462
- if (!knownEmbeddingFunctions.has(new DefaultEmbeddingFunction().name)) {
1463
- registerEmbeddingFunction("default", DefaultEmbeddingFunction);
1473
+ if (!knownEmbeddingFunctions.has("default-embed")) {
1474
+ registerEmbeddingFunction("default-embed", DefaultEmbeddingFunction);
1464
1475
  }
1465
1476
  } catch (e) {
1466
1477
  console.warn(
@@ -3300,11 +3311,12 @@ var Schema = class _Schema {
3300
3311
  hnsw: json.hnsw ? cloneObject(json.hnsw) : null,
3301
3312
  spann: json.spann ? cloneObject(json.spann) : null
3302
3313
  });
3303
- const embeddingFunction = await getEmbeddingFunction(
3314
+ console.log("SCHEMA THING 1");
3315
+ config.embeddingFunction = await getEmbeddingFunction(
3304
3316
  "schema deserialization",
3305
- json.embedding_function
3317
+ json.embedding_function,
3318
+ true
3306
3319
  );
3307
- config.embeddingFunction = embeddingFunction;
3308
3320
  if (!config.space && config.embeddingFunction?.defaultSpace) {
3309
3321
  config.space = config.embeddingFunction.defaultSpace();
3310
3322
  }