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/cjs/chromadb.d.cts
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)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chromadb",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.3",
|
|
4
4
|
"description": "A JavaScript interface for chroma",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chroma",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"@chroma-core/default-embed": "^0.1.9"
|
|
61
61
|
},
|
|
62
62
|
"optionalDependencies": {
|
|
63
|
-
"chromadb-js-bindings-darwin-arm64": "^1.3.
|
|
64
|
-
"chromadb-js-bindings-darwin-x64": "^1.3.
|
|
65
|
-
"chromadb-js-bindings-linux-arm64-gnu": "^1.3.
|
|
66
|
-
"chromadb-js-bindings-linux-x64-gnu": "^1.3.
|
|
67
|
-
"chromadb-js-bindings-win32-x64-msvc": "^1.3.
|
|
63
|
+
"chromadb-js-bindings-darwin-arm64": "^1.3.3",
|
|
64
|
+
"chromadb-js-bindings-darwin-x64": "^1.3.3",
|
|
65
|
+
"chromadb-js-bindings-linux-arm64-gnu": "^1.3.3",
|
|
66
|
+
"chromadb-js-bindings-linux-x64-gnu": "^1.3.3",
|
|
67
|
+
"chromadb-js-bindings-win32-x64-msvc": "^1.3.3"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": ">=20"
|
package/src/api/sdk.gen.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
3
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
4
|
-
import type { GetUserIdentityData, GetUserIdentityResponse2, GetUserIdentityError, GetCollectionByCrnData, GetCollectionByCrnResponse, GetCollectionByCrnError, HealthcheckData, HealthcheckResponse, HealthcheckError, HeartbeatData, HeartbeatResponse2, HeartbeatError, PreFlightChecksData, PreFlightChecksResponse, PreFlightChecksError, ResetData, ResetResponse, ResetError, CreateTenantData, CreateTenantResponse2, CreateTenantError, GetTenantData, GetTenantResponse2, GetTenantError, UpdateTenantData, UpdateTenantResponse2, UpdateTenantError, ListDatabasesData, ListDatabasesResponse, ListDatabasesError, CreateDatabaseData, CreateDatabaseResponse2, CreateDatabaseError, DeleteDatabaseData, DeleteDatabaseResponse2, DeleteDatabaseError, GetDatabaseData, GetDatabaseResponse, GetDatabaseError, ListCollectionsData, ListCollectionsResponse, ListCollectionsError, CreateCollectionData, CreateCollectionResponse, CreateCollectionError, DeleteCollectionData, DeleteCollectionResponse2, DeleteCollectionError, GetCollectionData, GetCollectionResponse, GetCollectionError, UpdateCollectionData, UpdateCollectionResponse2, UpdateCollectionError, CollectionAddData, CollectionAddResponse, DetachFunctionData, DetachFunctionResponse2, DetachFunctionError, CollectionCountData, CollectionCountResponse, CollectionCountError, CollectionDeleteData, CollectionDeleteResponse, CollectionDeleteError, ForkCollectionData, ForkCollectionResponse, ForkCollectionError, ForkCountData, ForkCountResponse2, ForkCountError, AttachFunctionData, AttachFunctionResponse2, AttachFunctionError, GetAttachedFunctionData, GetAttachedFunctionResponse2, GetAttachedFunctionError, CollectionGetData, CollectionGetResponse, CollectionGetError, IndexingStatusData, IndexingStatusResponse, IndexingStatusError, CollectionQueryData, CollectionQueryResponse, CollectionQueryError, CollectionSearchData, CollectionSearchResponse, CollectionSearchError, CollectionUpdateData, CollectionUpdateResponse, CollectionUpsertData, CollectionUpsertResponse, CollectionUpsertError, CountCollectionsData, CountCollectionsResponse, CountCollectionsError, VersionData, VersionResponse } from './types.gen';
|
|
4
|
+
import type { GetUserIdentityData, GetUserIdentityResponse2, GetUserIdentityError, GetCollectionByCrnData, GetCollectionByCrnResponse, GetCollectionByCrnError, HealthcheckData, HealthcheckResponse, HealthcheckError, HeartbeatData, HeartbeatResponse2, HeartbeatError, PreFlightChecksData, PreFlightChecksResponse, PreFlightChecksError, ResetData, ResetResponse, ResetError, CreateTenantData, CreateTenantResponse2, CreateTenantError, GetTenantData, GetTenantResponse2, GetTenantError, UpdateTenantData, UpdateTenantResponse2, UpdateTenantError, ListDatabasesData, ListDatabasesResponse, ListDatabasesError, CreateDatabaseData, CreateDatabaseResponse2, CreateDatabaseError, DeleteDatabaseData, DeleteDatabaseResponse2, DeleteDatabaseError, GetDatabaseData, GetDatabaseResponse, GetDatabaseError, ListCollectionsData, ListCollectionsResponse, ListCollectionsError, CreateCollectionData, CreateCollectionResponse, CreateCollectionError, GetCollectionByIdData, GetCollectionByIdResponse, GetCollectionByIdError, DeleteCollectionData, DeleteCollectionResponse2, DeleteCollectionError, GetCollectionData, GetCollectionResponse, GetCollectionError, UpdateCollectionData, UpdateCollectionResponse2, UpdateCollectionError, CollectionAddData, CollectionAddResponse, DetachFunctionData, DetachFunctionResponse2, DetachFunctionError, CollectionCountData, CollectionCountResponse, CollectionCountError, CollectionDeleteData, CollectionDeleteResponse, CollectionDeleteError, ForkCollectionData, ForkCollectionResponse, ForkCollectionError, ForkCountData, ForkCountResponse2, ForkCountError, AttachFunctionData, AttachFunctionResponse2, AttachFunctionError, GetAttachedFunctionData, GetAttachedFunctionResponse2, GetAttachedFunctionError, CollectionGetData, CollectionGetResponse, CollectionGetError, IndexingStatusData, IndexingStatusResponse, IndexingStatusError, CollectionQueryData, CollectionQueryResponse, CollectionQueryError, CollectionSearchData, CollectionSearchResponse, CollectionSearchError, CollectionUpdateData, CollectionUpdateResponse, CollectionUpsertData, CollectionUpsertResponse, CollectionUpsertError, CountCollectionsData, CountCollectionsResponse, CountCollectionsError, VersionData, VersionResponse } from './types.gen';
|
|
5
5
|
import { client as _heyApiClient } from './client.gen';
|
|
6
6
|
|
|
7
7
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
@@ -94,6 +94,23 @@ export class CollectionService {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Get collection by ID
|
|
99
|
+
* Returns a collection by its UUID within a specific tenant and database.
|
|
100
|
+
*/
|
|
101
|
+
public static getCollectionById<ThrowOnError extends boolean = true>(options: Options<GetCollectionByIdData, ThrowOnError>) {
|
|
102
|
+
return (options.client ?? _heyApiClient).get<GetCollectionByIdResponse, GetCollectionByIdError, ThrowOnError>({
|
|
103
|
+
security: [
|
|
104
|
+
{
|
|
105
|
+
name: 'x-chroma-token',
|
|
106
|
+
type: 'apiKey'
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
url: '/api/v2/tenants/{tenant}/databases/{database}/collections/by-id/{collection_id}',
|
|
110
|
+
...options
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
97
114
|
/**
|
|
98
115
|
* Delete collection
|
|
99
116
|
* Deletes a collection in a database.
|
package/src/api/types.gen.ts
CHANGED
|
@@ -1307,6 +1307,52 @@ export type CreateCollectionResponses = {
|
|
|
1307
1307
|
|
|
1308
1308
|
export type CreateCollectionResponse = CreateCollectionResponses[keyof CreateCollectionResponses];
|
|
1309
1309
|
|
|
1310
|
+
export type GetCollectionByIdData = {
|
|
1311
|
+
body?: never;
|
|
1312
|
+
path: {
|
|
1313
|
+
/**
|
|
1314
|
+
* Tenant ID
|
|
1315
|
+
*/
|
|
1316
|
+
tenant: string;
|
|
1317
|
+
/**
|
|
1318
|
+
* Database name
|
|
1319
|
+
*/
|
|
1320
|
+
database: string;
|
|
1321
|
+
/**
|
|
1322
|
+
* Collection UUID
|
|
1323
|
+
*/
|
|
1324
|
+
collection_id: string;
|
|
1325
|
+
};
|
|
1326
|
+
query?: never;
|
|
1327
|
+
url: '/api/v2/tenants/{tenant}/databases/{database}/collections/by-id/{collection_id}';
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
export type GetCollectionByIdErrors = {
|
|
1331
|
+
/**
|
|
1332
|
+
* Unauthorized
|
|
1333
|
+
*/
|
|
1334
|
+
401: ErrorResponse;
|
|
1335
|
+
/**
|
|
1336
|
+
* Collection not found
|
|
1337
|
+
*/
|
|
1338
|
+
404: ErrorResponse;
|
|
1339
|
+
/**
|
|
1340
|
+
* Server error
|
|
1341
|
+
*/
|
|
1342
|
+
500: ErrorResponse;
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
export type GetCollectionByIdError = GetCollectionByIdErrors[keyof GetCollectionByIdErrors];
|
|
1346
|
+
|
|
1347
|
+
export type GetCollectionByIdResponses = {
|
|
1348
|
+
/**
|
|
1349
|
+
* Collection found
|
|
1350
|
+
*/
|
|
1351
|
+
200: Collection;
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
export type GetCollectionByIdResponse = GetCollectionByIdResponses[keyof GetCollectionByIdResponses];
|
|
1355
|
+
|
|
1310
1356
|
export type DeleteCollectionData = {
|
|
1311
1357
|
body?: never;
|
|
1312
1358
|
path: {
|
package/src/chroma-client.ts
CHANGED
|
@@ -440,6 +440,38 @@ export class ChromaClient {
|
|
|
440
440
|
});
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Retrieves an existing collection by its ID.
|
|
445
|
+
* @param id - The UUID of the collection to retrieve
|
|
446
|
+
* @returns Promise resolving to the Collection instance
|
|
447
|
+
* @throws Error if the collection does not exist
|
|
448
|
+
*/
|
|
449
|
+
public async getCollectionById(id: string): Promise<Collection> {
|
|
450
|
+
const { data } = await CollectionService.getCollectionById({
|
|
451
|
+
client: this.apiClient,
|
|
452
|
+
path: { ...(await this._path()), collection_id: id },
|
|
453
|
+
});
|
|
454
|
+
const schema = await Schema.deserializeFromJSON(data.schema ?? null, this);
|
|
455
|
+
const schemaEmbeddingFunction = resolveSchemaEmbeddingFunction(schema);
|
|
456
|
+
const resolvedEmbeddingFunction =
|
|
457
|
+
(await getEmbeddingFunction({
|
|
458
|
+
efConfig: data.configuration_json.embedding_function ?? undefined,
|
|
459
|
+
client: this,
|
|
460
|
+
})) ?? schemaEmbeddingFunction;
|
|
461
|
+
return new CollectionImpl({
|
|
462
|
+
chromaClient: this,
|
|
463
|
+
apiClient: this.apiClient,
|
|
464
|
+
name: data.name,
|
|
465
|
+
tenant: data.tenant,
|
|
466
|
+
database: data.database,
|
|
467
|
+
configuration: data.configuration_json,
|
|
468
|
+
metadata: deserializeMetadata(data.metadata ?? undefined) ?? undefined,
|
|
469
|
+
embeddingFunction: resolvedEmbeddingFunction,
|
|
470
|
+
id: data.id,
|
|
471
|
+
schema,
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
|
|
443
475
|
/**
|
|
444
476
|
* Retrieves multiple collections by name.
|
|
445
477
|
* @param items - Array of collection names or objects with name and optional embedding function (should match the ones used to create the collections)
|