chromadb 3.1.5 → 3.1.7
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 +44 -12
- package/dist/chromadb.legacy-esm.js +181 -73
- package/dist/chromadb.mjs +181 -73
- package/dist/chromadb.mjs.map +1 -1
- package/dist/cjs/chromadb.cjs +181 -73
- package/dist/cjs/chromadb.cjs.map +1 -1
- package/dist/cjs/chromadb.d.cts +44 -12
- package/package.json +1 -1
- package/src/api/sdk.gen.ts +25 -15
- package/src/api/types.gen.ts +163 -43
- package/src/chroma-client.ts +78 -20
- package/src/chroma-fetch.ts +32 -16
- package/src/cloud-client.ts +12 -4
- package/src/collection-configuration.ts +16 -8
- package/src/collection.ts +66 -30
- package/src/embedding-function.ts +34 -16
- package/src/schema.ts +49 -26
package/dist/chromadb.d.ts
CHANGED
|
@@ -174,6 +174,12 @@ type Key$1 = 'Document' | 'Embedding' | 'Metadata' | 'Score' | {
|
|
|
174
174
|
* This represents the server-side schema structure used for index management
|
|
175
175
|
*/
|
|
176
176
|
type Schema$1 = {
|
|
177
|
+
/**
|
|
178
|
+
* Customer-managed encryption key for collection data
|
|
179
|
+
*/
|
|
180
|
+
cmek?: {
|
|
181
|
+
[key: string]: unknown;
|
|
182
|
+
} | null;
|
|
177
183
|
/**
|
|
178
184
|
* Default index configurations for each value type
|
|
179
185
|
*/
|
|
@@ -258,6 +264,10 @@ type SparseVector = {
|
|
|
258
264
|
* Dimension indices
|
|
259
265
|
*/
|
|
260
266
|
indices: Array<number>;
|
|
267
|
+
/**
|
|
268
|
+
* Tokens corresponding to each index
|
|
269
|
+
*/
|
|
270
|
+
tokens?: Array<string> | null;
|
|
261
271
|
/**
|
|
262
272
|
* Values corresponding to each index
|
|
263
273
|
*/
|
|
@@ -579,7 +589,7 @@ interface EmbeddingFunction {
|
|
|
579
589
|
/** Returns all supported vector spaces for this embedding function */
|
|
580
590
|
supportedSpaces?(): EmbeddingFunctionSpace[];
|
|
581
591
|
/** Creates an instance from configuration object */
|
|
582
|
-
buildFromConfig?(config: Record<string, any
|
|
592
|
+
buildFromConfig?(config: Record<string, any>, client?: ChromaClient): EmbeddingFunction;
|
|
583
593
|
/** Returns the current configuration as an object */
|
|
584
594
|
getConfig?(): Record<string, any>;
|
|
585
595
|
/**
|
|
@@ -616,7 +626,7 @@ interface SparseEmbeddingFunction {
|
|
|
616
626
|
/** Optional name identifier for the embedding function */
|
|
617
627
|
name?: string;
|
|
618
628
|
/** Creates an instance from configuration object */
|
|
619
|
-
buildFromConfig?(config: Record<string, any
|
|
629
|
+
buildFromConfig?(config: Record<string, any>, client?: ChromaClient): SparseEmbeddingFunction;
|
|
620
630
|
/** Returns the current configuration as an object */
|
|
621
631
|
getConfig?(): Record<string, any>;
|
|
622
632
|
/**
|
|
@@ -640,7 +650,7 @@ interface EmbeddingFunctionClass {
|
|
|
640
650
|
/** Name identifier for the embedding function */
|
|
641
651
|
name: string;
|
|
642
652
|
/** Static method to build instance from configuration */
|
|
643
|
-
buildFromConfig(config: Record<string, any
|
|
653
|
+
buildFromConfig(config: Record<string, any>, client?: ChromaClient): EmbeddingFunction;
|
|
644
654
|
}
|
|
645
655
|
/**
|
|
646
656
|
* Interface for sparse embedding function constructor classes.
|
|
@@ -652,7 +662,7 @@ interface SparseEmbeddingFunctionClass {
|
|
|
652
662
|
/** Name identifier for the embedding function */
|
|
653
663
|
name: string;
|
|
654
664
|
/** Static method to build instance from configuration */
|
|
655
|
-
buildFromConfig(config: Record<string, any
|
|
665
|
+
buildFromConfig(config: Record<string, any>, client?: ChromaClient): SparseEmbeddingFunction;
|
|
656
666
|
}
|
|
657
667
|
/**
|
|
658
668
|
* Registry of available embedding functions.
|
|
@@ -684,18 +694,18 @@ declare const registerEmbeddingFunction: (name: string, fn: EmbeddingFunctionCla
|
|
|
684
694
|
declare const registerSparseEmbeddingFunction: (name: string, fn: SparseEmbeddingFunctionClass) => void;
|
|
685
695
|
/**
|
|
686
696
|
* Retrieves and instantiates an embedding function from configuration.
|
|
687
|
-
* @param collectionName - Name of the collection (for error messages)
|
|
688
|
-
* @param efConfig - Configuration for the embedding function
|
|
689
697
|
* @returns EmbeddingFunction instance or undefined if it cannot be constructed
|
|
690
698
|
*/
|
|
691
|
-
declare const getEmbeddingFunction: (
|
|
699
|
+
declare const getEmbeddingFunction: (args: {
|
|
700
|
+
collectionName: string;
|
|
701
|
+
client: ChromaClient;
|
|
702
|
+
efConfig?: EmbeddingFunctionConfiguration;
|
|
703
|
+
}) => Promise<EmbeddingFunction | undefined>;
|
|
692
704
|
/**
|
|
693
705
|
* Retrieves and instantiates a sparse embedding function from configuration.
|
|
694
|
-
* @param collectionName - Name of the collection (for error messages)
|
|
695
|
-
* @param efConfig - Configuration for the sparse embedding function
|
|
696
706
|
* @returns SparseEmbeddingFunction instance or undefined if it cannot be constructed
|
|
697
707
|
*/
|
|
698
|
-
declare const getSparseEmbeddingFunction: (collectionName: string, efConfig?: EmbeddingFunctionConfiguration) => Promise<SparseEmbeddingFunction | undefined>;
|
|
708
|
+
declare const getSparseEmbeddingFunction: (collectionName: string, client: ChromaClient, efConfig?: EmbeddingFunctionConfiguration) => Promise<SparseEmbeddingFunction | undefined>;
|
|
699
709
|
/**
|
|
700
710
|
* Serializes an embedding function to configuration format.
|
|
701
711
|
* @param embeddingFunction - User provided embedding function
|
|
@@ -1001,7 +1011,7 @@ declare class Schema {
|
|
|
1001
1011
|
createIndex(config?: IndexConfig, key?: string): this;
|
|
1002
1012
|
deleteIndex(config?: IndexConfig, key?: string): this;
|
|
1003
1013
|
serializeToJSON(): Schema$1;
|
|
1004
|
-
static deserializeFromJSON(json
|
|
1014
|
+
static deserializeFromJSON(json: Schema$1 | JsonDict | null, client: ChromaClient): Promise<Schema | undefined>;
|
|
1005
1015
|
private setVectorIndexConfig;
|
|
1006
1016
|
private setFtsIndexConfig;
|
|
1007
1017
|
private setIndexInDefaults;
|
|
@@ -1075,11 +1085,12 @@ declare const processCreateCollectionConfig: ({ configuration, embeddingFunction
|
|
|
1075
1085
|
/**
|
|
1076
1086
|
*
|
|
1077
1087
|
*/
|
|
1078
|
-
declare const processUpdateCollectionConfig: ({ collectionName, currentConfiguration, currentEmbeddingFunction, newConfiguration, }: {
|
|
1088
|
+
declare const processUpdateCollectionConfig: ({ collectionName, currentConfiguration, currentEmbeddingFunction, newConfiguration, client, }: {
|
|
1079
1089
|
collectionName: string;
|
|
1080
1090
|
currentConfiguration: CollectionConfiguration;
|
|
1081
1091
|
currentEmbeddingFunction?: EmbeddingFunction;
|
|
1082
1092
|
newConfiguration: UpdateCollectionConfiguration;
|
|
1093
|
+
client: ChromaClient;
|
|
1083
1094
|
}) => Promise<{
|
|
1084
1095
|
updateConfiguration?: UpdateCollectionConfiguration$1;
|
|
1085
1096
|
updateEmbeddingFunction?: EmbeddingFunction;
|
|
@@ -1116,6 +1127,7 @@ declare class ChromaClient {
|
|
|
1116
1127
|
private _tenant;
|
|
1117
1128
|
private _database;
|
|
1118
1129
|
private _preflightChecks;
|
|
1130
|
+
private _headers;
|
|
1119
1131
|
private readonly apiClient;
|
|
1120
1132
|
/**
|
|
1121
1133
|
* Creates a new ChromaClient instance.
|
|
@@ -1140,6 +1152,7 @@ declare class ChromaClient {
|
|
|
1140
1152
|
*/
|
|
1141
1153
|
get preflightChecks(): ChecklistResponse | undefined;
|
|
1142
1154
|
protected set preflightChecks(preflightChecks: ChecklistResponse | undefined);
|
|
1155
|
+
get headers(): Record<string, string> | undefined;
|
|
1143
1156
|
/** @ignore */
|
|
1144
1157
|
_path(): Promise<{
|
|
1145
1158
|
tenant: string;
|
|
@@ -1200,6 +1213,13 @@ declare class ChromaClient {
|
|
|
1200
1213
|
name: string;
|
|
1201
1214
|
embeddingFunction?: EmbeddingFunction;
|
|
1202
1215
|
}): Promise<Collection>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Retrieves an existing collection by its Chroma Resource Name (CRN).
|
|
1218
|
+
* @param crn - The Chroma Resource Name of the collection to retrieve
|
|
1219
|
+
* @returns Promise resolving to the Collection instance
|
|
1220
|
+
* @throws Error if the collection does not exist
|
|
1221
|
+
*/
|
|
1222
|
+
getCollectionByCrn(crn: string): Promise<Collection>;
|
|
1203
1223
|
/**
|
|
1204
1224
|
* Retrieves multiple collections by name.
|
|
1205
1225
|
* @param items - Array of collection names or objects with name and optional embedding function (should match the ones used to create the collections)
|
|
@@ -1266,6 +1286,10 @@ declare class ChromaClient {
|
|
|
1266
1286
|
* Provides methods for adding, querying, updating, and deleting records.
|
|
1267
1287
|
*/
|
|
1268
1288
|
interface Collection {
|
|
1289
|
+
/** Tenant name */
|
|
1290
|
+
tenant: string;
|
|
1291
|
+
/** Database name */
|
|
1292
|
+
database: string;
|
|
1269
1293
|
/** Unique identifier for the collection */
|
|
1270
1294
|
id: string;
|
|
1271
1295
|
/** Name of the collection */
|
|
@@ -1528,6 +1552,10 @@ declare class CloudClient extends ChromaClient {
|
|
|
1528
1552
|
constructor(args?: Partial<{
|
|
1529
1553
|
/** API key for authentication (or set CHROMA_API_KEY env var) */
|
|
1530
1554
|
apiKey?: string;
|
|
1555
|
+
/** Host address of the Chroma cloud server. Defaults to 'api.trychroma.com' */
|
|
1556
|
+
host?: string;
|
|
1557
|
+
/** Port number of the Chroma cloud server. Defaults to 443 */
|
|
1558
|
+
port?: number;
|
|
1531
1559
|
/** Tenant name for multi-tenant deployments */
|
|
1532
1560
|
tenant?: string;
|
|
1533
1561
|
/** Database name to connect to */
|
|
@@ -1548,6 +1576,10 @@ declare class AdminCloudClient extends AdminClient {
|
|
|
1548
1576
|
constructor(args?: Partial<{
|
|
1549
1577
|
/** API key for authentication (or set CHROMA_API_KEY env var) */
|
|
1550
1578
|
apiKey?: string;
|
|
1579
|
+
/** Host address of the Chroma cloud server. Defaults to 'api.trychroma.com' */
|
|
1580
|
+
host?: string;
|
|
1581
|
+
/** Port number of the Chroma cloud server. Defaults to 443 */
|
|
1582
|
+
port?: number;
|
|
1551
1583
|
/** Additional fetch options for HTTP requests */
|
|
1552
1584
|
fetchOptions?: RequestInit;
|
|
1553
1585
|
}>);
|