chromadb 3.1.2 → 3.1.4

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.
@@ -1354,6 +1354,9 @@ var getEmbeddingFunction = async (collectionName, efConfig) => {
1354
1354
  return void 0;
1355
1355
  }
1356
1356
  const packageName = pythonEmbeddingFunctions[efConfig.name] || efConfig.name;
1357
+ if (packageName === "default-embed") {
1358
+ await getDefaultEFConfig();
1359
+ }
1357
1360
  let embeddingFunction = knownEmbeddingFunctions.get(packageName);
1358
1361
  if (!embeddingFunction) {
1359
1362
  try {
@@ -1364,7 +1367,7 @@ var getEmbeddingFunction = async (collectionName, efConfig) => {
1364
1367
  }
1365
1368
  if (!embeddingFunction) {
1366
1369
  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.`
1370
+ `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
1371
  );
1369
1372
  return void 0;
1370
1373
  }
@@ -1459,8 +1462,8 @@ var serializeEmbeddingFunction = ({
1459
1462
  var getDefaultEFConfig = async () => {
1460
1463
  try {
1461
1464
  const { DefaultEmbeddingFunction } = await import("@chroma-core/default-embed");
1462
- if (!knownEmbeddingFunctions.has(new DefaultEmbeddingFunction().name)) {
1463
- registerEmbeddingFunction("default", DefaultEmbeddingFunction);
1465
+ if (!knownEmbeddingFunctions.has("default-embed")) {
1466
+ registerEmbeddingFunction("default-embed", DefaultEmbeddingFunction);
1464
1467
  }
1465
1468
  } catch (e) {
1466
1469
  console.warn(
@@ -3300,11 +3303,10 @@ var Schema = class _Schema {
3300
3303
  hnsw: json.hnsw ? cloneObject(json.hnsw) : null,
3301
3304
  spann: json.spann ? cloneObject(json.spann) : null
3302
3305
  });
3303
- const embeddingFunction = await getEmbeddingFunction(
3306
+ config.embeddingFunction = await getEmbeddingFunction(
3304
3307
  "schema deserialization",
3305
3308
  json.embedding_function
3306
3309
  );
3307
- config.embeddingFunction = embeddingFunction;
3308
3310
  if (!config.space && config.embeddingFunction?.defaultSpace) {
3309
3311
  config.space = config.embeddingFunction.defaultSpace();
3310
3312
  }
@@ -4010,9 +4012,7 @@ var chromaFetch = async (input, init) => {
4010
4012
  case 429:
4011
4013
  throw new ChromaRateLimitError("Rate limit exceeded");
4012
4014
  }
4013
- throw new ChromaConnectionError(
4014
- `Unable to connect to the chromadb server (status: ${response.status}). Please try again later.`
4015
- );
4015
+ throw new ChromaServerError(`${response.status}: ${response.statusText}`);
4016
4016
  };
4017
4017
 
4018
4018
  // src/admin-client.ts
package/dist/chromadb.mjs CHANGED
@@ -1354,6 +1354,9 @@ var getEmbeddingFunction = async (collectionName, efConfig) => {
1354
1354
  return void 0;
1355
1355
  }
1356
1356
  const packageName = pythonEmbeddingFunctions[efConfig.name] || efConfig.name;
1357
+ if (packageName === "default-embed") {
1358
+ await getDefaultEFConfig();
1359
+ }
1357
1360
  let embeddingFunction = knownEmbeddingFunctions.get(packageName);
1358
1361
  if (!embeddingFunction) {
1359
1362
  try {
@@ -1364,7 +1367,7 @@ var getEmbeddingFunction = async (collectionName, efConfig) => {
1364
1367
  }
1365
1368
  if (!embeddingFunction) {
1366
1369
  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.`
1370
+ `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
1371
  );
1369
1372
  return void 0;
1370
1373
  }
@@ -1459,8 +1462,8 @@ var serializeEmbeddingFunction = ({
1459
1462
  var getDefaultEFConfig = async () => {
1460
1463
  try {
1461
1464
  const { DefaultEmbeddingFunction } = await import("@chroma-core/default-embed");
1462
- if (!knownEmbeddingFunctions.has(new DefaultEmbeddingFunction().name)) {
1463
- registerEmbeddingFunction("default", DefaultEmbeddingFunction);
1465
+ if (!knownEmbeddingFunctions.has("default-embed")) {
1466
+ registerEmbeddingFunction("default-embed", DefaultEmbeddingFunction);
1464
1467
  }
1465
1468
  } catch (e) {
1466
1469
  console.warn(
@@ -3300,11 +3303,10 @@ var Schema = class _Schema {
3300
3303
  hnsw: json.hnsw ? cloneObject(json.hnsw) : null,
3301
3304
  spann: json.spann ? cloneObject(json.spann) : null
3302
3305
  });
3303
- const embeddingFunction = await getEmbeddingFunction(
3306
+ config.embeddingFunction = await getEmbeddingFunction(
3304
3307
  "schema deserialization",
3305
3308
  json.embedding_function
3306
3309
  );
3307
- config.embeddingFunction = embeddingFunction;
3308
3310
  if (!config.space && config.embeddingFunction?.defaultSpace) {
3309
3311
  config.space = config.embeddingFunction.defaultSpace();
3310
3312
  }
@@ -4010,9 +4012,7 @@ var chromaFetch = async (input, init) => {
4010
4012
  case 429:
4011
4013
  throw new ChromaRateLimitError("Rate limit exceeded");
4012
4014
  }
4013
- throw new ChromaConnectionError(
4014
- `Unable to connect to the chromadb server (status: ${response.status}). Please try again later.`
4015
- );
4015
+ throw new ChromaServerError(`${response.status}: ${response.statusText}`);
4016
4016
  };
4017
4017
 
4018
4018
  // src/admin-client.ts