chromadb 1.7.2 → 1.7.3-beta1
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 +203 -491
- package/dist/chromadb.legacy-esm.js +101 -899
- package/dist/chromadb.mjs +101 -899
- package/dist/chromadb.mjs.map +1 -1
- package/dist/cjs/chromadb.cjs +103 -905
- package/dist/cjs/chromadb.cjs.map +1 -1
- package/dist/cjs/chromadb.d.cts +203 -491
- 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,70 @@
|
|
|
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
|
+
|
|
5
|
+
interface IEmbeddingFunction {
|
|
6
|
+
generate(texts: string[]): Promise<number[][]>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare enum IncludeEnum {
|
|
10
|
+
Documents = "documents",
|
|
11
|
+
Embeddings = "embeddings",
|
|
12
|
+
Metadatas = "metadatas",
|
|
13
|
+
Distances = "distances"
|
|
14
|
+
}
|
|
15
|
+
type Number = number;
|
|
16
|
+
type Embedding = Array<Number>;
|
|
17
|
+
type Embeddings = Array<Embedding>;
|
|
18
|
+
type Metadata = Record<string, string | number | boolean>;
|
|
19
|
+
type Metadatas = Array<Metadata>;
|
|
20
|
+
type Document = string;
|
|
21
|
+
type Documents = Array<Document>;
|
|
22
|
+
type ID = string;
|
|
23
|
+
type IDs = ID[];
|
|
24
|
+
type PositiveInteger = number;
|
|
25
|
+
type LiteralValue = string | number | boolean;
|
|
26
|
+
type ListLiteralValue = LiteralValue[];
|
|
27
|
+
type LiteralNumber = number;
|
|
28
|
+
type LogicalOperator = "$and" | "$or";
|
|
29
|
+
type InclusionOperator = "$in" | "$nin";
|
|
30
|
+
type WhereOperator = "$gt" | "$gte" | "$lt" | "$lte" | "$ne" | "$eq";
|
|
31
|
+
type OperatorExpression = {
|
|
32
|
+
[key in WhereOperator | InclusionOperator | LogicalOperator]?: LiteralValue | ListLiteralValue;
|
|
33
|
+
};
|
|
34
|
+
type BaseWhere = {
|
|
35
|
+
[key: string]: LiteralValue | OperatorExpression;
|
|
36
|
+
};
|
|
37
|
+
type LogicalWhere = {
|
|
38
|
+
[key in LogicalOperator]?: Where[];
|
|
39
|
+
};
|
|
40
|
+
type Where = BaseWhere | LogicalWhere;
|
|
41
|
+
type WhereDocumentOperator = "$contains" | LogicalOperator;
|
|
42
|
+
type WhereDocument = {
|
|
43
|
+
[key in WhereDocumentOperator]?: LiteralValue | LiteralNumber | WhereDocument[];
|
|
44
|
+
};
|
|
45
|
+
type CollectionType = {
|
|
46
|
+
name: string;
|
|
47
|
+
id: string;
|
|
48
|
+
metadata: Metadata | null;
|
|
49
|
+
};
|
|
50
|
+
type GetResponse = {
|
|
51
|
+
ids: IDs;
|
|
52
|
+
embeddings: null | Embeddings;
|
|
53
|
+
documents: (null | Document)[];
|
|
54
|
+
metadatas: (null | Metadata)[];
|
|
55
|
+
error: null | string;
|
|
56
|
+
};
|
|
57
|
+
type QueryResponse = {
|
|
58
|
+
ids: IDs[];
|
|
59
|
+
embeddings: null | Embeddings[];
|
|
60
|
+
documents: (null | Document)[][];
|
|
61
|
+
metadatas: (null | Metadata)[][];
|
|
62
|
+
distances: null | number[][];
|
|
63
|
+
};
|
|
64
|
+
type AddResponse = {
|
|
65
|
+
error: string;
|
|
66
|
+
};
|
|
67
|
+
type CollectionMetadata = Record<string, unknown>;
|
|
4
68
|
|
|
5
69
|
/**
|
|
6
70
|
* FastAPI
|
|
@@ -107,7 +171,6 @@ declare namespace Api {
|
|
|
107
171
|
embeddings?: Api.AddEmbedding.Embedding[];
|
|
108
172
|
metadatas?: Api.AddEmbedding.Metadata[];
|
|
109
173
|
documents?: string[];
|
|
110
|
-
uris?: string[];
|
|
111
174
|
ids: string[];
|
|
112
175
|
}
|
|
113
176
|
/**
|
|
@@ -126,8 +189,6 @@ declare namespace Api {
|
|
|
126
189
|
}
|
|
127
190
|
interface Count200Response {
|
|
128
191
|
}
|
|
129
|
-
interface CountCollections200Response {
|
|
130
|
-
}
|
|
131
192
|
interface CreateCollection {
|
|
132
193
|
name: string;
|
|
133
194
|
metadata?: Api.CreateCollection.Metadata;
|
|
@@ -143,16 +204,6 @@ declare namespace Api {
|
|
|
143
204
|
}
|
|
144
205
|
interface CreateCollection200Response {
|
|
145
206
|
}
|
|
146
|
-
interface CreateDatabase {
|
|
147
|
-
name: string;
|
|
148
|
-
}
|
|
149
|
-
interface CreateDatabase200Response {
|
|
150
|
-
}
|
|
151
|
-
interface CreateTenant {
|
|
152
|
-
name: string;
|
|
153
|
-
}
|
|
154
|
-
interface CreateTenant200Response {
|
|
155
|
-
}
|
|
156
207
|
interface DeleteCollection200Response {
|
|
157
208
|
}
|
|
158
209
|
interface DeleteEmbedding {
|
|
@@ -172,8 +223,6 @@ declare namespace Api {
|
|
|
172
223
|
}
|
|
173
224
|
interface GetCollection200Response {
|
|
174
225
|
}
|
|
175
|
-
interface GetDatabase200Response {
|
|
176
|
-
}
|
|
177
226
|
interface GetEmbedding {
|
|
178
227
|
ids?: string[];
|
|
179
228
|
where?: Api.GetEmbedding.Where;
|
|
@@ -189,7 +238,7 @@ declare namespace Api {
|
|
|
189
238
|
* @memberof GetEmbedding
|
|
190
239
|
*/
|
|
191
240
|
offset?: number;
|
|
192
|
-
include?: (Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4
|
|
241
|
+
include?: (Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4)[];
|
|
193
242
|
}
|
|
194
243
|
/**
|
|
195
244
|
* @export
|
|
@@ -200,7 +249,7 @@ declare namespace Api {
|
|
|
200
249
|
}
|
|
201
250
|
interface WhereDocument {
|
|
202
251
|
}
|
|
203
|
-
type Include = Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4
|
|
252
|
+
type Include = Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4;
|
|
204
253
|
/**
|
|
205
254
|
* @export
|
|
206
255
|
* @namespace Include
|
|
@@ -218,25 +267,15 @@ declare namespace Api {
|
|
|
218
267
|
enum EnumValueEnum4 {
|
|
219
268
|
Distances = "distances"
|
|
220
269
|
}
|
|
221
|
-
enum EnumValueEnum5 {
|
|
222
|
-
Uris = "uris"
|
|
223
|
-
}
|
|
224
|
-
enum EnumValueEnum6 {
|
|
225
|
-
Data = "data"
|
|
226
|
-
}
|
|
227
270
|
}
|
|
228
271
|
}
|
|
229
272
|
interface GetNearestNeighbors200Response {
|
|
230
273
|
}
|
|
231
|
-
interface GetTenant200Response {
|
|
232
|
-
}
|
|
233
274
|
interface HTTPValidationError {
|
|
234
275
|
detail?: Api.ValidationError[];
|
|
235
276
|
}
|
|
236
277
|
interface ListCollections200Response {
|
|
237
278
|
}
|
|
238
|
-
interface PreFlightChecks200Response {
|
|
239
|
-
}
|
|
240
279
|
interface QueryEmbedding {
|
|
241
280
|
where?: Api.QueryEmbedding.Where;
|
|
242
281
|
'where_document'?: Api.QueryEmbedding.WhereDocument;
|
|
@@ -246,7 +285,7 @@ declare namespace Api {
|
|
|
246
285
|
* @memberof QueryEmbedding
|
|
247
286
|
*/
|
|
248
287
|
'n_results'?: number;
|
|
249
|
-
include?: (Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4
|
|
288
|
+
include?: (Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4)[];
|
|
250
289
|
}
|
|
251
290
|
/**
|
|
252
291
|
* @export
|
|
@@ -259,7 +298,7 @@ declare namespace Api {
|
|
|
259
298
|
}
|
|
260
299
|
interface QueryEmbedding2 {
|
|
261
300
|
}
|
|
262
|
-
type Include = Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4
|
|
301
|
+
type Include = Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4;
|
|
263
302
|
/**
|
|
264
303
|
* @export
|
|
265
304
|
* @namespace Include
|
|
@@ -277,12 +316,6 @@ declare namespace Api {
|
|
|
277
316
|
enum EnumValueEnum4 {
|
|
278
317
|
Distances = "distances"
|
|
279
318
|
}
|
|
280
|
-
enum EnumValueEnum5 {
|
|
281
|
-
Uris = "uris"
|
|
282
|
-
}
|
|
283
|
-
enum EnumValueEnum6 {
|
|
284
|
-
Data = "data"
|
|
285
|
-
}
|
|
286
319
|
}
|
|
287
320
|
}
|
|
288
321
|
interface Update200Response {
|
|
@@ -305,7 +338,6 @@ declare namespace Api {
|
|
|
305
338
|
embeddings?: Api.UpdateEmbedding.Embedding[];
|
|
306
339
|
metadatas?: Api.UpdateEmbedding.Metadata[];
|
|
307
340
|
documents?: string[];
|
|
308
|
-
uris?: string[];
|
|
309
341
|
ids: string[];
|
|
310
342
|
}
|
|
311
343
|
/**
|
|
@@ -377,64 +409,27 @@ declare class ApiApi extends BaseAPI {
|
|
|
377
409
|
* @throws {RequiredError}
|
|
378
410
|
*/
|
|
379
411
|
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
412
|
/**
|
|
389
413
|
* @summary Create Collection
|
|
390
|
-
* @param {string} [tenant]
|
|
391
|
-
* @param {string} [database]
|
|
392
414
|
* @param {Api.CreateCollection} request
|
|
393
415
|
* @param {RequestInit} [options] Override http request option.
|
|
394
416
|
* @throws {RequiredError}
|
|
395
417
|
*/
|
|
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>;
|
|
418
|
+
createCollection(request: Api.CreateCollection, options?: RequestInit): Promise<Api.CreateCollection200Response>;
|
|
412
419
|
/**
|
|
413
420
|
* @summary Delete Collection
|
|
414
421
|
* @param {string} collectionName
|
|
415
|
-
* @param {string} [tenant]
|
|
416
|
-
* @param {string} [database]
|
|
417
422
|
* @param {RequestInit} [options] Override http request option.
|
|
418
423
|
* @throws {RequiredError}
|
|
419
424
|
*/
|
|
420
|
-
deleteCollection(collectionName: string,
|
|
425
|
+
deleteCollection(collectionName: string, options?: RequestInit): Promise<Api.DeleteCollection200Response>;
|
|
421
426
|
/**
|
|
422
427
|
* @summary Get Collection
|
|
423
428
|
* @param {string} collectionName
|
|
424
|
-
* @param {string} [tenant]
|
|
425
|
-
* @param {string} [database]
|
|
426
|
-
* @param {RequestInit} [options] Override http request option.
|
|
427
|
-
* @throws {RequiredError}
|
|
428
|
-
*/
|
|
429
|
-
getCollection(collectionName: string, tenant: string | undefined, database: string | undefined, options?: RequestInit): Promise<Api.GetCollection200Response>;
|
|
430
|
-
/**
|
|
431
|
-
* @summary Get Database
|
|
432
|
-
* @param {string} database
|
|
433
|
-
* @param {string} [tenant]
|
|
434
429
|
* @param {RequestInit} [options] Override http request option.
|
|
435
430
|
* @throws {RequiredError}
|
|
436
431
|
*/
|
|
437
|
-
|
|
432
|
+
getCollection(collectionName: string, options?: RequestInit): Promise<Api.GetCollection200Response>;
|
|
438
433
|
/**
|
|
439
434
|
* @summary Get Nearest Neighbors
|
|
440
435
|
* @param {string} collectionId
|
|
@@ -443,13 +438,6 @@ declare class ApiApi extends BaseAPI {
|
|
|
443
438
|
* @throws {RequiredError}
|
|
444
439
|
*/
|
|
445
440
|
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
441
|
/**
|
|
454
442
|
* @summary Heartbeat
|
|
455
443
|
* @param {RequestInit} [options] Override http request option.
|
|
@@ -460,20 +448,10 @@ declare class ApiApi extends BaseAPI {
|
|
|
460
448
|
}>;
|
|
461
449
|
/**
|
|
462
450
|
* @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
451
|
* @param {RequestInit} [options] Override http request option.
|
|
474
452
|
* @throws {RequiredError}
|
|
475
453
|
*/
|
|
476
|
-
|
|
454
|
+
listCollections(options?: RequestInit): Promise<Api.ListCollections200Response>;
|
|
477
455
|
/**
|
|
478
456
|
* @summary Reset
|
|
479
457
|
* @param {RequestInit} [options] Override http request option.
|
|
@@ -520,170 +498,6 @@ declare class ApiApi extends BaseAPI {
|
|
|
520
498
|
version(options?: RequestInit): Promise<string>;
|
|
521
499
|
}
|
|
522
500
|
|
|
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
501
|
declare class Collection {
|
|
688
502
|
name: string;
|
|
689
503
|
id: string;
|
|
@@ -731,7 +545,12 @@ declare class Collection {
|
|
|
731
545
|
* });
|
|
732
546
|
* ```
|
|
733
547
|
*/
|
|
734
|
-
add({ ids, embeddings, metadatas, documents, }:
|
|
548
|
+
add({ ids, embeddings, metadatas, documents, }: {
|
|
549
|
+
ids: ID | IDs;
|
|
550
|
+
embeddings?: Embedding | Embeddings;
|
|
551
|
+
metadatas?: Metadata | Metadatas;
|
|
552
|
+
documents?: Document | Documents;
|
|
553
|
+
}): Promise<AddResponse>;
|
|
735
554
|
/**
|
|
736
555
|
* Upsert items to the collection
|
|
737
556
|
* @param {Object} params - The parameters for the query.
|
|
@@ -751,7 +570,12 @@ declare class Collection {
|
|
|
751
570
|
* });
|
|
752
571
|
* ```
|
|
753
572
|
*/
|
|
754
|
-
upsert({ ids, embeddings, metadatas, documents, }:
|
|
573
|
+
upsert({ ids, embeddings, metadatas, documents, }: {
|
|
574
|
+
ids: ID | IDs;
|
|
575
|
+
embeddings?: Embedding | Embeddings;
|
|
576
|
+
metadatas?: Metadata | Metadatas;
|
|
577
|
+
documents?: Document | Documents;
|
|
578
|
+
}): Promise<boolean>;
|
|
755
579
|
/**
|
|
756
580
|
* Count the number of items in the collection
|
|
757
581
|
* @returns {Promise<number>} - The response from the API.
|
|
@@ -777,7 +601,10 @@ declare class Collection {
|
|
|
777
601
|
* });
|
|
778
602
|
* ```
|
|
779
603
|
*/
|
|
780
|
-
modify({ name, metadata }?:
|
|
604
|
+
modify({ name, metadata }?: {
|
|
605
|
+
name?: string;
|
|
606
|
+
metadata?: CollectionMetadata;
|
|
607
|
+
}): Promise<void>;
|
|
781
608
|
/**
|
|
782
609
|
* Get items from the collection
|
|
783
610
|
* @param {Object} params - The parameters for the query.
|
|
@@ -801,7 +628,14 @@ declare class Collection {
|
|
|
801
628
|
* });
|
|
802
629
|
* ```
|
|
803
630
|
*/
|
|
804
|
-
get({ ids, where, limit, offset, include, whereDocument, }?:
|
|
631
|
+
get({ ids, where, limit, offset, include, whereDocument, }?: {
|
|
632
|
+
ids?: ID | IDs;
|
|
633
|
+
where?: Where;
|
|
634
|
+
limit?: PositiveInteger;
|
|
635
|
+
offset?: PositiveInteger;
|
|
636
|
+
include?: IncludeEnum[];
|
|
637
|
+
whereDocument?: WhereDocument;
|
|
638
|
+
}): Promise<GetResponse>;
|
|
805
639
|
/**
|
|
806
640
|
* Update the embeddings, documents, and/or metadatas of existing items
|
|
807
641
|
* @param {Object} params - The parameters for the query.
|
|
@@ -821,7 +655,12 @@ declare class Collection {
|
|
|
821
655
|
* });
|
|
822
656
|
* ```
|
|
823
657
|
*/
|
|
824
|
-
update({ ids, embeddings, metadatas, documents, }:
|
|
658
|
+
update({ ids, embeddings, metadatas, documents, }: {
|
|
659
|
+
ids: ID | IDs;
|
|
660
|
+
embeddings?: Embedding | Embeddings;
|
|
661
|
+
metadatas?: Metadata | Metadatas;
|
|
662
|
+
documents?: Document | Documents;
|
|
663
|
+
}): Promise<boolean>;
|
|
825
664
|
/**
|
|
826
665
|
* Performs a query on the collection using the specified parameters.
|
|
827
666
|
*
|
|
@@ -855,7 +694,14 @@ declare class Collection {
|
|
|
855
694
|
* ```
|
|
856
695
|
*
|
|
857
696
|
*/
|
|
858
|
-
query({ queryEmbeddings, nResults, where, queryTexts, whereDocument, include, }:
|
|
697
|
+
query({ queryEmbeddings, nResults, where, queryTexts, whereDocument, include, }: {
|
|
698
|
+
queryEmbeddings?: Embedding | Embeddings;
|
|
699
|
+
nResults?: PositiveInteger;
|
|
700
|
+
where?: Where;
|
|
701
|
+
queryTexts?: string | string[];
|
|
702
|
+
whereDocument?: WhereDocument;
|
|
703
|
+
include?: IncludeEnum[];
|
|
704
|
+
}): Promise<QueryResponse>;
|
|
859
705
|
/**
|
|
860
706
|
* Peek inside the collection
|
|
861
707
|
* @param {Object} params - The parameters for the query.
|
|
@@ -870,7 +716,9 @@ declare class Collection {
|
|
|
870
716
|
* });
|
|
871
717
|
* ```
|
|
872
718
|
*/
|
|
873
|
-
peek({ limit }?:
|
|
719
|
+
peek({ limit }?: {
|
|
720
|
+
limit?: PositiveInteger;
|
|
721
|
+
}): Promise<GetResponse>;
|
|
874
722
|
/**
|
|
875
723
|
* Deletes items from the collection.
|
|
876
724
|
* @param {Object} params - The parameters for deleting items from the collection.
|
|
@@ -889,8 +737,52 @@ declare class Collection {
|
|
|
889
737
|
* });
|
|
890
738
|
* ```
|
|
891
739
|
*/
|
|
892
|
-
delete({ ids, where, whereDocument }?:
|
|
740
|
+
delete({ ids, where, whereDocument }?: {
|
|
741
|
+
ids?: ID | IDs;
|
|
742
|
+
where?: Where;
|
|
743
|
+
whereDocument?: WhereDocument;
|
|
744
|
+
}): Promise<string[]>;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
interface ClientAuthProvider {
|
|
748
|
+
/**
|
|
749
|
+
* Abstract method for authenticating a client.
|
|
750
|
+
*/
|
|
751
|
+
authenticate(): ClientAuthResponse;
|
|
752
|
+
}
|
|
753
|
+
interface ClientAuthConfigurationProvider<T> {
|
|
754
|
+
/**
|
|
755
|
+
* Abstract method for getting the configuration for the client.
|
|
756
|
+
*/
|
|
757
|
+
getConfig(): T;
|
|
758
|
+
}
|
|
759
|
+
interface ClientAuthCredentialsProvider<T> {
|
|
760
|
+
/**
|
|
761
|
+
* Abstract method for getting the credentials for the client.
|
|
762
|
+
* @param user
|
|
763
|
+
*/
|
|
764
|
+
getCredentials(user?: string): T;
|
|
765
|
+
}
|
|
766
|
+
declare enum AuthInfoType {
|
|
767
|
+
COOKIE = "cookie",
|
|
768
|
+
HEADER = "header",
|
|
769
|
+
URL = "url",
|
|
770
|
+
METADATA = "metadata"
|
|
893
771
|
}
|
|
772
|
+
interface ClientAuthResponse {
|
|
773
|
+
getAuthInfoType(): AuthInfoType;
|
|
774
|
+
getAuthInfo(): {
|
|
775
|
+
key: string;
|
|
776
|
+
value: string;
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
type AuthOptions = {
|
|
780
|
+
provider: ClientAuthProvider | string | undefined;
|
|
781
|
+
credentialsProvider?: ClientAuthCredentialsProvider<any> | undefined;
|
|
782
|
+
configProvider?: ClientAuthConfigurationProvider<any> | undefined;
|
|
783
|
+
credentials?: any | undefined;
|
|
784
|
+
providerOptions?: any | undefined;
|
|
785
|
+
};
|
|
894
786
|
|
|
895
787
|
declare class ChromaClient {
|
|
896
788
|
/**
|
|
@@ -898,9 +790,6 @@ declare class ChromaClient {
|
|
|
898
790
|
*/
|
|
899
791
|
private api;
|
|
900
792
|
private apiAdapter;
|
|
901
|
-
private tenant;
|
|
902
|
-
private database;
|
|
903
|
-
private _adminClient?;
|
|
904
793
|
/**
|
|
905
794
|
* Creates a new ChromaClient instance.
|
|
906
795
|
* @param {Object} params - The parameters for creating a new client
|
|
@@ -914,7 +803,11 @@ declare class ChromaClient {
|
|
|
914
803
|
* });
|
|
915
804
|
* ```
|
|
916
805
|
*/
|
|
917
|
-
constructor({ path, fetchOptions, auth,
|
|
806
|
+
constructor({ path, fetchOptions, auth, }?: {
|
|
807
|
+
path?: string;
|
|
808
|
+
fetchOptions?: RequestInit;
|
|
809
|
+
auth?: AuthOptions;
|
|
810
|
+
});
|
|
918
811
|
/**
|
|
919
812
|
* Resets the state of the object by making an API call to the reset endpoint.
|
|
920
813
|
*
|
|
@@ -968,7 +861,11 @@ declare class ChromaClient {
|
|
|
968
861
|
* });
|
|
969
862
|
* ```
|
|
970
863
|
*/
|
|
971
|
-
createCollection({ name, metadata, embeddingFunction }:
|
|
864
|
+
createCollection({ name, metadata, embeddingFunction }: {
|
|
865
|
+
name: string;
|
|
866
|
+
metadata?: CollectionMetadata;
|
|
867
|
+
embeddingFunction?: IEmbeddingFunction;
|
|
868
|
+
}): Promise<Collection>;
|
|
972
869
|
/**
|
|
973
870
|
* Gets or creates a collection with the specified properties.
|
|
974
871
|
*
|
|
@@ -990,36 +887,23 @@ declare class ChromaClient {
|
|
|
990
887
|
* });
|
|
991
888
|
* ```
|
|
992
889
|
*/
|
|
993
|
-
getOrCreateCollection({ name, metadata, embeddingFunction }:
|
|
890
|
+
getOrCreateCollection({ name, metadata, embeddingFunction }: {
|
|
891
|
+
name: string;
|
|
892
|
+
metadata?: CollectionMetadata;
|
|
893
|
+
embeddingFunction?: IEmbeddingFunction;
|
|
894
|
+
}): Promise<Collection>;
|
|
994
895
|
/**
|
|
995
896
|
* Lists all collections.
|
|
996
897
|
*
|
|
997
898
|
* @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
899
|
* @throws {Error} If there is an issue listing the collections.
|
|
1001
900
|
*
|
|
1002
901
|
* @example
|
|
1003
902
|
* ```typescript
|
|
1004
|
-
* const collections = await client.listCollections(
|
|
1005
|
-
* limit: 10,
|
|
1006
|
-
* offset: 0,
|
|
1007
|
-
* });
|
|
903
|
+
* const collections = await client.listCollections();
|
|
1008
904
|
* ```
|
|
1009
905
|
*/
|
|
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>;
|
|
906
|
+
listCollections(): Promise<CollectionType[]>;
|
|
1023
907
|
/**
|
|
1024
908
|
* Gets a collection with the specified name.
|
|
1025
909
|
* @param {Object} params - The parameters for getting a collection.
|
|
@@ -1035,7 +919,10 @@ declare class ChromaClient {
|
|
|
1035
919
|
* });
|
|
1036
920
|
* ```
|
|
1037
921
|
*/
|
|
1038
|
-
getCollection({ name, embeddingFunction }:
|
|
922
|
+
getCollection({ name, embeddingFunction }: {
|
|
923
|
+
name: string;
|
|
924
|
+
embeddingFunction?: IEmbeddingFunction;
|
|
925
|
+
}): Promise<Collection>;
|
|
1039
926
|
/**
|
|
1040
927
|
* Deletes a collection with the specified name.
|
|
1041
928
|
* @param {Object} params - The parameters for deleting a collection.
|
|
@@ -1050,176 +937,9 @@ declare class ChromaClient {
|
|
|
1050
937
|
* });
|
|
1051
938
|
* ```
|
|
1052
939
|
*/
|
|
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, }: {
|
|
1148
|
-
name: string;
|
|
1149
|
-
}): Promise<Tenant>;
|
|
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 }: {
|
|
940
|
+
deleteCollection({ name }: {
|
|
1188
941
|
name: string;
|
|
1189
|
-
|
|
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);
|
|
942
|
+
}): Promise<void>;
|
|
1223
943
|
}
|
|
1224
944
|
|
|
1225
945
|
declare class OpenAIEmbeddingFunction implements IEmbeddingFunction {
|
|
@@ -1257,41 +977,33 @@ declare class CohereEmbeddingFunction implements IEmbeddingFunction {
|
|
|
1257
977
|
}>;
|
|
1258
978
|
}
|
|
1259
979
|
|
|
1260
|
-
declare class
|
|
1261
|
-
private
|
|
980
|
+
declare class TransformersEmbeddingFunction implements IEmbeddingFunction {
|
|
981
|
+
private pipelinePromise?;
|
|
982
|
+
private transformersApi;
|
|
1262
983
|
private model;
|
|
1263
|
-
private
|
|
1264
|
-
private
|
|
1265
|
-
|
|
1266
|
-
|
|
984
|
+
private revision;
|
|
985
|
+
private quantized;
|
|
986
|
+
private progress_callback;
|
|
987
|
+
/**
|
|
988
|
+
* TransformersEmbeddingFunction constructor.
|
|
989
|
+
* @param options The configuration options.
|
|
990
|
+
* @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`.
|
|
991
|
+
* @param options.revision The specific model version to use (can be a branch, tag name, or commit id). Defaults to 'main'.
|
|
992
|
+
* @param options.quantized Whether to load the 8-bit quantized version of the model. Defaults to `false`.
|
|
993
|
+
* @param options.progress_callback If specified, this function will be called during model construction, to provide the user with progress updates.
|
|
994
|
+
*/
|
|
995
|
+
constructor({ model, revision, quantized, progress_callback, }?: {
|
|
1267
996
|
model?: string;
|
|
1268
|
-
|
|
997
|
+
revision?: string;
|
|
998
|
+
quantized?: boolean;
|
|
999
|
+
progress_callback?: Function | null;
|
|
1269
1000
|
});
|
|
1001
|
+
generate(texts: string[]): Promise<number[][]>;
|
|
1270
1002
|
private loadClient;
|
|
1271
|
-
generate(texts: string[]): Promise<any>;
|
|
1272
1003
|
/** @ignore */
|
|
1273
1004
|
static import(): Promise<{
|
|
1274
|
-
|
|
1005
|
+
pipeline: typeof _xenova_transformers;
|
|
1275
1006
|
}>;
|
|
1276
1007
|
}
|
|
1277
1008
|
|
|
1278
|
-
|
|
1279
|
-
private url;
|
|
1280
|
-
constructor({ url }: {
|
|
1281
|
-
url: string;
|
|
1282
|
-
});
|
|
1283
|
-
generate(texts: string[]): Promise<any>;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
declare class JinaEmbeddingFunction implements IEmbeddingFunction {
|
|
1287
|
-
private model_name;
|
|
1288
|
-
private api_url;
|
|
1289
|
-
private headers;
|
|
1290
|
-
constructor({ jinaai_api_key, model_name }: {
|
|
1291
|
-
jinaai_api_key: string;
|
|
1292
|
-
model_name?: string;
|
|
1293
|
-
});
|
|
1294
|
-
generate(texts: string[]): Promise<any[]>;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
export { AddParams, AdminClient, ChromaClient, ChromaClientParams, CloudClient, CohereEmbeddingFunction, Collection, CollectionMetadata, CollectionType, CreateCollectionParams, DeleteCollectionParams, DeleteParams, Document, Documents, Embedding, Embeddings, GetCollectionParams, GetOrCreateCollectionParams, GetParams, GetResponse, GoogleGenerativeAiEmbeddingFunction, HuggingFaceEmbeddingServerFunction, ID, IDs, IEmbeddingFunction, IncludeEnum, JinaEmbeddingFunction, ListCollectionsParams, Metadata, Metadatas, ModifyCollectionParams, OpenAIEmbeddingFunction, PeekParams, QueryParams, QueryResponse, UpdateParams, UpsertParams, Where, WhereDocument };
|
|
1009
|
+
export { ChromaClient, CohereEmbeddingFunction, Collection, type IEmbeddingFunction, IncludeEnum, OpenAIEmbeddingFunction, TransformersEmbeddingFunction };
|