chromadb 1.8.1 → 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/dist/chromadb.d.ts +187 -195
- package/dist/chromadb.legacy-esm.js +929 -439
- package/dist/chromadb.mjs +929 -439
- package/dist/chromadb.mjs.map +1 -1
- package/dist/cjs/chromadb.cjs +930 -439
- package/dist/cjs/chromadb.cjs.map +1 -1
- package/dist/cjs/chromadb.d.cts +187 -195
- package/package.json +7 -6
- package/src/AdminClient.ts +230 -234
- package/src/ChromaClient.ts +317 -297
- package/src/ChromaFetch.ts +102 -0
- package/src/CloudClient.ts +29 -30
- package/src/Collection.ts +519 -515
- package/src/Errors.ts +109 -0
- package/src/auth.ts +102 -314
- package/src/embeddings/CohereEmbeddingFunction.ts +1 -1
- package/src/embeddings/DefaultEmbeddingFunction.ts +47 -28
- package/src/embeddings/GoogleGeminiEmbeddingFunction.ts +65 -56
- package/src/embeddings/HuggingFaceEmbeddingServerFunction.ts +19 -20
- package/src/embeddings/IEmbeddingFunction.ts +1 -1
- package/src/embeddings/JinaEmbeddingFunction.ts +12 -6
- package/src/embeddings/OllamaEmbeddingFunction.ts +35 -0
- package/src/embeddings/OpenAIEmbeddingFunction.ts +135 -129
- package/src/embeddings/TransformersEmbeddingFunction.ts +31 -29
- package/src/generated/README.md +12 -8
- package/src/generated/api.ts +2497 -1697
- package/src/generated/configuration.ts +46 -46
- package/src/generated/models.ts +274 -289
- package/src/generated/runtime.ts +27 -20
- package/src/index.ts +43 -43
- package/src/types.ts +61 -54
- package/src/utils.ts +26 -32
package/dist/chromadb.d.ts
CHANGED
|
@@ -3,6 +3,148 @@ import * as _xenova_transformers from '@xenova/transformers';
|
|
|
3
3
|
import * as chromadb_default_embed from 'chromadb-default-embed';
|
|
4
4
|
import * as _google_generative_ai from '@google/generative-ai';
|
|
5
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
|
+
|
|
6
148
|
/**
|
|
7
149
|
* FastAPI
|
|
8
150
|
*
|
|
@@ -132,7 +274,7 @@ declare namespace Api {
|
|
|
132
274
|
interface CreateCollection {
|
|
133
275
|
name: string;
|
|
134
276
|
metadata?: Api.CreateCollection.Metadata;
|
|
135
|
-
|
|
277
|
+
get_or_create?: boolean;
|
|
136
278
|
}
|
|
137
279
|
/**
|
|
138
280
|
* @export
|
|
@@ -159,7 +301,7 @@ declare namespace Api {
|
|
|
159
301
|
interface DeleteEmbedding {
|
|
160
302
|
ids?: string[];
|
|
161
303
|
where?: Api.DeleteEmbedding.Where;
|
|
162
|
-
|
|
304
|
+
where_document?: Api.DeleteEmbedding.WhereDocument;
|
|
163
305
|
}
|
|
164
306
|
/**
|
|
165
307
|
* @export
|
|
@@ -178,7 +320,7 @@ declare namespace Api {
|
|
|
178
320
|
interface GetEmbedding {
|
|
179
321
|
ids?: string[];
|
|
180
322
|
where?: Api.GetEmbedding.Where;
|
|
181
|
-
|
|
323
|
+
where_document?: Api.GetEmbedding.WhereDocument;
|
|
182
324
|
sort?: string;
|
|
183
325
|
/**
|
|
184
326
|
* @type {number}
|
|
@@ -240,13 +382,13 @@ declare namespace Api {
|
|
|
240
382
|
}
|
|
241
383
|
interface QueryEmbedding {
|
|
242
384
|
where?: Api.QueryEmbedding.Where;
|
|
243
|
-
|
|
244
|
-
|
|
385
|
+
where_document?: Api.QueryEmbedding.WhereDocument;
|
|
386
|
+
query_embeddings: Api.QueryEmbedding.QueryEmbedding2[];
|
|
245
387
|
/**
|
|
246
388
|
* @type {number}
|
|
247
389
|
* @memberof QueryEmbedding
|
|
248
390
|
*/
|
|
249
|
-
|
|
391
|
+
n_results?: number;
|
|
250
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)[];
|
|
251
393
|
}
|
|
252
394
|
/**
|
|
@@ -289,8 +431,8 @@ declare namespace Api {
|
|
|
289
431
|
interface Update200Response {
|
|
290
432
|
}
|
|
291
433
|
interface UpdateCollection {
|
|
292
|
-
|
|
293
|
-
|
|
434
|
+
new_name?: string;
|
|
435
|
+
new_metadata?: Api.UpdateCollection.NewMetadata;
|
|
294
436
|
}
|
|
295
437
|
/**
|
|
296
438
|
* @export
|
|
@@ -324,7 +466,7 @@ declare namespace Api {
|
|
|
324
466
|
interface ValidationError {
|
|
325
467
|
loc: (string | number)[];
|
|
326
468
|
msg: string;
|
|
327
|
-
|
|
469
|
+
type: string;
|
|
328
470
|
}
|
|
329
471
|
}
|
|
330
472
|
|
|
@@ -521,170 +663,6 @@ declare class ApiApi extends BaseAPI {
|
|
|
521
663
|
version(options?: RequestInit): Promise<string>;
|
|
522
664
|
}
|
|
523
665
|
|
|
524
|
-
interface ClientAuthProvider {
|
|
525
|
-
/**
|
|
526
|
-
* Abstract method for authenticating a client.
|
|
527
|
-
*/
|
|
528
|
-
authenticate(): ClientAuthResponse;
|
|
529
|
-
}
|
|
530
|
-
interface ClientAuthConfigurationProvider<T> {
|
|
531
|
-
/**
|
|
532
|
-
* Abstract method for getting the configuration for the client.
|
|
533
|
-
*/
|
|
534
|
-
getConfig(): T;
|
|
535
|
-
}
|
|
536
|
-
interface ClientAuthCredentialsProvider<T> {
|
|
537
|
-
/**
|
|
538
|
-
* Abstract method for getting the credentials for the client.
|
|
539
|
-
* @param user
|
|
540
|
-
*/
|
|
541
|
-
getCredentials(user?: string): T;
|
|
542
|
-
}
|
|
543
|
-
declare enum AuthInfoType {
|
|
544
|
-
COOKIE = "cookie",
|
|
545
|
-
HEADER = "header",
|
|
546
|
-
URL = "url",
|
|
547
|
-
METADATA = "metadata"
|
|
548
|
-
}
|
|
549
|
-
interface ClientAuthResponse {
|
|
550
|
-
getAuthInfoType(): AuthInfoType;
|
|
551
|
-
getAuthInfo(): {
|
|
552
|
-
key: string;
|
|
553
|
-
value: string;
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
type AuthOptions = {
|
|
557
|
-
provider: ClientAuthProvider | string | undefined;
|
|
558
|
-
credentialsProvider?: ClientAuthCredentialsProvider<any> | undefined;
|
|
559
|
-
configProvider?: ClientAuthConfigurationProvider<any> | undefined;
|
|
560
|
-
credentials?: any | undefined;
|
|
561
|
-
providerOptions?: any | undefined;
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
interface IEmbeddingFunction {
|
|
565
|
-
generate(texts: string[]): Promise<number[][]>;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
declare enum IncludeEnum {
|
|
569
|
-
Documents = "documents",
|
|
570
|
-
Embeddings = "embeddings",
|
|
571
|
-
Metadatas = "metadatas",
|
|
572
|
-
Distances = "distances"
|
|
573
|
-
}
|
|
574
|
-
type Number = number;
|
|
575
|
-
type Embedding = Array<Number>;
|
|
576
|
-
type Embeddings = Array<Embedding>;
|
|
577
|
-
type Metadata = Record<string, string | number | boolean>;
|
|
578
|
-
type Metadatas = Array<Metadata>;
|
|
579
|
-
type Document = string;
|
|
580
|
-
type Documents = Array<Document>;
|
|
581
|
-
type ID = string;
|
|
582
|
-
type IDs = ID[];
|
|
583
|
-
type PositiveInteger = number;
|
|
584
|
-
type LiteralValue = string | number | boolean;
|
|
585
|
-
type ListLiteralValue = LiteralValue[];
|
|
586
|
-
type LiteralNumber = number;
|
|
587
|
-
type LogicalOperator = "$and" | "$or";
|
|
588
|
-
type InclusionOperator = "$in" | "$nin";
|
|
589
|
-
type WhereOperator = "$gt" | "$gte" | "$lt" | "$lte" | "$ne" | "$eq";
|
|
590
|
-
type OperatorExpression = {
|
|
591
|
-
[key in WhereOperator | InclusionOperator | LogicalOperator]?: LiteralValue | ListLiteralValue;
|
|
592
|
-
};
|
|
593
|
-
type BaseWhere = {
|
|
594
|
-
[key: string]: LiteralValue | OperatorExpression;
|
|
595
|
-
};
|
|
596
|
-
type LogicalWhere = {
|
|
597
|
-
[key in LogicalOperator]?: Where[];
|
|
598
|
-
};
|
|
599
|
-
type Where = BaseWhere | LogicalWhere;
|
|
600
|
-
type WhereDocumentOperator = "$contains" | LogicalOperator;
|
|
601
|
-
type WhereDocument = {
|
|
602
|
-
[key in WhereDocumentOperator]?: LiteralValue | LiteralNumber | WhereDocument[];
|
|
603
|
-
};
|
|
604
|
-
type CollectionType = {
|
|
605
|
-
name: string;
|
|
606
|
-
id: string;
|
|
607
|
-
metadata: Metadata | null;
|
|
608
|
-
};
|
|
609
|
-
type GetResponse = {
|
|
610
|
-
ids: IDs;
|
|
611
|
-
embeddings: null | Embeddings;
|
|
612
|
-
documents: (null | Document)[];
|
|
613
|
-
metadatas: (null | Metadata)[];
|
|
614
|
-
error: null | string;
|
|
615
|
-
};
|
|
616
|
-
type QueryResponse = {
|
|
617
|
-
ids: IDs[];
|
|
618
|
-
embeddings: null | Embeddings[];
|
|
619
|
-
documents: (null | Document)[][];
|
|
620
|
-
metadatas: (null | Metadata)[][];
|
|
621
|
-
distances: null | number[][];
|
|
622
|
-
};
|
|
623
|
-
type AddResponse = {
|
|
624
|
-
error: string;
|
|
625
|
-
};
|
|
626
|
-
type CollectionMetadata = Record<string, unknown>;
|
|
627
|
-
type GetParams = {
|
|
628
|
-
ids?: ID | IDs;
|
|
629
|
-
where?: Where;
|
|
630
|
-
limit?: PositiveInteger;
|
|
631
|
-
offset?: PositiveInteger;
|
|
632
|
-
include?: IncludeEnum[];
|
|
633
|
-
whereDocument?: WhereDocument;
|
|
634
|
-
};
|
|
635
|
-
type ListCollectionsParams = {
|
|
636
|
-
limit?: PositiveInteger;
|
|
637
|
-
offset?: PositiveInteger;
|
|
638
|
-
};
|
|
639
|
-
type ChromaClientParams = {
|
|
640
|
-
path?: string;
|
|
641
|
-
fetchOptions?: RequestInit;
|
|
642
|
-
auth?: AuthOptions;
|
|
643
|
-
tenant?: string;
|
|
644
|
-
database?: string;
|
|
645
|
-
};
|
|
646
|
-
type CreateCollectionParams = {
|
|
647
|
-
name: string;
|
|
648
|
-
metadata?: CollectionMetadata;
|
|
649
|
-
embeddingFunction?: IEmbeddingFunction;
|
|
650
|
-
};
|
|
651
|
-
type GetOrCreateCollectionParams = CreateCollectionParams;
|
|
652
|
-
type GetCollectionParams = {
|
|
653
|
-
name: string;
|
|
654
|
-
embeddingFunction?: IEmbeddingFunction;
|
|
655
|
-
};
|
|
656
|
-
type DeleteCollectionParams = {
|
|
657
|
-
name: string;
|
|
658
|
-
};
|
|
659
|
-
type AddParams = {
|
|
660
|
-
ids: ID | IDs;
|
|
661
|
-
embeddings?: Embedding | Embeddings;
|
|
662
|
-
metadatas?: Metadata | Metadatas;
|
|
663
|
-
documents?: Document | Documents;
|
|
664
|
-
};
|
|
665
|
-
type UpsertParams = AddParams;
|
|
666
|
-
type UpdateParams = AddParams;
|
|
667
|
-
type ModifyCollectionParams = {
|
|
668
|
-
name?: string;
|
|
669
|
-
metadata?: CollectionMetadata;
|
|
670
|
-
};
|
|
671
|
-
type QueryParams = {
|
|
672
|
-
queryEmbeddings?: Embedding | Embeddings;
|
|
673
|
-
nResults?: PositiveInteger;
|
|
674
|
-
where?: Where;
|
|
675
|
-
queryTexts?: string | string[];
|
|
676
|
-
whereDocument?: WhereDocument;
|
|
677
|
-
include?: IncludeEnum[];
|
|
678
|
-
};
|
|
679
|
-
type PeekParams = {
|
|
680
|
-
limit?: PositiveInteger;
|
|
681
|
-
};
|
|
682
|
-
type DeleteParams = {
|
|
683
|
-
ids?: ID | IDs;
|
|
684
|
-
where?: Where;
|
|
685
|
-
whereDocument?: WhereDocument;
|
|
686
|
-
};
|
|
687
|
-
|
|
688
666
|
declare class Collection {
|
|
689
667
|
name: string;
|
|
690
668
|
id: string;
|
|
@@ -720,7 +698,7 @@ declare class Collection {
|
|
|
720
698
|
* @param {Embedding | Embeddings} [params.embeddings] - Optional embeddings of the items to add.
|
|
721
699
|
* @param {Metadata | Metadatas} [params.metadatas] - Optional metadata of the items to add.
|
|
722
700
|
* @param {Document | Documents} [params.documents] - Optional documents of the items to add.
|
|
723
|
-
|
|
701
|
+
* @returns {Promise<AddResponse>} - The response from the API. True if successful.
|
|
724
702
|
*
|
|
725
703
|
* @example
|
|
726
704
|
* ```typescript
|
|
@@ -778,7 +756,7 @@ declare class Collection {
|
|
|
778
756
|
* });
|
|
779
757
|
* ```
|
|
780
758
|
*/
|
|
781
|
-
modify({ name, metadata }?: ModifyCollectionParams): Promise<void>;
|
|
759
|
+
modify({ name, metadata, }?: ModifyCollectionParams): Promise<void>;
|
|
782
760
|
/**
|
|
783
761
|
* Get items from the collection
|
|
784
762
|
* @param {Object} params - The parameters for the query.
|
|
@@ -890,7 +868,7 @@ declare class Collection {
|
|
|
890
868
|
* });
|
|
891
869
|
* ```
|
|
892
870
|
*/
|
|
893
|
-
delete({ ids, where, whereDocument }?: DeleteParams): Promise<string[]>;
|
|
871
|
+
delete({ ids, where, whereDocument, }?: DeleteParams): Promise<string[]>;
|
|
894
872
|
}
|
|
895
873
|
|
|
896
874
|
declare class ChromaClient {
|
|
@@ -898,10 +876,10 @@ declare class ChromaClient {
|
|
|
898
876
|
* @ignore
|
|
899
877
|
*/
|
|
900
878
|
private api;
|
|
901
|
-
private apiAdapter;
|
|
902
879
|
private tenant;
|
|
903
880
|
private database;
|
|
904
881
|
private _adminClient?;
|
|
882
|
+
private authProvider;
|
|
905
883
|
/**
|
|
906
884
|
* Creates a new ChromaClient instance.
|
|
907
885
|
* @param {Object} params - The parameters for creating a new client
|
|
@@ -920,7 +898,8 @@ declare class ChromaClient {
|
|
|
920
898
|
* Resets the state of the object by making an API call to the reset endpoint.
|
|
921
899
|
*
|
|
922
900
|
* @returns {Promise<boolean>} A promise that resolves when the reset operation is complete.
|
|
923
|
-
* @throws {
|
|
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.
|
|
924
903
|
*
|
|
925
904
|
* @example
|
|
926
905
|
* ```typescript
|
|
@@ -931,6 +910,7 @@ declare class ChromaClient {
|
|
|
931
910
|
/**
|
|
932
911
|
* Returns the version of the Chroma API.
|
|
933
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.
|
|
934
914
|
*
|
|
935
915
|
* @example
|
|
936
916
|
* ```typescript
|
|
@@ -941,6 +921,7 @@ declare class ChromaClient {
|
|
|
941
921
|
/**
|
|
942
922
|
* Returns a heartbeat from the Chroma API.
|
|
943
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.
|
|
944
925
|
*
|
|
945
926
|
* @example
|
|
946
927
|
* ```typescript
|
|
@@ -957,7 +938,8 @@ declare class ChromaClient {
|
|
|
957
938
|
* @param {IEmbeddingFunction} [params.embeddingFunction] - Optional custom embedding function for the collection.
|
|
958
939
|
*
|
|
959
940
|
* @returns {Promise<Collection>} A promise that resolves to the created collection.
|
|
960
|
-
* @throws {
|
|
941
|
+
* @throws {ChromaConnectionError} If the client is unable to connect to the server.
|
|
942
|
+
* @throws {ChromaServerError} If there is an issue creating the collection.
|
|
961
943
|
*
|
|
962
944
|
* @example
|
|
963
945
|
* ```typescript
|
|
@@ -969,7 +951,7 @@ declare class ChromaClient {
|
|
|
969
951
|
* });
|
|
970
952
|
* ```
|
|
971
953
|
*/
|
|
972
|
-
createCollection({ name, metadata, embeddingFunction }: CreateCollectionParams): Promise<Collection>;
|
|
954
|
+
createCollection({ name, metadata, embeddingFunction, }: CreateCollectionParams): Promise<Collection>;
|
|
973
955
|
/**
|
|
974
956
|
* Gets or creates a collection with the specified properties.
|
|
975
957
|
*
|
|
@@ -991,7 +973,7 @@ declare class ChromaClient {
|
|
|
991
973
|
* });
|
|
992
974
|
* ```
|
|
993
975
|
*/
|
|
994
|
-
getOrCreateCollection({ name, metadata, embeddingFunction }: GetOrCreateCollectionParams): Promise<Collection>;
|
|
976
|
+
getOrCreateCollection({ name, metadata, embeddingFunction, }: GetOrCreateCollectionParams): Promise<Collection>;
|
|
995
977
|
/**
|
|
996
978
|
* Lists all collections.
|
|
997
979
|
*
|
|
@@ -1036,7 +1018,7 @@ declare class ChromaClient {
|
|
|
1036
1018
|
* });
|
|
1037
1019
|
* ```
|
|
1038
1020
|
*/
|
|
1039
|
-
getCollection({ name, embeddingFunction }: GetCollectionParams): Promise<Collection>;
|
|
1021
|
+
getCollection({ name, embeddingFunction, }: GetCollectionParams): Promise<Collection>;
|
|
1040
1022
|
/**
|
|
1041
1023
|
* Deletes a collection with the specified name.
|
|
1042
1024
|
* @param {Object} params - The parameters for deleting a collection.
|
|
@@ -1051,7 +1033,7 @@ declare class ChromaClient {
|
|
|
1051
1033
|
* });
|
|
1052
1034
|
* ```
|
|
1053
1035
|
*/
|
|
1054
|
-
deleteCollection({ name }: DeleteCollectionParams): Promise<void>;
|
|
1036
|
+
deleteCollection({ name, }: DeleteCollectionParams): Promise<void>;
|
|
1055
1037
|
}
|
|
1056
1038
|
|
|
1057
1039
|
interface Tenant {
|
|
@@ -1065,7 +1047,7 @@ declare class AdminClient {
|
|
|
1065
1047
|
* @ignore
|
|
1066
1048
|
*/
|
|
1067
1049
|
private api;
|
|
1068
|
-
private
|
|
1050
|
+
private authProvider;
|
|
1069
1051
|
tenant: string;
|
|
1070
1052
|
database: string;
|
|
1071
1053
|
/**
|
|
@@ -1081,7 +1063,7 @@ declare class AdminClient {
|
|
|
1081
1063
|
* });
|
|
1082
1064
|
* ```
|
|
1083
1065
|
*/
|
|
1084
|
-
constructor({ path, fetchOptions, auth, tenant, database }?: {
|
|
1066
|
+
constructor({ path, fetchOptions, auth, tenant, database, }?: {
|
|
1085
1067
|
path?: string;
|
|
1086
1068
|
fetchOptions?: RequestInit;
|
|
1087
1069
|
auth?: AuthOptions;
|
|
@@ -1106,7 +1088,7 @@ declare class AdminClient {
|
|
|
1106
1088
|
* });
|
|
1107
1089
|
* ```
|
|
1108
1090
|
*/
|
|
1109
|
-
setTenant({ tenant, database }: {
|
|
1091
|
+
setTenant({ tenant, database, }: {
|
|
1110
1092
|
tenant: string;
|
|
1111
1093
|
database?: string;
|
|
1112
1094
|
}): Promise<void>;
|
|
@@ -1126,7 +1108,7 @@ declare class AdminClient {
|
|
|
1126
1108
|
* });
|
|
1127
1109
|
* ```
|
|
1128
1110
|
*/
|
|
1129
|
-
setDatabase({ database }: {
|
|
1111
|
+
setDatabase({ database, }: {
|
|
1130
1112
|
database?: string;
|
|
1131
1113
|
}): Promise<void>;
|
|
1132
1114
|
/**
|
|
@@ -1145,7 +1127,7 @@ declare class AdminClient {
|
|
|
1145
1127
|
* });
|
|
1146
1128
|
* ```
|
|
1147
1129
|
*/
|
|
1148
|
-
createTenant({ name
|
|
1130
|
+
createTenant({ name }: {
|
|
1149
1131
|
name: string;
|
|
1150
1132
|
}): Promise<Tenant>;
|
|
1151
1133
|
/**
|
|
@@ -1164,7 +1146,7 @@ declare class AdminClient {
|
|
|
1164
1146
|
* });
|
|
1165
1147
|
* ```
|
|
1166
1148
|
*/
|
|
1167
|
-
getTenant({ name
|
|
1149
|
+
getTenant({ name }: {
|
|
1168
1150
|
name: string;
|
|
1169
1151
|
}): Promise<Tenant>;
|
|
1170
1152
|
/**
|
|
@@ -1185,7 +1167,7 @@ declare class AdminClient {
|
|
|
1185
1167
|
* });
|
|
1186
1168
|
* ```
|
|
1187
1169
|
*/
|
|
1188
|
-
createDatabase({ name, tenantName }: {
|
|
1170
|
+
createDatabase({ name, tenantName, }: {
|
|
1189
1171
|
name: string;
|
|
1190
1172
|
tenantName: string;
|
|
1191
1173
|
}): Promise<Database>;
|
|
@@ -1207,7 +1189,7 @@ declare class AdminClient {
|
|
|
1207
1189
|
* });
|
|
1208
1190
|
* ```
|
|
1209
1191
|
*/
|
|
1210
|
-
getDatabase({ name, tenantName }: {
|
|
1192
|
+
getDatabase({ name, tenantName, }: {
|
|
1211
1193
|
name: string;
|
|
1212
1194
|
tenantName: string;
|
|
1213
1195
|
}): Promise<Database>;
|
|
@@ -1228,7 +1210,7 @@ declare class OpenAIEmbeddingFunction implements IEmbeddingFunction {
|
|
|
1228
1210
|
private org_id;
|
|
1229
1211
|
private model;
|
|
1230
1212
|
private openaiApi?;
|
|
1231
|
-
constructor({ openai_api_key, openai_model, openai_organization_id }: {
|
|
1213
|
+
constructor({ openai_api_key, openai_model, openai_organization_id, }: {
|
|
1232
1214
|
openai_api_key: string;
|
|
1233
1215
|
openai_model?: string;
|
|
1234
1216
|
openai_organization_id?: string;
|
|
@@ -1324,7 +1306,7 @@ declare class JinaEmbeddingFunction implements IEmbeddingFunction {
|
|
|
1324
1306
|
private model_name;
|
|
1325
1307
|
private api_url;
|
|
1326
1308
|
private headers;
|
|
1327
|
-
constructor({ jinaai_api_key, model_name }: {
|
|
1309
|
+
constructor({ jinaai_api_key, model_name, }: {
|
|
1328
1310
|
jinaai_api_key: string;
|
|
1329
1311
|
model_name?: string;
|
|
1330
1312
|
});
|
|
@@ -1336,7 +1318,7 @@ declare class GoogleGenerativeAiEmbeddingFunction implements IEmbeddingFunction
|
|
|
1336
1318
|
private model;
|
|
1337
1319
|
private googleGenAiApi?;
|
|
1338
1320
|
private taskType;
|
|
1339
|
-
constructor({ googleApiKey, model, taskType }: {
|
|
1321
|
+
constructor({ googleApiKey, model, taskType, }: {
|
|
1340
1322
|
googleApiKey: string;
|
|
1341
1323
|
model?: string;
|
|
1342
1324
|
taskType?: string;
|
|
@@ -1349,4 +1331,14 @@ declare class GoogleGenerativeAiEmbeddingFunction implements IEmbeddingFunction
|
|
|
1349
1331
|
}>;
|
|
1350
1332
|
}
|
|
1351
1333
|
|
|
1352
|
-
|
|
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 };
|