chromadb 1.7.3 → 1.9.1

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/README.md CHANGED
@@ -41,4 +41,3 @@ const queryData = await collection.query({
41
41
  ## License
42
42
 
43
43
  Apache 2.0
44
-
@@ -1,6 +1,150 @@
1
1
  import * as openai from 'openai';
2
+ import * as _xenova_transformers from '@xenova/transformers';
3
+ import * as chromadb_default_embed from 'chromadb-default-embed';
2
4
  import * as _google_generative_ai from '@google/generative-ai';
3
5
 
6
+ type AuthHeaders = {
7
+ [header: string]: string;
8
+ };
9
+ type TokenHeaderType = "AUTHORIZATION" | "X_CHROMA_TOKEN";
10
+ type AuthOptions = {
11
+ provider: ClientAuthProvider | string | undefined;
12
+ credentials?: any | undefined;
13
+ tokenHeaderType?: TokenHeaderType | undefined;
14
+ };
15
+ interface ClientAuthProvider {
16
+ /**
17
+ * Abstract method for authenticating a client.
18
+ */
19
+ authenticate(): AuthHeaders;
20
+ }
21
+
22
+ interface IEmbeddingFunction {
23
+ generate(texts: string[]): Promise<number[][]>;
24
+ }
25
+
26
+ declare enum IncludeEnum {
27
+ Documents = "documents",
28
+ Embeddings = "embeddings",
29
+ Metadatas = "metadatas",
30
+ Distances = "distances"
31
+ }
32
+ type Number = number;
33
+ type Embedding = Array<Number>;
34
+ type Embeddings = Array<Embedding>;
35
+ type Metadata = Record<string, string | number | boolean>;
36
+ type Metadatas = Array<Metadata>;
37
+ type Document = string;
38
+ type Documents = Array<Document>;
39
+ type ID = string;
40
+ type IDs = ID[];
41
+ type PositiveInteger = number;
42
+ type LiteralValue = string | number | boolean;
43
+ type ListLiteralValue = LiteralValue[];
44
+ type LiteralNumber = number;
45
+ type LogicalOperator = "$and" | "$or";
46
+ type InclusionOperator = "$in" | "$nin";
47
+ type WhereOperator = "$gt" | "$gte" | "$lt" | "$lte" | "$ne" | "$eq";
48
+ type OperatorExpression = {
49
+ [key in WhereOperator | InclusionOperator | LogicalOperator]?: LiteralValue | ListLiteralValue;
50
+ };
51
+ type BaseWhere = {
52
+ [key: string]: LiteralValue | OperatorExpression;
53
+ };
54
+ type LogicalWhere = {
55
+ [key in LogicalOperator]?: Where[];
56
+ };
57
+ type Where = BaseWhere | LogicalWhere;
58
+ type WhereDocumentOperator = "$contains" | "$not_contains" | LogicalOperator;
59
+ type WhereDocument = {
60
+ [key in WhereDocumentOperator]?: LiteralValue | LiteralNumber | WhereDocument[];
61
+ };
62
+ type CollectionType = {
63
+ name: string;
64
+ id: string;
65
+ metadata: Metadata | null;
66
+ };
67
+ type GetResponse = {
68
+ ids: IDs;
69
+ embeddings: null | Embeddings;
70
+ documents: (null | Document)[];
71
+ metadatas: (null | Metadata)[];
72
+ error: null | string;
73
+ included: IncludeEnum[];
74
+ };
75
+ type QueryResponse = {
76
+ ids: IDs[];
77
+ embeddings: null | Embeddings[];
78
+ documents: (null | Document)[][];
79
+ metadatas: (null | Metadata)[][];
80
+ distances: null | number[][];
81
+ included: IncludeEnum[];
82
+ };
83
+ type AddResponse = {
84
+ error: string;
85
+ };
86
+ type CollectionMetadata = Record<string, unknown>;
87
+ type GetParams = {
88
+ ids?: ID | IDs;
89
+ where?: Where;
90
+ limit?: PositiveInteger;
91
+ offset?: PositiveInteger;
92
+ include?: IncludeEnum[];
93
+ whereDocument?: WhereDocument;
94
+ };
95
+ type ListCollectionsParams = {
96
+ limit?: PositiveInteger;
97
+ offset?: PositiveInteger;
98
+ };
99
+ type ChromaClientParams = {
100
+ path?: string;
101
+ fetchOptions?: RequestInit;
102
+ auth?: AuthOptions;
103
+ tenant?: string;
104
+ database?: string;
105
+ };
106
+ type CreateCollectionParams = {
107
+ name: string;
108
+ metadata?: CollectionMetadata;
109
+ embeddingFunction?: IEmbeddingFunction;
110
+ };
111
+ type GetOrCreateCollectionParams = CreateCollectionParams;
112
+ type GetCollectionParams = {
113
+ name: string;
114
+ embeddingFunction?: IEmbeddingFunction;
115
+ };
116
+ type DeleteCollectionParams = {
117
+ name: string;
118
+ };
119
+ type AddParams = {
120
+ ids: ID | IDs;
121
+ embeddings?: Embedding | Embeddings;
122
+ metadatas?: Metadata | Metadatas;
123
+ documents?: Document | Documents;
124
+ };
125
+ type UpsertParams = AddParams;
126
+ type UpdateParams = AddParams;
127
+ type ModifyCollectionParams = {
128
+ name?: string;
129
+ metadata?: CollectionMetadata;
130
+ };
131
+ type QueryParams = {
132
+ queryEmbeddings?: Embedding | Embeddings;
133
+ nResults?: PositiveInteger;
134
+ where?: Where;
135
+ queryTexts?: string | string[];
136
+ whereDocument?: WhereDocument;
137
+ include?: IncludeEnum[];
138
+ };
139
+ type PeekParams = {
140
+ limit?: PositiveInteger;
141
+ };
142
+ type DeleteParams = {
143
+ ids?: ID | IDs;
144
+ where?: Where;
145
+ whereDocument?: WhereDocument;
146
+ };
147
+
4
148
  /**
5
149
  * FastAPI
6
150
  *
@@ -130,7 +274,7 @@ declare namespace Api {
130
274
  interface CreateCollection {
131
275
  name: string;
132
276
  metadata?: Api.CreateCollection.Metadata;
133
- 'get_or_create'?: boolean;
277
+ get_or_create?: boolean;
134
278
  }
135
279
  /**
136
280
  * @export
@@ -157,7 +301,7 @@ declare namespace Api {
157
301
  interface DeleteEmbedding {
158
302
  ids?: string[];
159
303
  where?: Api.DeleteEmbedding.Where;
160
- 'where_document'?: Api.DeleteEmbedding.WhereDocument;
304
+ where_document?: Api.DeleteEmbedding.WhereDocument;
161
305
  }
162
306
  /**
163
307
  * @export
@@ -176,7 +320,7 @@ declare namespace Api {
176
320
  interface GetEmbedding {
177
321
  ids?: string[];
178
322
  where?: Api.GetEmbedding.Where;
179
- 'where_document'?: Api.GetEmbedding.WhereDocument;
323
+ where_document?: Api.GetEmbedding.WhereDocument;
180
324
  sort?: string;
181
325
  /**
182
326
  * @type {number}
@@ -238,13 +382,13 @@ declare namespace Api {
238
382
  }
239
383
  interface QueryEmbedding {
240
384
  where?: Api.QueryEmbedding.Where;
241
- 'where_document'?: Api.QueryEmbedding.WhereDocument;
242
- 'query_embeddings': Api.QueryEmbedding.QueryEmbedding2[];
385
+ where_document?: Api.QueryEmbedding.WhereDocument;
386
+ query_embeddings: Api.QueryEmbedding.QueryEmbedding2[];
243
387
  /**
244
388
  * @type {number}
245
389
  * @memberof QueryEmbedding
246
390
  */
247
- 'n_results'?: number;
391
+ n_results?: number;
248
392
  include?: (Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4 | Api.QueryEmbedding.Include.EnumValueEnum5 | Api.QueryEmbedding.Include.EnumValueEnum6)[];
249
393
  }
250
394
  /**
@@ -287,8 +431,8 @@ declare namespace Api {
287
431
  interface Update200Response {
288
432
  }
289
433
  interface UpdateCollection {
290
- 'new_name'?: string;
291
- 'new_metadata'?: Api.UpdateCollection.NewMetadata;
434
+ new_name?: string;
435
+ new_metadata?: Api.UpdateCollection.NewMetadata;
292
436
  }
293
437
  /**
294
438
  * @export
@@ -322,7 +466,7 @@ declare namespace Api {
322
466
  interface ValidationError {
323
467
  loc: (string | number)[];
324
468
  msg: string;
325
- 'type': string;
469
+ type: string;
326
470
  }
327
471
  }
328
472
 
@@ -519,170 +663,6 @@ declare class ApiApi extends BaseAPI {
519
663
  version(options?: RequestInit): Promise<string>;
520
664
  }
521
665
 
522
- interface ClientAuthProvider {
523
- /**
524
- * Abstract method for authenticating a client.
525
- */
526
- authenticate(): ClientAuthResponse;
527
- }
528
- interface ClientAuthConfigurationProvider<T> {
529
- /**
530
- * Abstract method for getting the configuration for the client.
531
- */
532
- getConfig(): T;
533
- }
534
- interface ClientAuthCredentialsProvider<T> {
535
- /**
536
- * Abstract method for getting the credentials for the client.
537
- * @param user
538
- */
539
- getCredentials(user?: string): T;
540
- }
541
- declare enum AuthInfoType {
542
- COOKIE = "cookie",
543
- HEADER = "header",
544
- URL = "url",
545
- METADATA = "metadata"
546
- }
547
- interface ClientAuthResponse {
548
- getAuthInfoType(): AuthInfoType;
549
- getAuthInfo(): {
550
- key: string;
551
- value: string;
552
- };
553
- }
554
- type AuthOptions = {
555
- provider: ClientAuthProvider | string | undefined;
556
- credentialsProvider?: ClientAuthCredentialsProvider<any> | undefined;
557
- configProvider?: ClientAuthConfigurationProvider<any> | undefined;
558
- credentials?: any | undefined;
559
- providerOptions?: any | undefined;
560
- };
561
-
562
- interface IEmbeddingFunction {
563
- generate(texts: string[]): Promise<number[][]>;
564
- }
565
-
566
- declare enum IncludeEnum {
567
- Documents = "documents",
568
- Embeddings = "embeddings",
569
- Metadatas = "metadatas",
570
- Distances = "distances"
571
- }
572
- type Number = number;
573
- type Embedding = Array<Number>;
574
- type Embeddings = Array<Embedding>;
575
- type Metadata = Record<string, string | number | boolean>;
576
- type Metadatas = Array<Metadata>;
577
- type Document = string;
578
- type Documents = Array<Document>;
579
- type ID = string;
580
- type IDs = ID[];
581
- type PositiveInteger = number;
582
- type LiteralValue = string | number | boolean;
583
- type ListLiteralValue = LiteralValue[];
584
- type LiteralNumber = number;
585
- type LogicalOperator = "$and" | "$or";
586
- type InclusionOperator = "$in" | "$nin";
587
- type WhereOperator = "$gt" | "$gte" | "$lt" | "$lte" | "$ne" | "$eq";
588
- type OperatorExpression = {
589
- [key in WhereOperator | InclusionOperator | LogicalOperator]?: LiteralValue | ListLiteralValue;
590
- };
591
- type BaseWhere = {
592
- [key: string]: LiteralValue | OperatorExpression;
593
- };
594
- type LogicalWhere = {
595
- [key in LogicalOperator]?: Where[];
596
- };
597
- type Where = BaseWhere | LogicalWhere;
598
- type WhereDocumentOperator = "$contains" | LogicalOperator;
599
- type WhereDocument = {
600
- [key in WhereDocumentOperator]?: LiteralValue | LiteralNumber | WhereDocument[];
601
- };
602
- type CollectionType = {
603
- name: string;
604
- id: string;
605
- metadata: Metadata | null;
606
- };
607
- type GetResponse = {
608
- ids: IDs;
609
- embeddings: null | Embeddings;
610
- documents: (null | Document)[];
611
- metadatas: (null | Metadata)[];
612
- error: null | string;
613
- };
614
- type QueryResponse = {
615
- ids: IDs[];
616
- embeddings: null | Embeddings[];
617
- documents: (null | Document)[][];
618
- metadatas: (null | Metadata)[][];
619
- distances: null | number[][];
620
- };
621
- type AddResponse = {
622
- error: string;
623
- };
624
- type CollectionMetadata = Record<string, unknown>;
625
- type GetParams = {
626
- ids?: ID | IDs;
627
- where?: Where;
628
- limit?: PositiveInteger;
629
- offset?: PositiveInteger;
630
- include?: IncludeEnum[];
631
- whereDocument?: WhereDocument;
632
- };
633
- type ListCollectionsParams = {
634
- limit?: PositiveInteger;
635
- offset?: PositiveInteger;
636
- };
637
- type ChromaClientParams = {
638
- path?: string;
639
- fetchOptions?: RequestInit;
640
- auth?: AuthOptions;
641
- tenant?: string;
642
- database?: string;
643
- };
644
- type CreateCollectionParams = {
645
- name: string;
646
- metadata?: CollectionMetadata;
647
- embeddingFunction?: IEmbeddingFunction;
648
- };
649
- type GetOrCreateCollectionParams = CreateCollectionParams;
650
- type GetCollectionParams = {
651
- name: string;
652
- embeddingFunction?: IEmbeddingFunction;
653
- };
654
- type DeleteCollectionParams = {
655
- name: string;
656
- };
657
- type AddParams = {
658
- ids: ID | IDs;
659
- embeddings?: Embedding | Embeddings;
660
- metadatas?: Metadata | Metadatas;
661
- documents?: Document | Documents;
662
- };
663
- type UpsertParams = AddParams;
664
- type UpdateParams = AddParams;
665
- type ModifyCollectionParams = {
666
- name?: string;
667
- metadata?: CollectionMetadata;
668
- };
669
- type QueryParams = {
670
- queryEmbeddings?: Embedding | Embeddings;
671
- nResults?: PositiveInteger;
672
- where?: Where;
673
- queryTexts?: string | string[];
674
- whereDocument?: WhereDocument;
675
- include?: IncludeEnum[];
676
- };
677
- type PeekParams = {
678
- limit?: PositiveInteger;
679
- };
680
- type DeleteParams = {
681
- ids?: ID | IDs;
682
- where?: Where;
683
- whereDocument?: WhereDocument;
684
- };
685
-
686
666
  declare class Collection {
687
667
  name: string;
688
668
  id: string;
@@ -718,7 +698,7 @@ declare class Collection {
718
698
  * @param {Embedding | Embeddings} [params.embeddings] - Optional embeddings of the items to add.
719
699
  * @param {Metadata | Metadatas} [params.metadatas] - Optional metadata of the items to add.
720
700
  * @param {Document | Documents} [params.documents] - Optional documents of the items to add.
721
- * @returns {Promise<AddResponse>} - The response from the API. True if successful.
701
+ * @returns {Promise<AddResponse>} - The response from the API. True if successful.
722
702
  *
723
703
  * @example
724
704
  * ```typescript
@@ -776,7 +756,7 @@ declare class Collection {
776
756
  * });
777
757
  * ```
778
758
  */
779
- modify({ name, metadata }?: ModifyCollectionParams): Promise<void>;
759
+ modify({ name, metadata, }?: ModifyCollectionParams): Promise<void>;
780
760
  /**
781
761
  * Get items from the collection
782
762
  * @param {Object} params - The parameters for the query.
@@ -888,7 +868,7 @@ declare class Collection {
888
868
  * });
889
869
  * ```
890
870
  */
891
- delete({ ids, where, whereDocument }?: DeleteParams): Promise<string[]>;
871
+ delete({ ids, where, whereDocument, }?: DeleteParams): Promise<string[]>;
892
872
  }
893
873
 
894
874
  declare class ChromaClient {
@@ -896,10 +876,10 @@ declare class ChromaClient {
896
876
  * @ignore
897
877
  */
898
878
  private api;
899
- private apiAdapter;
900
879
  private tenant;
901
880
  private database;
902
881
  private _adminClient?;
882
+ private authProvider;
903
883
  /**
904
884
  * Creates a new ChromaClient instance.
905
885
  * @param {Object} params - The parameters for creating a new client
@@ -918,7 +898,8 @@ declare class ChromaClient {
918
898
  * Resets the state of the object by making an API call to the reset endpoint.
919
899
  *
920
900
  * @returns {Promise<boolean>} A promise that resolves when the reset operation is complete.
921
- * @throws {Error} If there is an issue resetting the state.
901
+ * @throws {ChromaConnectionError} If the client is unable to connect to the server.
902
+ * @throws {ChromaServerError} If the server experienced an error while the state.
922
903
  *
923
904
  * @example
924
905
  * ```typescript
@@ -929,6 +910,7 @@ declare class ChromaClient {
929
910
  /**
930
911
  * Returns the version of the Chroma API.
931
912
  * @returns {Promise<string>} A promise that resolves to the version of the Chroma API.
913
+ * @throws {ChromaConnectionError} If the client is unable to connect to the server.
932
914
  *
933
915
  * @example
934
916
  * ```typescript
@@ -939,6 +921,7 @@ declare class ChromaClient {
939
921
  /**
940
922
  * Returns a heartbeat from the Chroma API.
941
923
  * @returns {Promise<number>} A promise that resolves to the heartbeat from the Chroma API.
924
+ * @throws {ChromaConnectionError} If the client is unable to connect to the server.
942
925
  *
943
926
  * @example
944
927
  * ```typescript
@@ -955,7 +938,8 @@ declare class ChromaClient {
955
938
  * @param {IEmbeddingFunction} [params.embeddingFunction] - Optional custom embedding function for the collection.
956
939
  *
957
940
  * @returns {Promise<Collection>} A promise that resolves to the created collection.
958
- * @throws {Error} If there is an issue creating the collection.
941
+ * @throws {ChromaConnectionError} If the client is unable to connect to the server.
942
+ * @throws {ChromaServerError} If there is an issue creating the collection.
959
943
  *
960
944
  * @example
961
945
  * ```typescript
@@ -967,7 +951,7 @@ declare class ChromaClient {
967
951
  * });
968
952
  * ```
969
953
  */
970
- createCollection({ name, metadata, embeddingFunction }: CreateCollectionParams): Promise<Collection>;
954
+ createCollection({ name, metadata, embeddingFunction, }: CreateCollectionParams): Promise<Collection>;
971
955
  /**
972
956
  * Gets or creates a collection with the specified properties.
973
957
  *
@@ -989,7 +973,7 @@ declare class ChromaClient {
989
973
  * });
990
974
  * ```
991
975
  */
992
- getOrCreateCollection({ name, metadata, embeddingFunction }: GetOrCreateCollectionParams): Promise<Collection>;
976
+ getOrCreateCollection({ name, metadata, embeddingFunction, }: GetOrCreateCollectionParams): Promise<Collection>;
993
977
  /**
994
978
  * Lists all collections.
995
979
  *
@@ -1034,7 +1018,7 @@ declare class ChromaClient {
1034
1018
  * });
1035
1019
  * ```
1036
1020
  */
1037
- getCollection({ name, embeddingFunction }: GetCollectionParams): Promise<Collection>;
1021
+ getCollection({ name, embeddingFunction, }: GetCollectionParams): Promise<Collection>;
1038
1022
  /**
1039
1023
  * Deletes a collection with the specified name.
1040
1024
  * @param {Object} params - The parameters for deleting a collection.
@@ -1049,7 +1033,7 @@ declare class ChromaClient {
1049
1033
  * });
1050
1034
  * ```
1051
1035
  */
1052
- deleteCollection({ name }: DeleteCollectionParams): Promise<void>;
1036
+ deleteCollection({ name, }: DeleteCollectionParams): Promise<void>;
1053
1037
  }
1054
1038
 
1055
1039
  interface Tenant {
@@ -1063,7 +1047,7 @@ declare class AdminClient {
1063
1047
  * @ignore
1064
1048
  */
1065
1049
  private api;
1066
- private apiAdapter;
1050
+ private authProvider;
1067
1051
  tenant: string;
1068
1052
  database: string;
1069
1053
  /**
@@ -1079,7 +1063,7 @@ declare class AdminClient {
1079
1063
  * });
1080
1064
  * ```
1081
1065
  */
1082
- constructor({ path, fetchOptions, auth, tenant, database }?: {
1066
+ constructor({ path, fetchOptions, auth, tenant, database, }?: {
1083
1067
  path?: string;
1084
1068
  fetchOptions?: RequestInit;
1085
1069
  auth?: AuthOptions;
@@ -1104,7 +1088,7 @@ declare class AdminClient {
1104
1088
  * });
1105
1089
  * ```
1106
1090
  */
1107
- setTenant({ tenant, database }: {
1091
+ setTenant({ tenant, database, }: {
1108
1092
  tenant: string;
1109
1093
  database?: string;
1110
1094
  }): Promise<void>;
@@ -1124,7 +1108,7 @@ declare class AdminClient {
1124
1108
  * });
1125
1109
  * ```
1126
1110
  */
1127
- setDatabase({ database }: {
1111
+ setDatabase({ database, }: {
1128
1112
  database?: string;
1129
1113
  }): Promise<void>;
1130
1114
  /**
@@ -1143,7 +1127,7 @@ declare class AdminClient {
1143
1127
  * });
1144
1128
  * ```
1145
1129
  */
1146
- createTenant({ name, }: {
1130
+ createTenant({ name }: {
1147
1131
  name: string;
1148
1132
  }): Promise<Tenant>;
1149
1133
  /**
@@ -1162,7 +1146,7 @@ declare class AdminClient {
1162
1146
  * });
1163
1147
  * ```
1164
1148
  */
1165
- getTenant({ name, }: {
1149
+ getTenant({ name }: {
1166
1150
  name: string;
1167
1151
  }): Promise<Tenant>;
1168
1152
  /**
@@ -1183,7 +1167,7 @@ declare class AdminClient {
1183
1167
  * });
1184
1168
  * ```
1185
1169
  */
1186
- createDatabase({ name, tenantName }: {
1170
+ createDatabase({ name, tenantName, }: {
1187
1171
  name: string;
1188
1172
  tenantName: string;
1189
1173
  }): Promise<Database>;
@@ -1205,7 +1189,7 @@ declare class AdminClient {
1205
1189
  * });
1206
1190
  * ```
1207
1191
  */
1208
- getDatabase({ name, tenantName }: {
1192
+ getDatabase({ name, tenantName, }: {
1209
1193
  name: string;
1210
1194
  tenantName: string;
1211
1195
  }): Promise<Database>;
@@ -1226,7 +1210,7 @@ declare class OpenAIEmbeddingFunction implements IEmbeddingFunction {
1226
1210
  private org_id;
1227
1211
  private model;
1228
1212
  private openaiApi?;
1229
- constructor({ openai_api_key, openai_model, openai_organization_id }: {
1213
+ constructor({ openai_api_key, openai_model, openai_organization_id, }: {
1230
1214
  openai_api_key: string;
1231
1215
  openai_model?: string;
1232
1216
  openai_organization_id?: string;
@@ -1252,21 +1236,61 @@ declare class CohereEmbeddingFunction implements IEmbeddingFunction {
1252
1236
  generate(texts: string[]): Promise<number[][]>;
1253
1237
  }
1254
1238
 
1255
- declare class GoogleGenerativeAiEmbeddingFunction implements IEmbeddingFunction {
1256
- private api_key;
1239
+ declare class TransformersEmbeddingFunction implements IEmbeddingFunction {
1240
+ private pipelinePromise?;
1241
+ private transformersApi;
1257
1242
  private model;
1258
- private googleGenAiApi?;
1259
- private taskType;
1260
- constructor({ googleApiKey, model, taskType }: {
1261
- googleApiKey: string;
1243
+ private revision;
1244
+ private quantized;
1245
+ private progress_callback;
1246
+ /**
1247
+ * TransformersEmbeddingFunction constructor.
1248
+ * @param options The configuration options.
1249
+ * @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`.
1250
+ * @param options.revision The specific model version to use (can be a branch, tag name, or commit id). Defaults to 'main'.
1251
+ * @param options.quantized Whether to load the 8-bit quantized version of the model. Defaults to `false`.
1252
+ * @param options.progress_callback If specified, this function will be called during model construction, to provide the user with progress updates.
1253
+ */
1254
+ constructor({ model, revision, quantized, progress_callback, }?: {
1262
1255
  model?: string;
1263
- taskType?: string;
1256
+ revision?: string;
1257
+ quantized?: boolean;
1258
+ progress_callback?: Function | null;
1264
1259
  });
1260
+ generate(texts: string[]): Promise<number[][]>;
1265
1261
  private loadClient;
1266
- generate(texts: string[]): Promise<any>;
1267
1262
  /** @ignore */
1268
1263
  static import(): Promise<{
1269
- googleGenAi: typeof _google_generative_ai;
1264
+ pipeline: typeof _xenova_transformers;
1265
+ }>;
1266
+ }
1267
+
1268
+ declare class DefaultEmbeddingFunction implements IEmbeddingFunction {
1269
+ private pipelinePromise?;
1270
+ private transformersApi;
1271
+ private model;
1272
+ private revision;
1273
+ private quantized;
1274
+ private progress_callback;
1275
+ /**
1276
+ * DefaultEmbeddingFunction constructor.
1277
+ * @param options The configuration options.
1278
+ * @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`.
1279
+ * @param options.revision The specific model version to use (can be a branch, tag name, or commit id). Defaults to 'main'.
1280
+ * @param options.quantized Whether to load the 8-bit quantized version of the model. Defaults to `false`.
1281
+ * @param options.progress_callback If specified, this function will be called during model construction, to provide the user with progress updates.
1282
+ */
1283
+ constructor({ model, revision, quantized, progress_callback, }?: {
1284
+ model?: string;
1285
+ revision?: string;
1286
+ quantized?: boolean;
1287
+ progress_callback?: Function | null;
1288
+ });
1289
+ generate(texts: string[]): Promise<number[][]>;
1290
+ private loadClient;
1291
+ /** @ignore */
1292
+ static import(): Promise<{
1293
+ pipeline: typeof chromadb_default_embed;
1270
1294
  }>;
1271
1295
  }
1272
1296
 
@@ -1282,11 +1306,39 @@ declare class JinaEmbeddingFunction implements IEmbeddingFunction {
1282
1306
  private model_name;
1283
1307
  private api_url;
1284
1308
  private headers;
1285
- constructor({ jinaai_api_key, model_name }: {
1309
+ constructor({ jinaai_api_key, model_name, }: {
1286
1310
  jinaai_api_key: string;
1287
1311
  model_name?: string;
1288
1312
  });
1289
1313
  generate(texts: string[]): Promise<any[]>;
1290
1314
  }
1291
1315
 
1292
- 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 };
1316
+ declare class GoogleGenerativeAiEmbeddingFunction implements IEmbeddingFunction {
1317
+ private api_key;
1318
+ private model;
1319
+ private googleGenAiApi?;
1320
+ private taskType;
1321
+ constructor({ googleApiKey, model, taskType, }: {
1322
+ googleApiKey: string;
1323
+ model?: string;
1324
+ taskType?: string;
1325
+ });
1326
+ private loadClient;
1327
+ generate(texts: string[]): Promise<any>;
1328
+ /** @ignore */
1329
+ static import(): Promise<{
1330
+ googleGenAi: typeof _google_generative_ai;
1331
+ }>;
1332
+ }
1333
+
1334
+ declare class OllamaEmbeddingFunction implements IEmbeddingFunction {
1335
+ private readonly url;
1336
+ private readonly model;
1337
+ constructor({ url, model }: {
1338
+ url: string;
1339
+ model: string;
1340
+ });
1341
+ generate(texts: string[]): Promise<number[][]>;
1342
+ }
1343
+
1344
+ export { AddParams, AdminClient, ChromaClient, ChromaClientParams, CloudClient, CohereEmbeddingFunction, Collection, CollectionMetadata, CollectionType, CreateCollectionParams, DefaultEmbeddingFunction, DeleteCollectionParams, DeleteParams, Document, Documents, Embedding, Embeddings, GetCollectionParams, GetOrCreateCollectionParams, GetParams, GetResponse, GoogleGenerativeAiEmbeddingFunction, HuggingFaceEmbeddingServerFunction, ID, IDs, IEmbeddingFunction, IncludeEnum, JinaEmbeddingFunction, ListCollectionsParams, Metadata, Metadatas, ModifyCollectionParams, OllamaEmbeddingFunction, OpenAIEmbeddingFunction, PeekParams, QueryParams, QueryResponse, TransformersEmbeddingFunction, UpdateParams, UpsertParams, Where, WhereDocument };