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.
- package/dist/chromadb.d.ts +7 -0
- package/dist/chromadb.legacy-esm.js +46 -0
- package/dist/chromadb.mjs +46 -0
- package/dist/chromadb.mjs.map +1 -1
- package/dist/cjs/chromadb.cjs +46 -0
- package/dist/cjs/chromadb.cjs.map +1 -1
- package/dist/cjs/chromadb.d.cts +7 -0
- package/package.json +6 -6
- package/src/api/sdk.gen.ts +18 -1
- package/src/api/types.gen.ts +46 -0
- package/src/chroma-client.ts +32 -0
- package/src/cli.ts +4 -0
package/dist/chromadb.d.ts
CHANGED
|
@@ -1492,6 +1492,13 @@ declare class ChromaClient {
|
|
|
1492
1492
|
* @throws Error if the collection does not exist
|
|
1493
1493
|
*/
|
|
1494
1494
|
getCollectionByCrn(crn: string): Promise<Collection>;
|
|
1495
|
+
/**
|
|
1496
|
+
* Retrieves an existing collection by its ID.
|
|
1497
|
+
* @param id - The UUID of the collection to retrieve
|
|
1498
|
+
* @returns Promise resolving to the Collection instance
|
|
1499
|
+
* @throws Error if the collection does not exist
|
|
1500
|
+
*/
|
|
1501
|
+
getCollectionById(id: string): Promise<Collection>;
|
|
1495
1502
|
/**
|
|
1496
1503
|
* Retrieves multiple collections by name.
|
|
1497
1504
|
* @param items - Array of collection names or objects with name and optional embedding function (should match the ones used to create the collections)
|
|
@@ -436,6 +436,22 @@ var CollectionService = class {
|
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
+
/**
|
|
440
|
+
* Get collection by ID
|
|
441
|
+
* Returns a collection by its UUID within a specific tenant and database.
|
|
442
|
+
*/
|
|
443
|
+
static getCollectionById(options) {
|
|
444
|
+
return (options.client ?? client).get({
|
|
445
|
+
security: [
|
|
446
|
+
{
|
|
447
|
+
name: "x-chroma-token",
|
|
448
|
+
type: "apiKey"
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
url: "/api/v2/tenants/{tenant}/databases/{database}/collections/by-id/{collection_id}",
|
|
452
|
+
...options
|
|
453
|
+
});
|
|
454
|
+
}
|
|
439
455
|
/**
|
|
440
456
|
* Delete collection
|
|
441
457
|
* Deletes a collection in a database.
|
|
@@ -5109,6 +5125,36 @@ var ChromaClient = class {
|
|
|
5109
5125
|
schema
|
|
5110
5126
|
});
|
|
5111
5127
|
}
|
|
5128
|
+
/**
|
|
5129
|
+
* Retrieves an existing collection by its ID.
|
|
5130
|
+
* @param id - The UUID of the collection to retrieve
|
|
5131
|
+
* @returns Promise resolving to the Collection instance
|
|
5132
|
+
* @throws Error if the collection does not exist
|
|
5133
|
+
*/
|
|
5134
|
+
async getCollectionById(id) {
|
|
5135
|
+
const { data } = await CollectionService.getCollectionById({
|
|
5136
|
+
client: this.apiClient,
|
|
5137
|
+
path: { ...await this._path(), collection_id: id }
|
|
5138
|
+
});
|
|
5139
|
+
const schema = await Schema.deserializeFromJSON(data.schema ?? null, this);
|
|
5140
|
+
const schemaEmbeddingFunction = resolveSchemaEmbeddingFunction(schema);
|
|
5141
|
+
const resolvedEmbeddingFunction = await getEmbeddingFunction({
|
|
5142
|
+
efConfig: data.configuration_json.embedding_function ?? void 0,
|
|
5143
|
+
client: this
|
|
5144
|
+
}) ?? schemaEmbeddingFunction;
|
|
5145
|
+
return new CollectionImpl({
|
|
5146
|
+
chromaClient: this,
|
|
5147
|
+
apiClient: this.apiClient,
|
|
5148
|
+
name: data.name,
|
|
5149
|
+
tenant: data.tenant,
|
|
5150
|
+
database: data.database,
|
|
5151
|
+
configuration: data.configuration_json,
|
|
5152
|
+
metadata: deserializeMetadata(data.metadata ?? void 0) ?? void 0,
|
|
5153
|
+
embeddingFunction: resolvedEmbeddingFunction,
|
|
5154
|
+
id: data.id,
|
|
5155
|
+
schema
|
|
5156
|
+
});
|
|
5157
|
+
}
|
|
5112
5158
|
/**
|
|
5113
5159
|
* Retrieves multiple collections by name.
|
|
5114
5160
|
* @param items - Array of collection names or objects with name and optional embedding function (should match the ones used to create the collections)
|
package/dist/chromadb.mjs
CHANGED
|
@@ -436,6 +436,22 @@ var CollectionService = class {
|
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
+
/**
|
|
440
|
+
* Get collection by ID
|
|
441
|
+
* Returns a collection by its UUID within a specific tenant and database.
|
|
442
|
+
*/
|
|
443
|
+
static getCollectionById(options) {
|
|
444
|
+
return (options.client ?? client).get({
|
|
445
|
+
security: [
|
|
446
|
+
{
|
|
447
|
+
name: "x-chroma-token",
|
|
448
|
+
type: "apiKey"
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
url: "/api/v2/tenants/{tenant}/databases/{database}/collections/by-id/{collection_id}",
|
|
452
|
+
...options
|
|
453
|
+
});
|
|
454
|
+
}
|
|
439
455
|
/**
|
|
440
456
|
* Delete collection
|
|
441
457
|
* Deletes a collection in a database.
|
|
@@ -5109,6 +5125,36 @@ var ChromaClient = class {
|
|
|
5109
5125
|
schema
|
|
5110
5126
|
});
|
|
5111
5127
|
}
|
|
5128
|
+
/**
|
|
5129
|
+
* Retrieves an existing collection by its ID.
|
|
5130
|
+
* @param id - The UUID of the collection to retrieve
|
|
5131
|
+
* @returns Promise resolving to the Collection instance
|
|
5132
|
+
* @throws Error if the collection does not exist
|
|
5133
|
+
*/
|
|
5134
|
+
async getCollectionById(id) {
|
|
5135
|
+
const { data } = await CollectionService.getCollectionById({
|
|
5136
|
+
client: this.apiClient,
|
|
5137
|
+
path: { ...await this._path(), collection_id: id }
|
|
5138
|
+
});
|
|
5139
|
+
const schema = await Schema.deserializeFromJSON(data.schema ?? null, this);
|
|
5140
|
+
const schemaEmbeddingFunction = resolveSchemaEmbeddingFunction(schema);
|
|
5141
|
+
const resolvedEmbeddingFunction = await getEmbeddingFunction({
|
|
5142
|
+
efConfig: data.configuration_json.embedding_function ?? void 0,
|
|
5143
|
+
client: this
|
|
5144
|
+
}) ?? schemaEmbeddingFunction;
|
|
5145
|
+
return new CollectionImpl({
|
|
5146
|
+
chromaClient: this,
|
|
5147
|
+
apiClient: this.apiClient,
|
|
5148
|
+
name: data.name,
|
|
5149
|
+
tenant: data.tenant,
|
|
5150
|
+
database: data.database,
|
|
5151
|
+
configuration: data.configuration_json,
|
|
5152
|
+
metadata: deserializeMetadata(data.metadata ?? void 0) ?? void 0,
|
|
5153
|
+
embeddingFunction: resolvedEmbeddingFunction,
|
|
5154
|
+
id: data.id,
|
|
5155
|
+
schema
|
|
5156
|
+
});
|
|
5157
|
+
}
|
|
5112
5158
|
/**
|
|
5113
5159
|
* Retrieves multiple collections by name.
|
|
5114
5160
|
* @param items - Array of collection names or objects with name and optional embedding function (should match the ones used to create the collections)
|