chromadb 3.4.1 → 3.4.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.
@@ -556,6 +556,22 @@ var CollectionService = class {
556
556
  }
557
557
  });
558
558
  }
559
+ /**
560
+ * Get collection by ID
561
+ * Returns a collection by its UUID within a specific tenant and database.
562
+ */
563
+ static getCollectionById(options) {
564
+ return (options.client ?? client).get({
565
+ security: [
566
+ {
567
+ name: "x-chroma-token",
568
+ type: "apiKey"
569
+ }
570
+ ],
571
+ url: "/api/v2/tenants/{tenant}/databases/{database}/collections/by-id/{collection_id}",
572
+ ...options
573
+ });
574
+ }
559
575
  /**
560
576
  * Delete collection
561
577
  * Deletes a collection in a database.
@@ -5229,6 +5245,36 @@ var ChromaClient = class {
5229
5245
  schema
5230
5246
  });
5231
5247
  }
5248
+ /**
5249
+ * Retrieves an existing collection by its ID.
5250
+ * @param id - The UUID of the collection to retrieve
5251
+ * @returns Promise resolving to the Collection instance
5252
+ * @throws Error if the collection does not exist
5253
+ */
5254
+ async getCollectionById(id) {
5255
+ const { data } = await CollectionService.getCollectionById({
5256
+ client: this.apiClient,
5257
+ path: { ...await this._path(), collection_id: id }
5258
+ });
5259
+ const schema = await Schema.deserializeFromJSON(data.schema ?? null, this);
5260
+ const schemaEmbeddingFunction = resolveSchemaEmbeddingFunction(schema);
5261
+ const resolvedEmbeddingFunction = await getEmbeddingFunction({
5262
+ efConfig: data.configuration_json.embedding_function ?? void 0,
5263
+ client: this
5264
+ }) ?? schemaEmbeddingFunction;
5265
+ return new CollectionImpl({
5266
+ chromaClient: this,
5267
+ apiClient: this.apiClient,
5268
+ name: data.name,
5269
+ tenant: data.tenant,
5270
+ database: data.database,
5271
+ configuration: data.configuration_json,
5272
+ metadata: deserializeMetadata(data.metadata ?? void 0) ?? void 0,
5273
+ embeddingFunction: resolvedEmbeddingFunction,
5274
+ id: data.id,
5275
+ schema
5276
+ });
5277
+ }
5232
5278
  /**
5233
5279
  * Retrieves multiple collections by name.
5234
5280
  * @param items - Array of collection names or objects with name and optional embedding function (should match the ones used to create the collections)