chromadb 1.7.2 → 1.7.3-beta2
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 +230 -488
- package/dist/chromadb.legacy-esm.js +154 -879
- package/dist/chromadb.mjs +154 -879
- package/dist/chromadb.mjs.map +1 -1
- package/dist/cjs/chromadb.cjs +157 -885
- package/dist/cjs/chromadb.cjs.map +1 -1
- package/dist/cjs/chromadb.d.cts +230 -488
- package/package.json +2 -6
- package/src/ChromaClient.ts +41 -67
- package/src/Collection.ts +58 -17
- package/src/embeddings/DefaultEmbeddingFunction.ts +99 -0
- package/src/embeddings/TransformersEmbeddingFunction.ts +99 -0
- package/src/generated/api.ts +45 -563
- package/src/generated/configuration.ts +5 -5
- package/src/generated/index.ts +2 -2
- package/src/generated/models.ts +35 -79
- package/src/generated/runtime.ts +5 -5
- package/src/index.ts +3 -36
- package/src/types.ts +0 -75
- package/src/utils.ts +3 -17
- package/src/AdminClient.ts +0 -272
- package/src/CloudClient.ts +0 -46
- package/src/embeddings/GoogleGeminiEmbeddingFunction.ts +0 -69
- package/src/embeddings/HuggingFaceEmbeddingServerFunction.ts +0 -31
- package/src/embeddings/JinaEmbeddingFunction.ts +0 -46
package/dist/chromadb.d.ts
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
import * as openai from 'openai';
|
|
2
2
|
import * as cohere_ai from 'cohere-ai';
|
|
3
|
-
import * as
|
|
3
|
+
import * as _xenova_transformers from '@xenova/transformers';
|
|
4
|
+
import * as chromadb_default_embed from 'chromadb-default-embed';
|
|
5
|
+
|
|
6
|
+
interface IEmbeddingFunction {
|
|
7
|
+
generate(texts: string[]): Promise<number[][]>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare enum IncludeEnum {
|
|
11
|
+
Documents = "documents",
|
|
12
|
+
Embeddings = "embeddings",
|
|
13
|
+
Metadatas = "metadatas",
|
|
14
|
+
Distances = "distances"
|
|
15
|
+
}
|
|
16
|
+
type Number = number;
|
|
17
|
+
type Embedding = Array<Number>;
|
|
18
|
+
type Embeddings = Array<Embedding>;
|
|
19
|
+
type Metadata = Record<string, string | number | boolean>;
|
|
20
|
+
type Metadatas = Array<Metadata>;
|
|
21
|
+
type Document = string;
|
|
22
|
+
type Documents = Array<Document>;
|
|
23
|
+
type ID = string;
|
|
24
|
+
type IDs = ID[];
|
|
25
|
+
type PositiveInteger = number;
|
|
26
|
+
type LiteralValue = string | number | boolean;
|
|
27
|
+
type ListLiteralValue = LiteralValue[];
|
|
28
|
+
type LiteralNumber = number;
|
|
29
|
+
type LogicalOperator = "$and" | "$or";
|
|
30
|
+
type InclusionOperator = "$in" | "$nin";
|
|
31
|
+
type WhereOperator = "$gt" | "$gte" | "$lt" | "$lte" | "$ne" | "$eq";
|
|
32
|
+
type OperatorExpression = {
|
|
33
|
+
[key in WhereOperator | InclusionOperator | LogicalOperator]?: LiteralValue | ListLiteralValue;
|
|
34
|
+
};
|
|
35
|
+
type BaseWhere = {
|
|
36
|
+
[key: string]: LiteralValue | OperatorExpression;
|
|
37
|
+
};
|
|
38
|
+
type LogicalWhere = {
|
|
39
|
+
[key in LogicalOperator]?: Where[];
|
|
40
|
+
};
|
|
41
|
+
type Where = BaseWhere | LogicalWhere;
|
|
42
|
+
type WhereDocumentOperator = "$contains" | LogicalOperator;
|
|
43
|
+
type WhereDocument = {
|
|
44
|
+
[key in WhereDocumentOperator]?: LiteralValue | LiteralNumber | WhereDocument[];
|
|
45
|
+
};
|
|
46
|
+
type CollectionType = {
|
|
47
|
+
name: string;
|
|
48
|
+
id: string;
|
|
49
|
+
metadata: Metadata | null;
|
|
50
|
+
};
|
|
51
|
+
type GetResponse = {
|
|
52
|
+
ids: IDs;
|
|
53
|
+
embeddings: null | Embeddings;
|
|
54
|
+
documents: (null | Document)[];
|
|
55
|
+
metadatas: (null | Metadata)[];
|
|
56
|
+
error: null | string;
|
|
57
|
+
};
|
|
58
|
+
type QueryResponse = {
|
|
59
|
+
ids: IDs[];
|
|
60
|
+
embeddings: null | Embeddings[];
|
|
61
|
+
documents: (null | Document)[][];
|
|
62
|
+
metadatas: (null | Metadata)[][];
|
|
63
|
+
distances: null | number[][];
|
|
64
|
+
};
|
|
65
|
+
type AddResponse = {
|
|
66
|
+
error: string;
|
|
67
|
+
};
|
|
68
|
+
type CollectionMetadata = Record<string, unknown>;
|
|
4
69
|
|
|
5
70
|
/**
|
|
6
71
|
* FastAPI
|
|
@@ -107,7 +172,6 @@ declare namespace Api {
|
|
|
107
172
|
embeddings?: Api.AddEmbedding.Embedding[];
|
|
108
173
|
metadatas?: Api.AddEmbedding.Metadata[];
|
|
109
174
|
documents?: string[];
|
|
110
|
-
uris?: string[];
|
|
111
175
|
ids: string[];
|
|
112
176
|
}
|
|
113
177
|
/**
|
|
@@ -126,8 +190,6 @@ declare namespace Api {
|
|
|
126
190
|
}
|
|
127
191
|
interface Count200Response {
|
|
128
192
|
}
|
|
129
|
-
interface CountCollections200Response {
|
|
130
|
-
}
|
|
131
193
|
interface CreateCollection {
|
|
132
194
|
name: string;
|
|
133
195
|
metadata?: Api.CreateCollection.Metadata;
|
|
@@ -143,16 +205,6 @@ declare namespace Api {
|
|
|
143
205
|
}
|
|
144
206
|
interface CreateCollection200Response {
|
|
145
207
|
}
|
|
146
|
-
interface CreateDatabase {
|
|
147
|
-
name: string;
|
|
148
|
-
}
|
|
149
|
-
interface CreateDatabase200Response {
|
|
150
|
-
}
|
|
151
|
-
interface CreateTenant {
|
|
152
|
-
name: string;
|
|
153
|
-
}
|
|
154
|
-
interface CreateTenant200Response {
|
|
155
|
-
}
|
|
156
208
|
interface DeleteCollection200Response {
|
|
157
209
|
}
|
|
158
210
|
interface DeleteEmbedding {
|
|
@@ -172,8 +224,6 @@ declare namespace Api {
|
|
|
172
224
|
}
|
|
173
225
|
interface GetCollection200Response {
|
|
174
226
|
}
|
|
175
|
-
interface GetDatabase200Response {
|
|
176
|
-
}
|
|
177
227
|
interface GetEmbedding {
|
|
178
228
|
ids?: string[];
|
|
179
229
|
where?: Api.GetEmbedding.Where;
|
|
@@ -189,7 +239,7 @@ declare namespace Api {
|
|
|
189
239
|
* @memberof GetEmbedding
|
|
190
240
|
*/
|
|
191
241
|
offset?: number;
|
|
192
|
-
include?: (Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4
|
|
242
|
+
include?: (Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4)[];
|
|
193
243
|
}
|
|
194
244
|
/**
|
|
195
245
|
* @export
|
|
@@ -200,7 +250,7 @@ declare namespace Api {
|
|
|
200
250
|
}
|
|
201
251
|
interface WhereDocument {
|
|
202
252
|
}
|
|
203
|
-
type Include = Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4
|
|
253
|
+
type Include = Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4;
|
|
204
254
|
/**
|
|
205
255
|
* @export
|
|
206
256
|
* @namespace Include
|
|
@@ -218,25 +268,15 @@ declare namespace Api {
|
|
|
218
268
|
enum EnumValueEnum4 {
|
|
219
269
|
Distances = "distances"
|
|
220
270
|
}
|
|
221
|
-
enum EnumValueEnum5 {
|
|
222
|
-
Uris = "uris"
|
|
223
|
-
}
|
|
224
|
-
enum EnumValueEnum6 {
|
|
225
|
-
Data = "data"
|
|
226
|
-
}
|
|
227
271
|
}
|
|
228
272
|
}
|
|
229
273
|
interface GetNearestNeighbors200Response {
|
|
230
274
|
}
|
|
231
|
-
interface GetTenant200Response {
|
|
232
|
-
}
|
|
233
275
|
interface HTTPValidationError {
|
|
234
276
|
detail?: Api.ValidationError[];
|
|
235
277
|
}
|
|
236
278
|
interface ListCollections200Response {
|
|
237
279
|
}
|
|
238
|
-
interface PreFlightChecks200Response {
|
|
239
|
-
}
|
|
240
280
|
interface QueryEmbedding {
|
|
241
281
|
where?: Api.QueryEmbedding.Where;
|
|
242
282
|
'where_document'?: Api.QueryEmbedding.WhereDocument;
|
|
@@ -246,7 +286,7 @@ declare namespace Api {
|
|
|
246
286
|
* @memberof QueryEmbedding
|
|
247
287
|
*/
|
|
248
288
|
'n_results'?: number;
|
|
249
|
-
include?: (Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4
|
|
289
|
+
include?: (Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4)[];
|
|
250
290
|
}
|
|
251
291
|
/**
|
|
252
292
|
* @export
|
|
@@ -259,7 +299,7 @@ declare namespace Api {
|
|
|
259
299
|
}
|
|
260
300
|
interface QueryEmbedding2 {
|
|
261
301
|
}
|
|
262
|
-
type Include = Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4
|
|
302
|
+
type Include = Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4;
|
|
263
303
|
/**
|
|
264
304
|
* @export
|
|
265
305
|
* @namespace Include
|
|
@@ -277,12 +317,6 @@ declare namespace Api {
|
|
|
277
317
|
enum EnumValueEnum4 {
|
|
278
318
|
Distances = "distances"
|
|
279
319
|
}
|
|
280
|
-
enum EnumValueEnum5 {
|
|
281
|
-
Uris = "uris"
|
|
282
|
-
}
|
|
283
|
-
enum EnumValueEnum6 {
|
|
284
|
-
Data = "data"
|
|
285
|
-
}
|
|
286
320
|
}
|
|
287
321
|
}
|
|
288
322
|
interface Update200Response {
|
|
@@ -305,7 +339,6 @@ declare namespace Api {
|
|
|
305
339
|
embeddings?: Api.UpdateEmbedding.Embedding[];
|
|
306
340
|
metadatas?: Api.UpdateEmbedding.Metadata[];
|
|
307
341
|
documents?: string[];
|
|
308
|
-
uris?: string[];
|
|
309
342
|
ids: string[];
|
|
310
343
|
}
|
|
311
344
|
/**
|
|
@@ -377,64 +410,27 @@ declare class ApiApi extends BaseAPI {
|
|
|
377
410
|
* @throws {RequiredError}
|
|
378
411
|
*/
|
|
379
412
|
count(collectionId: string, options?: RequestInit): Promise<Api.Count200Response>;
|
|
380
|
-
/**
|
|
381
|
-
* @summary Count Collections
|
|
382
|
-
* @param {string} [tenant]
|
|
383
|
-
* @param {string} [database]
|
|
384
|
-
* @param {RequestInit} [options] Override http request option.
|
|
385
|
-
* @throws {RequiredError}
|
|
386
|
-
*/
|
|
387
|
-
countCollections(tenant: string | undefined, database: string | undefined, options?: RequestInit): Promise<Api.CountCollections200Response>;
|
|
388
413
|
/**
|
|
389
414
|
* @summary Create Collection
|
|
390
|
-
* @param {string} [tenant]
|
|
391
|
-
* @param {string} [database]
|
|
392
415
|
* @param {Api.CreateCollection} request
|
|
393
416
|
* @param {RequestInit} [options] Override http request option.
|
|
394
417
|
* @throws {RequiredError}
|
|
395
418
|
*/
|
|
396
|
-
createCollection(
|
|
397
|
-
/**
|
|
398
|
-
* @summary Create Database
|
|
399
|
-
* @param {string} [tenant]
|
|
400
|
-
* @param {Api.CreateDatabase} request
|
|
401
|
-
* @param {RequestInit} [options] Override http request option.
|
|
402
|
-
* @throws {RequiredError}
|
|
403
|
-
*/
|
|
404
|
-
createDatabase(tenant: string | undefined, request: Api.CreateDatabase, options?: RequestInit): Promise<Api.CreateDatabase200Response>;
|
|
405
|
-
/**
|
|
406
|
-
* @summary Create Tenant
|
|
407
|
-
* @param {Api.CreateTenant} request
|
|
408
|
-
* @param {RequestInit} [options] Override http request option.
|
|
409
|
-
* @throws {RequiredError}
|
|
410
|
-
*/
|
|
411
|
-
createTenant(request: Api.CreateTenant, options?: RequestInit): Promise<Api.CreateTenant200Response>;
|
|
419
|
+
createCollection(request: Api.CreateCollection, options?: RequestInit): Promise<Api.CreateCollection200Response>;
|
|
412
420
|
/**
|
|
413
421
|
* @summary Delete Collection
|
|
414
422
|
* @param {string} collectionName
|
|
415
|
-
* @param {string} [tenant]
|
|
416
|
-
* @param {string} [database]
|
|
417
423
|
* @param {RequestInit} [options] Override http request option.
|
|
418
424
|
* @throws {RequiredError}
|
|
419
425
|
*/
|
|
420
|
-
deleteCollection(collectionName: string,
|
|
426
|
+
deleteCollection(collectionName: string, options?: RequestInit): Promise<Api.DeleteCollection200Response>;
|
|
421
427
|
/**
|
|
422
428
|
* @summary Get Collection
|
|
423
429
|
* @param {string} collectionName
|
|
424
|
-
* @param {string} [tenant]
|
|
425
|
-
* @param {string} [database]
|
|
426
430
|
* @param {RequestInit} [options] Override http request option.
|
|
427
431
|
* @throws {RequiredError}
|
|
428
432
|
*/
|
|
429
|
-
getCollection(collectionName: string,
|
|
430
|
-
/**
|
|
431
|
-
* @summary Get Database
|
|
432
|
-
* @param {string} database
|
|
433
|
-
* @param {string} [tenant]
|
|
434
|
-
* @param {RequestInit} [options] Override http request option.
|
|
435
|
-
* @throws {RequiredError}
|
|
436
|
-
*/
|
|
437
|
-
getDatabase(database: string, tenant: string | undefined, options?: RequestInit): Promise<Api.GetDatabase200Response>;
|
|
433
|
+
getCollection(collectionName: string, options?: RequestInit): Promise<Api.GetCollection200Response>;
|
|
438
434
|
/**
|
|
439
435
|
* @summary Get Nearest Neighbors
|
|
440
436
|
* @param {string} collectionId
|
|
@@ -443,13 +439,6 @@ declare class ApiApi extends BaseAPI {
|
|
|
443
439
|
* @throws {RequiredError}
|
|
444
440
|
*/
|
|
445
441
|
getNearestNeighbors(collectionId: string, request: Api.QueryEmbedding, options?: RequestInit): Promise<Api.GetNearestNeighbors200Response>;
|
|
446
|
-
/**
|
|
447
|
-
* @summary Get Tenant
|
|
448
|
-
* @param {string} tenant
|
|
449
|
-
* @param {RequestInit} [options] Override http request option.
|
|
450
|
-
* @throws {RequiredError}
|
|
451
|
-
*/
|
|
452
|
-
getTenant(tenant: string, options?: RequestInit): Promise<Api.GetTenant200Response>;
|
|
453
442
|
/**
|
|
454
443
|
* @summary Heartbeat
|
|
455
444
|
* @param {RequestInit} [options] Override http request option.
|
|
@@ -460,20 +449,10 @@ declare class ApiApi extends BaseAPI {
|
|
|
460
449
|
}>;
|
|
461
450
|
/**
|
|
462
451
|
* @summary List Collections
|
|
463
|
-
* @param {string} [tenant]
|
|
464
|
-
* @param {string} [database]
|
|
465
|
-
* @param {number} [limit]
|
|
466
|
-
* @param {number} [offset]
|
|
467
|
-
* @param {RequestInit} [options] Override http request option.
|
|
468
|
-
* @throws {RequiredError}
|
|
469
|
-
*/
|
|
470
|
-
listCollections(tenant: string | undefined, database: string | undefined, limit: number | undefined, offset: number | undefined, options?: RequestInit): Promise<Api.ListCollections200Response>;
|
|
471
|
-
/**
|
|
472
|
-
* @summary Pre Flight Checks
|
|
473
452
|
* @param {RequestInit} [options] Override http request option.
|
|
474
453
|
* @throws {RequiredError}
|
|
475
454
|
*/
|
|
476
|
-
|
|
455
|
+
listCollections(options?: RequestInit): Promise<Api.ListCollections200Response>;
|
|
477
456
|
/**
|
|
478
457
|
* @summary Reset
|
|
479
458
|
* @param {RequestInit} [options] Override http request option.
|
|
@@ -520,170 +499,6 @@ declare class ApiApi extends BaseAPI {
|
|
|
520
499
|
version(options?: RequestInit): Promise<string>;
|
|
521
500
|
}
|
|
522
501
|
|
|
523
|
-
interface ClientAuthProvider {
|
|
524
|
-
/**
|
|
525
|
-
* Abstract method for authenticating a client.
|
|
526
|
-
*/
|
|
527
|
-
authenticate(): ClientAuthResponse;
|
|
528
|
-
}
|
|
529
|
-
interface ClientAuthConfigurationProvider<T> {
|
|
530
|
-
/**
|
|
531
|
-
* Abstract method for getting the configuration for the client.
|
|
532
|
-
*/
|
|
533
|
-
getConfig(): T;
|
|
534
|
-
}
|
|
535
|
-
interface ClientAuthCredentialsProvider<T> {
|
|
536
|
-
/**
|
|
537
|
-
* Abstract method for getting the credentials for the client.
|
|
538
|
-
* @param user
|
|
539
|
-
*/
|
|
540
|
-
getCredentials(user?: string): T;
|
|
541
|
-
}
|
|
542
|
-
declare enum AuthInfoType {
|
|
543
|
-
COOKIE = "cookie",
|
|
544
|
-
HEADER = "header",
|
|
545
|
-
URL = "url",
|
|
546
|
-
METADATA = "metadata"
|
|
547
|
-
}
|
|
548
|
-
interface ClientAuthResponse {
|
|
549
|
-
getAuthInfoType(): AuthInfoType;
|
|
550
|
-
getAuthInfo(): {
|
|
551
|
-
key: string;
|
|
552
|
-
value: string;
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
type AuthOptions = {
|
|
556
|
-
provider: ClientAuthProvider | string | undefined;
|
|
557
|
-
credentialsProvider?: ClientAuthCredentialsProvider<any> | undefined;
|
|
558
|
-
configProvider?: ClientAuthConfigurationProvider<any> | undefined;
|
|
559
|
-
credentials?: any | undefined;
|
|
560
|
-
providerOptions?: any | undefined;
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
interface IEmbeddingFunction {
|
|
564
|
-
generate(texts: string[]): Promise<number[][]>;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
declare enum IncludeEnum {
|
|
568
|
-
Documents = "documents",
|
|
569
|
-
Embeddings = "embeddings",
|
|
570
|
-
Metadatas = "metadatas",
|
|
571
|
-
Distances = "distances"
|
|
572
|
-
}
|
|
573
|
-
type Number = number;
|
|
574
|
-
type Embedding = Array<Number>;
|
|
575
|
-
type Embeddings = Array<Embedding>;
|
|
576
|
-
type Metadata = Record<string, string | number | boolean>;
|
|
577
|
-
type Metadatas = Array<Metadata>;
|
|
578
|
-
type Document = string;
|
|
579
|
-
type Documents = Array<Document>;
|
|
580
|
-
type ID = string;
|
|
581
|
-
type IDs = ID[];
|
|
582
|
-
type PositiveInteger = number;
|
|
583
|
-
type LiteralValue = string | number | boolean;
|
|
584
|
-
type ListLiteralValue = LiteralValue[];
|
|
585
|
-
type LiteralNumber = number;
|
|
586
|
-
type LogicalOperator = "$and" | "$or";
|
|
587
|
-
type InclusionOperator = "$in" | "$nin";
|
|
588
|
-
type WhereOperator = "$gt" | "$gte" | "$lt" | "$lte" | "$ne" | "$eq";
|
|
589
|
-
type OperatorExpression = {
|
|
590
|
-
[key in WhereOperator | InclusionOperator | LogicalOperator]?: LiteralValue | ListLiteralValue;
|
|
591
|
-
};
|
|
592
|
-
type BaseWhere = {
|
|
593
|
-
[key: string]: LiteralValue | OperatorExpression;
|
|
594
|
-
};
|
|
595
|
-
type LogicalWhere = {
|
|
596
|
-
[key in LogicalOperator]?: Where[];
|
|
597
|
-
};
|
|
598
|
-
type Where = BaseWhere | LogicalWhere;
|
|
599
|
-
type WhereDocumentOperator = "$contains" | LogicalOperator;
|
|
600
|
-
type WhereDocument = {
|
|
601
|
-
[key in WhereDocumentOperator]?: LiteralValue | LiteralNumber | WhereDocument[];
|
|
602
|
-
};
|
|
603
|
-
type CollectionType = {
|
|
604
|
-
name: string;
|
|
605
|
-
id: string;
|
|
606
|
-
metadata: Metadata | null;
|
|
607
|
-
};
|
|
608
|
-
type GetResponse = {
|
|
609
|
-
ids: IDs;
|
|
610
|
-
embeddings: null | Embeddings;
|
|
611
|
-
documents: (null | Document)[];
|
|
612
|
-
metadatas: (null | Metadata)[];
|
|
613
|
-
error: null | string;
|
|
614
|
-
};
|
|
615
|
-
type QueryResponse = {
|
|
616
|
-
ids: IDs[];
|
|
617
|
-
embeddings: null | Embeddings[];
|
|
618
|
-
documents: (null | Document)[][];
|
|
619
|
-
metadatas: (null | Metadata)[][];
|
|
620
|
-
distances: null | number[][];
|
|
621
|
-
};
|
|
622
|
-
type AddResponse = {
|
|
623
|
-
error: string;
|
|
624
|
-
};
|
|
625
|
-
type CollectionMetadata = Record<string, unknown>;
|
|
626
|
-
type GetParams = {
|
|
627
|
-
ids?: ID | IDs;
|
|
628
|
-
where?: Where;
|
|
629
|
-
limit?: PositiveInteger;
|
|
630
|
-
offset?: PositiveInteger;
|
|
631
|
-
include?: IncludeEnum[];
|
|
632
|
-
whereDocument?: WhereDocument;
|
|
633
|
-
};
|
|
634
|
-
type ListCollectionsParams = {
|
|
635
|
-
limit?: PositiveInteger;
|
|
636
|
-
offset?: PositiveInteger;
|
|
637
|
-
};
|
|
638
|
-
type ChromaClientParams = {
|
|
639
|
-
path?: string;
|
|
640
|
-
fetchOptions?: RequestInit;
|
|
641
|
-
auth?: AuthOptions;
|
|
642
|
-
tenant?: string;
|
|
643
|
-
database?: string;
|
|
644
|
-
};
|
|
645
|
-
type CreateCollectionParams = {
|
|
646
|
-
name: string;
|
|
647
|
-
metadata?: CollectionMetadata;
|
|
648
|
-
embeddingFunction?: IEmbeddingFunction;
|
|
649
|
-
};
|
|
650
|
-
type GetOrCreateCollectionParams = CreateCollectionParams;
|
|
651
|
-
type GetCollectionParams = {
|
|
652
|
-
name: string;
|
|
653
|
-
embeddingFunction?: IEmbeddingFunction;
|
|
654
|
-
};
|
|
655
|
-
type DeleteCollectionParams = {
|
|
656
|
-
name: string;
|
|
657
|
-
};
|
|
658
|
-
type AddParams = {
|
|
659
|
-
ids: ID | IDs;
|
|
660
|
-
embeddings?: Embedding | Embeddings;
|
|
661
|
-
metadatas?: Metadata | Metadatas;
|
|
662
|
-
documents?: Document | Documents;
|
|
663
|
-
};
|
|
664
|
-
type UpsertParams = AddParams;
|
|
665
|
-
type UpdateParams = AddParams;
|
|
666
|
-
type ModifyCollectionParams = {
|
|
667
|
-
name?: string;
|
|
668
|
-
metadata?: CollectionMetadata;
|
|
669
|
-
};
|
|
670
|
-
type QueryParams = {
|
|
671
|
-
queryEmbeddings?: Embedding | Embeddings;
|
|
672
|
-
nResults?: PositiveInteger;
|
|
673
|
-
where?: Where;
|
|
674
|
-
queryTexts?: string | string[];
|
|
675
|
-
whereDocument?: WhereDocument;
|
|
676
|
-
include?: IncludeEnum[];
|
|
677
|
-
};
|
|
678
|
-
type PeekParams = {
|
|
679
|
-
limit?: PositiveInteger;
|
|
680
|
-
};
|
|
681
|
-
type DeleteParams = {
|
|
682
|
-
ids?: ID | IDs;
|
|
683
|
-
where?: Where;
|
|
684
|
-
whereDocument?: WhereDocument;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
502
|
declare class Collection {
|
|
688
503
|
name: string;
|
|
689
504
|
id: string;
|
|
@@ -731,7 +546,12 @@ declare class Collection {
|
|
|
731
546
|
* });
|
|
732
547
|
* ```
|
|
733
548
|
*/
|
|
734
|
-
add({ ids, embeddings, metadatas, documents, }:
|
|
549
|
+
add({ ids, embeddings, metadatas, documents, }: {
|
|
550
|
+
ids: ID | IDs;
|
|
551
|
+
embeddings?: Embedding | Embeddings;
|
|
552
|
+
metadatas?: Metadata | Metadatas;
|
|
553
|
+
documents?: Document | Documents;
|
|
554
|
+
}): Promise<AddResponse>;
|
|
735
555
|
/**
|
|
736
556
|
* Upsert items to the collection
|
|
737
557
|
* @param {Object} params - The parameters for the query.
|
|
@@ -751,7 +571,12 @@ declare class Collection {
|
|
|
751
571
|
* });
|
|
752
572
|
* ```
|
|
753
573
|
*/
|
|
754
|
-
upsert({ ids, embeddings, metadatas, documents, }:
|
|
574
|
+
upsert({ ids, embeddings, metadatas, documents, }: {
|
|
575
|
+
ids: ID | IDs;
|
|
576
|
+
embeddings?: Embedding | Embeddings;
|
|
577
|
+
metadatas?: Metadata | Metadatas;
|
|
578
|
+
documents?: Document | Documents;
|
|
579
|
+
}): Promise<boolean>;
|
|
755
580
|
/**
|
|
756
581
|
* Count the number of items in the collection
|
|
757
582
|
* @returns {Promise<number>} - The response from the API.
|
|
@@ -777,7 +602,10 @@ declare class Collection {
|
|
|
777
602
|
* });
|
|
778
603
|
* ```
|
|
779
604
|
*/
|
|
780
|
-
modify({ name, metadata }?:
|
|
605
|
+
modify({ name, metadata }?: {
|
|
606
|
+
name?: string;
|
|
607
|
+
metadata?: CollectionMetadata;
|
|
608
|
+
}): Promise<void>;
|
|
781
609
|
/**
|
|
782
610
|
* Get items from the collection
|
|
783
611
|
* @param {Object} params - The parameters for the query.
|
|
@@ -801,7 +629,14 @@ declare class Collection {
|
|
|
801
629
|
* });
|
|
802
630
|
* ```
|
|
803
631
|
*/
|
|
804
|
-
get({ ids, where, limit, offset, include, whereDocument, }?:
|
|
632
|
+
get({ ids, where, limit, offset, include, whereDocument, }?: {
|
|
633
|
+
ids?: ID | IDs;
|
|
634
|
+
where?: Where;
|
|
635
|
+
limit?: PositiveInteger;
|
|
636
|
+
offset?: PositiveInteger;
|
|
637
|
+
include?: IncludeEnum[];
|
|
638
|
+
whereDocument?: WhereDocument;
|
|
639
|
+
}): Promise<GetResponse>;
|
|
805
640
|
/**
|
|
806
641
|
* Update the embeddings, documents, and/or metadatas of existing items
|
|
807
642
|
* @param {Object} params - The parameters for the query.
|
|
@@ -821,7 +656,12 @@ declare class Collection {
|
|
|
821
656
|
* });
|
|
822
657
|
* ```
|
|
823
658
|
*/
|
|
824
|
-
update({ ids, embeddings, metadatas, documents, }:
|
|
659
|
+
update({ ids, embeddings, metadatas, documents, }: {
|
|
660
|
+
ids: ID | IDs;
|
|
661
|
+
embeddings?: Embedding | Embeddings;
|
|
662
|
+
metadatas?: Metadata | Metadatas;
|
|
663
|
+
documents?: Document | Documents;
|
|
664
|
+
}): Promise<boolean>;
|
|
825
665
|
/**
|
|
826
666
|
* Performs a query on the collection using the specified parameters.
|
|
827
667
|
*
|
|
@@ -855,7 +695,14 @@ declare class Collection {
|
|
|
855
695
|
* ```
|
|
856
696
|
*
|
|
857
697
|
*/
|
|
858
|
-
query({ queryEmbeddings, nResults, where, queryTexts, whereDocument, include, }:
|
|
698
|
+
query({ queryEmbeddings, nResults, where, queryTexts, whereDocument, include, }: {
|
|
699
|
+
queryEmbeddings?: Embedding | Embeddings;
|
|
700
|
+
nResults?: PositiveInteger;
|
|
701
|
+
where?: Where;
|
|
702
|
+
queryTexts?: string | string[];
|
|
703
|
+
whereDocument?: WhereDocument;
|
|
704
|
+
include?: IncludeEnum[];
|
|
705
|
+
}): Promise<QueryResponse>;
|
|
859
706
|
/**
|
|
860
707
|
* Peek inside the collection
|
|
861
708
|
* @param {Object} params - The parameters for the query.
|
|
@@ -870,7 +717,9 @@ declare class Collection {
|
|
|
870
717
|
* });
|
|
871
718
|
* ```
|
|
872
719
|
*/
|
|
873
|
-
peek({ limit }?:
|
|
720
|
+
peek({ limit }?: {
|
|
721
|
+
limit?: PositiveInteger;
|
|
722
|
+
}): Promise<GetResponse>;
|
|
874
723
|
/**
|
|
875
724
|
* Deletes items from the collection.
|
|
876
725
|
* @param {Object} params - The parameters for deleting items from the collection.
|
|
@@ -889,18 +738,59 @@ declare class Collection {
|
|
|
889
738
|
* });
|
|
890
739
|
* ```
|
|
891
740
|
*/
|
|
892
|
-
delete({ ids, where, whereDocument }?:
|
|
741
|
+
delete({ ids, where, whereDocument }?: {
|
|
742
|
+
ids?: ID | IDs;
|
|
743
|
+
where?: Where;
|
|
744
|
+
whereDocument?: WhereDocument;
|
|
745
|
+
}): Promise<string[]>;
|
|
893
746
|
}
|
|
894
747
|
|
|
748
|
+
interface ClientAuthProvider {
|
|
749
|
+
/**
|
|
750
|
+
* Abstract method for authenticating a client.
|
|
751
|
+
*/
|
|
752
|
+
authenticate(): ClientAuthResponse;
|
|
753
|
+
}
|
|
754
|
+
interface ClientAuthConfigurationProvider<T> {
|
|
755
|
+
/**
|
|
756
|
+
* Abstract method for getting the configuration for the client.
|
|
757
|
+
*/
|
|
758
|
+
getConfig(): T;
|
|
759
|
+
}
|
|
760
|
+
interface ClientAuthCredentialsProvider<T> {
|
|
761
|
+
/**
|
|
762
|
+
* Abstract method for getting the credentials for the client.
|
|
763
|
+
* @param user
|
|
764
|
+
*/
|
|
765
|
+
getCredentials(user?: string): T;
|
|
766
|
+
}
|
|
767
|
+
declare enum AuthInfoType {
|
|
768
|
+
COOKIE = "cookie",
|
|
769
|
+
HEADER = "header",
|
|
770
|
+
URL = "url",
|
|
771
|
+
METADATA = "metadata"
|
|
772
|
+
}
|
|
773
|
+
interface ClientAuthResponse {
|
|
774
|
+
getAuthInfoType(): AuthInfoType;
|
|
775
|
+
getAuthInfo(): {
|
|
776
|
+
key: string;
|
|
777
|
+
value: string;
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
type AuthOptions = {
|
|
781
|
+
provider: ClientAuthProvider | string | undefined;
|
|
782
|
+
credentialsProvider?: ClientAuthCredentialsProvider<any> | undefined;
|
|
783
|
+
configProvider?: ClientAuthConfigurationProvider<any> | undefined;
|
|
784
|
+
credentials?: any | undefined;
|
|
785
|
+
providerOptions?: any | undefined;
|
|
786
|
+
};
|
|
787
|
+
|
|
895
788
|
declare class ChromaClient {
|
|
896
789
|
/**
|
|
897
790
|
* @ignore
|
|
898
791
|
*/
|
|
899
792
|
private api;
|
|
900
793
|
private apiAdapter;
|
|
901
|
-
private tenant;
|
|
902
|
-
private database;
|
|
903
|
-
private _adminClient?;
|
|
904
794
|
/**
|
|
905
795
|
* Creates a new ChromaClient instance.
|
|
906
796
|
* @param {Object} params - The parameters for creating a new client
|
|
@@ -914,7 +804,11 @@ declare class ChromaClient {
|
|
|
914
804
|
* });
|
|
915
805
|
* ```
|
|
916
806
|
*/
|
|
917
|
-
constructor({ path, fetchOptions, auth,
|
|
807
|
+
constructor({ path, fetchOptions, auth, }?: {
|
|
808
|
+
path?: string;
|
|
809
|
+
fetchOptions?: RequestInit;
|
|
810
|
+
auth?: AuthOptions;
|
|
811
|
+
});
|
|
918
812
|
/**
|
|
919
813
|
* Resets the state of the object by making an API call to the reset endpoint.
|
|
920
814
|
*
|
|
@@ -968,7 +862,11 @@ declare class ChromaClient {
|
|
|
968
862
|
* });
|
|
969
863
|
* ```
|
|
970
864
|
*/
|
|
971
|
-
createCollection({ name, metadata, embeddingFunction }:
|
|
865
|
+
createCollection({ name, metadata, embeddingFunction }: {
|
|
866
|
+
name: string;
|
|
867
|
+
metadata?: CollectionMetadata;
|
|
868
|
+
embeddingFunction?: IEmbeddingFunction;
|
|
869
|
+
}): Promise<Collection>;
|
|
972
870
|
/**
|
|
973
871
|
* Gets or creates a collection with the specified properties.
|
|
974
872
|
*
|
|
@@ -990,36 +888,23 @@ declare class ChromaClient {
|
|
|
990
888
|
* });
|
|
991
889
|
* ```
|
|
992
890
|
*/
|
|
993
|
-
getOrCreateCollection({ name, metadata, embeddingFunction }:
|
|
891
|
+
getOrCreateCollection({ name, metadata, embeddingFunction }: {
|
|
892
|
+
name: string;
|
|
893
|
+
metadata?: CollectionMetadata;
|
|
894
|
+
embeddingFunction?: IEmbeddingFunction;
|
|
895
|
+
}): Promise<Collection>;
|
|
994
896
|
/**
|
|
995
897
|
* Lists all collections.
|
|
996
898
|
*
|
|
997
899
|
* @returns {Promise<CollectionType[]>} A promise that resolves to a list of collection names.
|
|
998
|
-
* @param {PositiveInteger} [params.limit] - Optional limit on the number of items to get.
|
|
999
|
-
* @param {PositiveInteger} [params.offset] - Optional offset on the items to get.
|
|
1000
900
|
* @throws {Error} If there is an issue listing the collections.
|
|
1001
901
|
*
|
|
1002
902
|
* @example
|
|
1003
903
|
* ```typescript
|
|
1004
|
-
* const collections = await client.listCollections(
|
|
1005
|
-
* limit: 10,
|
|
1006
|
-
* offset: 0,
|
|
1007
|
-
* });
|
|
904
|
+
* const collections = await client.listCollections();
|
|
1008
905
|
* ```
|
|
1009
906
|
*/
|
|
1010
|
-
listCollections(
|
|
1011
|
-
/**
|
|
1012
|
-
* Counts all collections.
|
|
1013
|
-
*
|
|
1014
|
-
* @returns {Promise<number>} A promise that resolves to the number of collections.
|
|
1015
|
-
* @throws {Error} If there is an issue counting the collections.
|
|
1016
|
-
*
|
|
1017
|
-
* @example
|
|
1018
|
-
* ```typescript
|
|
1019
|
-
* const collections = await client.countCollections();
|
|
1020
|
-
* ```
|
|
1021
|
-
*/
|
|
1022
|
-
countCollections(): Promise<number>;
|
|
907
|
+
listCollections(): Promise<CollectionType[]>;
|
|
1023
908
|
/**
|
|
1024
909
|
* Gets a collection with the specified name.
|
|
1025
910
|
* @param {Object} params - The parameters for getting a collection.
|
|
@@ -1035,7 +920,10 @@ declare class ChromaClient {
|
|
|
1035
920
|
* });
|
|
1036
921
|
* ```
|
|
1037
922
|
*/
|
|
1038
|
-
getCollection({ name, embeddingFunction }:
|
|
923
|
+
getCollection({ name, embeddingFunction }: {
|
|
924
|
+
name: string;
|
|
925
|
+
embeddingFunction?: IEmbeddingFunction;
|
|
926
|
+
}): Promise<Collection>;
|
|
1039
927
|
/**
|
|
1040
928
|
* Deletes a collection with the specified name.
|
|
1041
929
|
* @param {Object} params - The parameters for deleting a collection.
|
|
@@ -1050,176 +938,9 @@ declare class ChromaClient {
|
|
|
1050
938
|
* });
|
|
1051
939
|
* ```
|
|
1052
940
|
*/
|
|
1053
|
-
deleteCollection({ name }:
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
interface Tenant {
|
|
1057
|
-
name: string;
|
|
1058
|
-
}
|
|
1059
|
-
interface Database {
|
|
1060
|
-
name: string;
|
|
1061
|
-
}
|
|
1062
|
-
declare class AdminClient {
|
|
1063
|
-
/**
|
|
1064
|
-
* @ignore
|
|
1065
|
-
*/
|
|
1066
|
-
private api;
|
|
1067
|
-
private apiAdapter;
|
|
1068
|
-
tenant: string;
|
|
1069
|
-
database: string;
|
|
1070
|
-
/**
|
|
1071
|
-
* Creates a new AdminClient instance.
|
|
1072
|
-
* @param {Object} params - The parameters for creating a new client
|
|
1073
|
-
* @param {string} [params.path] - The base path for the Chroma API.
|
|
1074
|
-
* @returns {AdminClient} A new AdminClient instance.
|
|
1075
|
-
*
|
|
1076
|
-
* @example
|
|
1077
|
-
* ```typescript
|
|
1078
|
-
* const client = new AdminClient({
|
|
1079
|
-
* path: "http://localhost:8000"
|
|
1080
|
-
* });
|
|
1081
|
-
* ```
|
|
1082
|
-
*/
|
|
1083
|
-
constructor({ path, fetchOptions, auth, tenant, database }?: {
|
|
1084
|
-
path?: string;
|
|
1085
|
-
fetchOptions?: RequestInit;
|
|
1086
|
-
auth?: AuthOptions;
|
|
1087
|
-
tenant?: string;
|
|
1088
|
-
database?: string;
|
|
1089
|
-
});
|
|
1090
|
-
/**
|
|
1091
|
-
* Sets the tenant and database for the client.
|
|
1092
|
-
*
|
|
1093
|
-
* @param {Object} params - The parameters for setting tenant and database.
|
|
1094
|
-
* @param {string} params.tenant - The name of the tenant.
|
|
1095
|
-
* @param {string} params.database - The name of the database.
|
|
1096
|
-
*
|
|
1097
|
-
* @returns {Promise<void>} A promise that returns nothing
|
|
1098
|
-
* @throws {Error} Any issues
|
|
1099
|
-
*
|
|
1100
|
-
* @example
|
|
1101
|
-
* ```typescript
|
|
1102
|
-
* await adminClient.setTenant({
|
|
1103
|
-
* tenant: "my_tenant",
|
|
1104
|
-
* database: "my_database",
|
|
1105
|
-
* });
|
|
1106
|
-
* ```
|
|
1107
|
-
*/
|
|
1108
|
-
setTenant({ tenant, database }: {
|
|
1109
|
-
tenant: string;
|
|
1110
|
-
database?: string;
|
|
1111
|
-
}): Promise<void>;
|
|
1112
|
-
/**
|
|
1113
|
-
* Sets the database for the client.
|
|
1114
|
-
*
|
|
1115
|
-
* @param {Object} params - The parameters for setting the database.
|
|
1116
|
-
* @param {string} params.database - The name of the database.
|
|
1117
|
-
*
|
|
1118
|
-
* @returns {Promise<void>} A promise that returns nothing
|
|
1119
|
-
* @throws {Error} Any issues
|
|
1120
|
-
*
|
|
1121
|
-
* @example
|
|
1122
|
-
* ```typescript
|
|
1123
|
-
* await adminClient.setDatabase({
|
|
1124
|
-
* database: "my_database",
|
|
1125
|
-
* });
|
|
1126
|
-
* ```
|
|
1127
|
-
*/
|
|
1128
|
-
setDatabase({ database }: {
|
|
1129
|
-
database?: string;
|
|
1130
|
-
}): Promise<void>;
|
|
1131
|
-
/**
|
|
1132
|
-
* Creates a new tenant with the specified properties.
|
|
1133
|
-
*
|
|
1134
|
-
* @param {Object} params - The parameters for creating a new tenant.
|
|
1135
|
-
* @param {string} params.name - The name of the tenant.
|
|
1136
|
-
*
|
|
1137
|
-
* @returns {Promise<Tenant>} A promise that resolves to the created tenant.
|
|
1138
|
-
* @throws {Error} If there is an issue creating the tenant.
|
|
1139
|
-
*
|
|
1140
|
-
* @example
|
|
1141
|
-
* ```typescript
|
|
1142
|
-
* await adminClient.createTenant({
|
|
1143
|
-
* name: "my_tenant",
|
|
1144
|
-
* });
|
|
1145
|
-
* ```
|
|
1146
|
-
*/
|
|
1147
|
-
createTenant({ name, }: {
|
|
941
|
+
deleteCollection({ name }: {
|
|
1148
942
|
name: string;
|
|
1149
|
-
}): Promise<
|
|
1150
|
-
/**
|
|
1151
|
-
* Gets a tenant with the specified properties.
|
|
1152
|
-
*
|
|
1153
|
-
* @param {Object} params - The parameters for getting a tenant.
|
|
1154
|
-
* @param {string} params.name - The name of the tenant.
|
|
1155
|
-
*
|
|
1156
|
-
* @returns {Promise<Tenant>} A promise that resolves to the tenant.
|
|
1157
|
-
* @throws {Error} If there is an issue getting the tenant.
|
|
1158
|
-
*
|
|
1159
|
-
* @example
|
|
1160
|
-
* ```typescript
|
|
1161
|
-
* await adminClient.getTenant({
|
|
1162
|
-
* name: "my_tenant",
|
|
1163
|
-
* });
|
|
1164
|
-
* ```
|
|
1165
|
-
*/
|
|
1166
|
-
getTenant({ name, }: {
|
|
1167
|
-
name: string;
|
|
1168
|
-
}): Promise<Tenant>;
|
|
1169
|
-
/**
|
|
1170
|
-
* Creates a new database with the specified properties.
|
|
1171
|
-
*
|
|
1172
|
-
* @param {Object} params - The parameters for creating a new database.
|
|
1173
|
-
* @param {string} params.name - The name of the database.
|
|
1174
|
-
* @param {string} params.tenantName - The name of the tenant.
|
|
1175
|
-
*
|
|
1176
|
-
* @returns {Promise<Database>} A promise that resolves to the created database.
|
|
1177
|
-
* @throws {Error} If there is an issue creating the database.
|
|
1178
|
-
*
|
|
1179
|
-
* @example
|
|
1180
|
-
* ```typescript
|
|
1181
|
-
* await adminClient.createDatabase({
|
|
1182
|
-
* name: "my_database",
|
|
1183
|
-
* tenantName: "my_tenant",
|
|
1184
|
-
* });
|
|
1185
|
-
* ```
|
|
1186
|
-
*/
|
|
1187
|
-
createDatabase({ name, tenantName }: {
|
|
1188
|
-
name: string;
|
|
1189
|
-
tenantName: string;
|
|
1190
|
-
}): Promise<Database>;
|
|
1191
|
-
/**
|
|
1192
|
-
* Gets a database with the specified properties.
|
|
1193
|
-
*
|
|
1194
|
-
* @param {Object} params - The parameters for getting a database.
|
|
1195
|
-
* @param {string} params.name - The name of the database.
|
|
1196
|
-
* @param {string} params.tenantName - The name of the tenant.
|
|
1197
|
-
*
|
|
1198
|
-
* @returns {Promise<Database>} A promise that resolves to the database.
|
|
1199
|
-
* @throws {Error} If there is an issue getting the database.
|
|
1200
|
-
*
|
|
1201
|
-
* @example
|
|
1202
|
-
* ```typescript
|
|
1203
|
-
* await adminClient.getDatabase({
|
|
1204
|
-
* name: "my_database",
|
|
1205
|
-
* tenantName: "my_tenant",
|
|
1206
|
-
* });
|
|
1207
|
-
* ```
|
|
1208
|
-
*/
|
|
1209
|
-
getDatabase({ name, tenantName }: {
|
|
1210
|
-
name: string;
|
|
1211
|
-
tenantName: string;
|
|
1212
|
-
}): Promise<Database>;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
interface CloudClientParams {
|
|
1216
|
-
apiKey?: string;
|
|
1217
|
-
database?: string;
|
|
1218
|
-
cloudHost?: string;
|
|
1219
|
-
cloudPort?: string;
|
|
1220
|
-
}
|
|
1221
|
-
declare class CloudClient extends ChromaClient {
|
|
1222
|
-
constructor({ apiKey, database, cloudHost, cloudPort }: CloudClientParams);
|
|
943
|
+
}): Promise<void>;
|
|
1223
944
|
}
|
|
1224
945
|
|
|
1225
946
|
declare class OpenAIEmbeddingFunction implements IEmbeddingFunction {
|
|
@@ -1257,41 +978,62 @@ declare class CohereEmbeddingFunction implements IEmbeddingFunction {
|
|
|
1257
978
|
}>;
|
|
1258
979
|
}
|
|
1259
980
|
|
|
1260
|
-
declare class
|
|
1261
|
-
private
|
|
981
|
+
declare class TransformersEmbeddingFunction implements IEmbeddingFunction {
|
|
982
|
+
private pipelinePromise?;
|
|
983
|
+
private transformersApi;
|
|
1262
984
|
private model;
|
|
1263
|
-
private
|
|
1264
|
-
private
|
|
1265
|
-
|
|
1266
|
-
|
|
985
|
+
private revision;
|
|
986
|
+
private quantized;
|
|
987
|
+
private progress_callback;
|
|
988
|
+
/**
|
|
989
|
+
* TransformersEmbeddingFunction constructor.
|
|
990
|
+
* @param options The configuration options.
|
|
991
|
+
* @param options.model The model to use to calculate embeddings. Defaults to 'Xenova/all-MiniLM-L6-v2', which is an ONNX port of `sentence-transformers/all-MiniLM-L6-v2`.
|
|
992
|
+
* @param options.revision The specific model version to use (can be a branch, tag name, or commit id). Defaults to 'main'.
|
|
993
|
+
* @param options.quantized Whether to load the 8-bit quantized version of the model. Defaults to `false`.
|
|
994
|
+
* @param options.progress_callback If specified, this function will be called during model construction, to provide the user with progress updates.
|
|
995
|
+
*/
|
|
996
|
+
constructor({ model, revision, quantized, progress_callback, }?: {
|
|
1267
997
|
model?: string;
|
|
1268
|
-
|
|
998
|
+
revision?: string;
|
|
999
|
+
quantized?: boolean;
|
|
1000
|
+
progress_callback?: Function | null;
|
|
1269
1001
|
});
|
|
1002
|
+
generate(texts: string[]): Promise<number[][]>;
|
|
1270
1003
|
private loadClient;
|
|
1271
|
-
generate(texts: string[]): Promise<any>;
|
|
1272
1004
|
/** @ignore */
|
|
1273
1005
|
static import(): Promise<{
|
|
1274
|
-
|
|
1006
|
+
pipeline: typeof _xenova_transformers;
|
|
1275
1007
|
}>;
|
|
1276
1008
|
}
|
|
1277
1009
|
|
|
1278
|
-
declare class
|
|
1279
|
-
private
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1010
|
+
declare class DefaultEmbeddingFunction implements IEmbeddingFunction {
|
|
1011
|
+
private pipelinePromise?;
|
|
1012
|
+
private transformersApi;
|
|
1013
|
+
private model;
|
|
1014
|
+
private revision;
|
|
1015
|
+
private quantized;
|
|
1016
|
+
private progress_callback;
|
|
1017
|
+
/**
|
|
1018
|
+
* DefaultEmbeddingFunction constructor.
|
|
1019
|
+
* @param options The configuration options.
|
|
1020
|
+
* @param options.model The model to use to calculate embeddings. Defaults to 'Xenova/all-MiniLM-L6-v2', which is an ONNX port of `sentence-transformers/all-MiniLM-L6-v2`.
|
|
1021
|
+
* @param options.revision The specific model version to use (can be a branch, tag name, or commit id). Defaults to 'main'.
|
|
1022
|
+
* @param options.quantized Whether to load the 8-bit quantized version of the model. Defaults to `false`.
|
|
1023
|
+
* @param options.progress_callback If specified, this function will be called during model construction, to provide the user with progress updates.
|
|
1024
|
+
*/
|
|
1025
|
+
constructor({ model, revision, quantized, progress_callback, }?: {
|
|
1026
|
+
model?: string;
|
|
1027
|
+
revision?: string;
|
|
1028
|
+
quantized?: boolean;
|
|
1029
|
+
progress_callback?: Function | null;
|
|
1293
1030
|
});
|
|
1294
|
-
generate(texts: string[]): Promise<
|
|
1031
|
+
generate(texts: string[]): Promise<number[][]>;
|
|
1032
|
+
private loadClient;
|
|
1033
|
+
/** @ignore */
|
|
1034
|
+
static import(): Promise<{
|
|
1035
|
+
pipeline: typeof chromadb_default_embed;
|
|
1036
|
+
}>;
|
|
1295
1037
|
}
|
|
1296
1038
|
|
|
1297
|
-
export {
|
|
1039
|
+
export { ChromaClient, CohereEmbeddingFunction, Collection, DefaultEmbeddingFunction, type IEmbeddingFunction, IncludeEnum, OpenAIEmbeddingFunction, TransformersEmbeddingFunction };
|