chromadb 3.1.0 → 3.1.2

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.
@@ -688,14 +688,14 @@ declare const registerSparseEmbeddingFunction: (name: string, fn: SparseEmbeddin
688
688
  * @param efConfig - Configuration for the embedding function
689
689
  * @returns EmbeddingFunction instance or undefined if it cannot be constructed
690
690
  */
691
- declare const getEmbeddingFunction: (collectionName: string, efConfig?: EmbeddingFunctionConfiguration) => EmbeddingFunction | undefined;
691
+ declare const getEmbeddingFunction: (collectionName: string, efConfig?: EmbeddingFunctionConfiguration) => Promise<EmbeddingFunction | undefined>;
692
692
  /**
693
693
  * Retrieves and instantiates a sparse embedding function from configuration.
694
694
  * @param collectionName - Name of the collection (for error messages)
695
695
  * @param efConfig - Configuration for the sparse embedding function
696
696
  * @returns SparseEmbeddingFunction instance or undefined if it cannot be constructed
697
697
  */
698
- declare const getSparseEmbeddingFunction: (collectionName: string, efConfig?: EmbeddingFunctionConfiguration) => SparseEmbeddingFunction | undefined;
698
+ declare const getSparseEmbeddingFunction: (collectionName: string, efConfig?: EmbeddingFunctionConfiguration) => Promise<SparseEmbeddingFunction | undefined>;
699
699
  /**
700
700
  * Serializes an embedding function to configuration format.
701
701
  * @param embeddingFunction - User provided embedding function
@@ -714,55 +714,170 @@ declare const serializeEmbeddingFunction: ({ embeddingFunction, configEmbeddingF
714
714
  */
715
715
  declare const getDefaultEFConfig: () => Promise<EmbeddingFunctionConfiguration>;
716
716
 
717
- interface CollectionConfiguration {
718
- embeddingFunction?: EmbeddingFunctionConfiguration | null;
719
- hnsw?: HNSWConfiguration | null;
720
- spann?: SpannConfiguration | null;
717
+ type WhereJSON = Record<string, unknown>;
718
+ type WhereInput = WhereExpression | WhereJSON | null | undefined;
719
+ declare abstract class WhereExpressionBase {
720
+ abstract toJSON(): WhereJSON;
721
+ and(other: WhereInput): WhereExpression;
722
+ or(other: WhereInput): WhereExpression;
721
723
  }
722
- type HNSWConfiguration = HnswConfiguration & {
723
- batch_size?: number | null;
724
- num_threads?: number | null;
725
- };
726
- type CreateCollectionConfiguration = Omit<CollectionConfiguration, "embeddingFunction"> & {
727
- embeddingFunction?: EmbeddingFunction;
728
- };
729
- interface UpdateCollectionConfiguration {
730
- embeddingFunction?: EmbeddingFunction;
731
- hnsw?: UpdateHNSWConfiguration;
732
- spann?: UpdateSPANNConfiguration;
724
+ declare abstract class WhereExpression extends WhereExpressionBase {
725
+ static from(input: WhereInput): WhereExpression | undefined;
733
726
  }
734
- interface UpdateHNSWConfiguration {
735
- batch_size?: number;
736
- ef_search?: number;
737
- num_threads?: number;
738
- resize_factor?: number;
739
- sync_threshold?: number;
727
+
728
+ type IterableInput<T> = Iterable<T> | ArrayLike<T>;
729
+
730
+ declare class Key {
731
+ readonly name: string;
732
+ static readonly ID: Key;
733
+ static readonly DOCUMENT: Key;
734
+ static readonly EMBEDDING: Key;
735
+ static readonly METADATA: Key;
736
+ static readonly SCORE: Key;
737
+ constructor(name: string);
738
+ eq(value: unknown): WhereExpression;
739
+ ne(value: unknown): WhereExpression;
740
+ gt(value: unknown): WhereExpression;
741
+ gte(value: unknown): WhereExpression;
742
+ lt(value: unknown): WhereExpression;
743
+ lte(value: unknown): WhereExpression;
744
+ isIn(values: IterableInput<unknown>): WhereExpression;
745
+ notIn(values: IterableInput<unknown>): WhereExpression;
746
+ contains(value: string): WhereExpression;
747
+ notContains(value: string): WhereExpression;
748
+ regex(pattern: string): WhereExpression;
749
+ notRegex(pattern: string): WhereExpression;
740
750
  }
741
- interface UpdateSPANNConfiguration {
742
- search_nprobe?: number;
743
- ef_search?: number;
751
+ interface KeyFactory {
752
+ (name: string): Key;
753
+ ID: Key;
754
+ DOCUMENT: Key;
755
+ EMBEDDING: Key;
756
+ METADATA: Key;
757
+ SCORE: Key;
758
+ }
759
+ declare const K: KeyFactory;
760
+
761
+ interface LimitOptions {
762
+ offset?: number;
763
+ limit?: number | null | undefined;
764
+ }
765
+ type LimitInput = Limit | number | LimitOptions | null | undefined;
766
+ declare class Limit {
767
+ readonly offset: number;
768
+ readonly limit?: number;
769
+ constructor(options?: LimitOptions);
770
+ static from(input: LimitInput, offsetOverride?: number): Limit;
771
+ toJSON(): {
772
+ offset: number;
773
+ limit?: number;
774
+ };
775
+ }
776
+
777
+ type SelectKeyInput = string | Key;
778
+ type SelectInput = Select | Iterable<SelectKeyInput> | {
779
+ keys?: Iterable<SelectKeyInput>;
780
+ } | null | undefined;
781
+ declare class Select {
782
+ private readonly keys;
783
+ constructor(keys?: Iterable<SelectKeyInput>);
784
+ static from(input: SelectInput): Select;
785
+ static all(): Select;
786
+ get values(): string[];
787
+ toJSON(): {
788
+ keys: string[];
789
+ };
790
+ }
791
+
792
+ type RankLiteral = Record<string, unknown>;
793
+ type RankInput = RankExpression | RankLiteral | number | null | undefined;
794
+ declare abstract class RankExpressionBase {
795
+ abstract toJSON(): Record<string, unknown>;
796
+ add(...others: RankInput[]): RankExpression;
797
+ subtract(other: RankInput): RankExpression;
798
+ multiply(...others: RankInput[]): RankExpression;
799
+ divide(other: RankInput): RankExpression;
800
+ negate(): RankExpression;
801
+ abs(): RankExpression;
802
+ exp(): RankExpression;
803
+ log(): RankExpression;
804
+ max(...others: RankInput[]): RankExpression;
805
+ min(...others: RankInput[]): RankExpression;
806
+ }
807
+ declare abstract class RankExpression extends RankExpressionBase {
808
+ static from(input: RankInput): RankExpression | undefined;
809
+ }
810
+ interface KnnOptions {
811
+ query: IterableInput<number> | SparseVector | string;
812
+ key?: string | Key;
813
+ limit?: number;
814
+ default?: number | null;
815
+ returnRank?: boolean;
816
+ }
817
+ declare const Val: (value: number) => RankExpression;
818
+ declare const Knn: (options: KnnOptions) => RankExpression;
819
+ interface RrfOptions {
820
+ ranks: RankInput[];
821
+ k?: number;
822
+ weights?: number[];
823
+ normalize?: boolean;
824
+ }
825
+ declare const Rrf: ({ ranks, k, weights, normalize }: RrfOptions) => RankExpression;
826
+ declare const Sum: (...inputs: RankInput[]) => RankExpression;
827
+ declare const Sub: (left: RankInput, right: RankInput) => RankExpression;
828
+ declare const Mul: (...inputs: RankInput[]) => RankExpression;
829
+ declare const Div: (left: RankInput, right: RankInput) => RankExpression;
830
+ declare const Abs: (input: RankInput) => RankExpression;
831
+ declare const Exp: (input: RankInput) => RankExpression;
832
+ declare const Log: (input: RankInput) => RankExpression;
833
+ declare const Max: (...inputs: RankInput[]) => RankExpression;
834
+ declare const Min: (...inputs: RankInput[]) => RankExpression;
835
+
836
+ interface SearchInit {
837
+ where?: WhereInput;
838
+ rank?: RankInput;
839
+ limit?: LimitInput;
840
+ select?: SelectInput;
841
+ }
842
+ declare class Search {
843
+ private _where?;
844
+ private _rank?;
845
+ private _limit;
846
+ private _select;
847
+ constructor(init?: SearchInit);
848
+ private clone;
849
+ where(where?: WhereInput): Search;
850
+ rank(rank?: RankInput): Search;
851
+ limit(limit?: LimitInput, offset?: number): Search;
852
+ select(keys?: SelectInput): Search;
853
+ select(...keys: SelectKeyInput[]): Search;
854
+ selectAll(): Search;
855
+ get whereClause(): WhereExpression | undefined;
856
+ get rankExpression(): RankExpression | undefined;
857
+ get limitConfig(): Limit;
858
+ get selectConfig(): Select;
859
+ toPayload(): SearchPayload;
860
+ }
861
+ type SearchLike = Search | SearchInit;
862
+ declare const toSearch: (input: SearchLike) => Search;
863
+
864
+ interface SearchResultRow {
865
+ id: string;
866
+ document?: string | null;
867
+ embedding?: number[] | null;
868
+ metadata?: Metadata | null;
869
+ score?: number | null;
870
+ }
871
+ declare class SearchResult {
872
+ readonly ids: string[][];
873
+ readonly documents: Array<Array<string | null> | null>;
874
+ readonly embeddings: Array<Array<Array<number> | null> | null>;
875
+ readonly metadatas: Array<Array<Metadata | null> | null>;
876
+ readonly scores: Array<Array<number | null> | null>;
877
+ readonly select: SearchResponse["select"];
878
+ constructor(response: SearchResponse);
879
+ rows(): SearchResultRow[][];
744
880
  }
745
- /**
746
- * Validate user provided collection configuration and embedding function. Returns a
747
- * CollectionConfiguration to be used in collection creation.
748
- */
749
- declare const processCreateCollectionConfig: ({ configuration, embeddingFunction, metadata, }: {
750
- configuration?: CreateCollectionConfiguration;
751
- embeddingFunction?: EmbeddingFunction | null;
752
- metadata?: CollectionMetadata;
753
- }) => Promise<CollectionConfiguration>;
754
- /**
755
- *
756
- */
757
- declare const processUpdateCollectionConfig: ({ collectionName, currentConfiguration, currentEmbeddingFunction, newConfiguration, }: {
758
- collectionName: string;
759
- currentConfiguration: CollectionConfiguration;
760
- currentEmbeddingFunction?: EmbeddingFunction;
761
- newConfiguration: UpdateCollectionConfiguration;
762
- }) => Promise<{
763
- updateConfiguration?: UpdateCollectionConfiguration$1;
764
- updateEmbeddingFunction?: EmbeddingFunction;
765
- }>;
766
881
 
767
882
  declare const DOCUMENT_KEY = "#document";
768
883
  declare const EMBEDDING_KEY = "#embedding";
@@ -784,14 +899,14 @@ declare class BoolInvertedIndexConfig {
784
899
  interface VectorIndexConfigOptions {
785
900
  space?: Space | null;
786
901
  embeddingFunction?: EmbeddingFunction | null;
787
- sourceKey?: string | null;
902
+ sourceKey?: string | Key | null;
788
903
  hnsw?: HnswIndexConfig | null;
789
904
  spann?: SpannIndexConfig | null;
790
905
  }
791
906
  declare class VectorIndexConfig {
792
907
  readonly type = "VectorIndexConfig";
793
908
  space: Space | null;
794
- embeddingFunction: EmbeddingFunction | null;
909
+ embeddingFunction?: EmbeddingFunction | null;
795
910
  sourceKey: string | null;
796
911
  hnsw: HnswIndexConfig | null;
797
912
  spann: SpannIndexConfig | null;
@@ -799,12 +914,12 @@ declare class VectorIndexConfig {
799
914
  }
800
915
  interface SparseVectorIndexConfigOptions {
801
916
  embeddingFunction?: SparseEmbeddingFunction | null;
802
- sourceKey?: string | null;
917
+ sourceKey?: string | Key | null;
803
918
  bm25?: boolean | null;
804
919
  }
805
920
  declare class SparseVectorIndexConfig {
806
921
  readonly type = "SparseVectorIndexConfig";
807
- embeddingFunction: SparseEmbeddingFunction | null;
922
+ embeddingFunction?: SparseEmbeddingFunction | null;
808
923
  sourceKey: string | null;
809
924
  bm25: boolean | null;
810
925
  constructor(options?: SparseVectorIndexConfigOptions);
@@ -886,7 +1001,7 @@ declare class Schema {
886
1001
  createIndex(config?: IndexConfig, key?: string): this;
887
1002
  deleteIndex(config?: IndexConfig, key?: string): this;
888
1003
  serializeToJSON(): Schema$1;
889
- static deserializeFromJSON(json?: Schema$1 | JsonDict | null): Schema | undefined;
1004
+ static deserializeFromJSON(json?: Schema$1 | JsonDict | null): Promise<Schema | undefined>;
890
1005
  private setVectorIndexConfig;
891
1006
  private setFtsIndexConfig;
892
1007
  private setIndexInDefaults;
@@ -915,8 +1030,60 @@ declare class Schema {
915
1030
  private static deserializeBoolValueType;
916
1031
  private static deserializeVectorConfig;
917
1032
  private static deserializeSparseVectorConfig;
1033
+ resolveEmbeddingFunction(): EmbeddingFunction | null | undefined;
918
1034
  }
919
1035
 
1036
+ interface CollectionConfiguration {
1037
+ embeddingFunction?: EmbeddingFunctionConfiguration | null;
1038
+ hnsw?: HNSWConfiguration | null;
1039
+ spann?: SpannConfiguration | null;
1040
+ }
1041
+ type HNSWConfiguration = HnswConfiguration & {
1042
+ batch_size?: number | null;
1043
+ num_threads?: number | null;
1044
+ };
1045
+ type CreateCollectionConfiguration = Omit<CollectionConfiguration, "embeddingFunction"> & {
1046
+ embeddingFunction?: EmbeddingFunction;
1047
+ };
1048
+ interface UpdateCollectionConfiguration {
1049
+ embeddingFunction?: EmbeddingFunction;
1050
+ hnsw?: UpdateHNSWConfiguration;
1051
+ spann?: UpdateSPANNConfiguration;
1052
+ }
1053
+ interface UpdateHNSWConfiguration {
1054
+ batch_size?: number;
1055
+ ef_search?: number;
1056
+ num_threads?: number;
1057
+ resize_factor?: number;
1058
+ sync_threshold?: number;
1059
+ }
1060
+ interface UpdateSPANNConfiguration {
1061
+ search_nprobe?: number;
1062
+ ef_search?: number;
1063
+ }
1064
+ /**
1065
+ * Validate user provided collection configuration and embedding function. Returns a
1066
+ * CollectionConfiguration to be used in collection creation.
1067
+ */
1068
+ declare const processCreateCollectionConfig: ({ configuration, embeddingFunction, metadata, schema, }: {
1069
+ configuration?: CreateCollectionConfiguration;
1070
+ embeddingFunction?: EmbeddingFunction | null;
1071
+ metadata?: CollectionMetadata;
1072
+ schema?: Schema;
1073
+ }) => Promise<CollectionConfiguration>;
1074
+ /**
1075
+ *
1076
+ */
1077
+ declare const processUpdateCollectionConfig: ({ collectionName, currentConfiguration, currentEmbeddingFunction, newConfiguration, }: {
1078
+ collectionName: string;
1079
+ currentConfiguration: CollectionConfiguration;
1080
+ currentEmbeddingFunction?: EmbeddingFunction;
1081
+ newConfiguration: UpdateCollectionConfiguration;
1082
+ }) => Promise<{
1083
+ updateConfiguration?: UpdateCollectionConfiguration$1;
1084
+ updateEmbeddingFunction?: EmbeddingFunction;
1085
+ }>;
1086
+
920
1087
  /**
921
1088
  * Configuration options for the ChromaClient.
922
1089
  */
@@ -1093,171 +1260,6 @@ declare class ChromaClient {
1093
1260
  supportsBase64Encoding(): Promise<boolean>;
1094
1261
  }
1095
1262
 
1096
- type WhereJSON = Record<string, unknown>;
1097
- type WhereInput = WhereExpression | WhereJSON | null | undefined;
1098
- declare abstract class WhereExpressionBase {
1099
- abstract toJSON(): WhereJSON;
1100
- and(other: WhereInput): WhereExpression;
1101
- or(other: WhereInput): WhereExpression;
1102
- }
1103
- declare abstract class WhereExpression extends WhereExpressionBase {
1104
- static from(input: WhereInput): WhereExpression | undefined;
1105
- }
1106
-
1107
- type IterableInput<T> = Iterable<T> | ArrayLike<T>;
1108
-
1109
- declare class Key {
1110
- readonly name: string;
1111
- static readonly ID: Key;
1112
- static readonly DOCUMENT: Key;
1113
- static readonly EMBEDDING: Key;
1114
- static readonly METADATA: Key;
1115
- static readonly SCORE: Key;
1116
- constructor(name: string);
1117
- eq(value: unknown): WhereExpression;
1118
- ne(value: unknown): WhereExpression;
1119
- gt(value: unknown): WhereExpression;
1120
- gte(value: unknown): WhereExpression;
1121
- lt(value: unknown): WhereExpression;
1122
- lte(value: unknown): WhereExpression;
1123
- isIn(values: IterableInput<unknown>): WhereExpression;
1124
- notIn(values: IterableInput<unknown>): WhereExpression;
1125
- contains(value: string): WhereExpression;
1126
- notContains(value: string): WhereExpression;
1127
- regex(pattern: string): WhereExpression;
1128
- notRegex(pattern: string): WhereExpression;
1129
- }
1130
- interface KeyFactory {
1131
- (name: string): Key;
1132
- ID: Key;
1133
- DOCUMENT: Key;
1134
- EMBEDDING: Key;
1135
- METADATA: Key;
1136
- SCORE: Key;
1137
- }
1138
- declare const K: KeyFactory;
1139
-
1140
- interface LimitOptions {
1141
- offset?: number;
1142
- limit?: number | null | undefined;
1143
- }
1144
- type LimitInput = Limit | number | LimitOptions | null | undefined;
1145
- declare class Limit {
1146
- readonly offset: number;
1147
- readonly limit?: number;
1148
- constructor(options?: LimitOptions);
1149
- static from(input: LimitInput, offsetOverride?: number): Limit;
1150
- toJSON(): {
1151
- offset: number;
1152
- limit?: number;
1153
- };
1154
- }
1155
-
1156
- type SelectKeyInput = string | Key;
1157
- type SelectInput = Select | Iterable<SelectKeyInput> | {
1158
- keys?: Iterable<SelectKeyInput>;
1159
- } | null | undefined;
1160
- declare class Select {
1161
- private readonly keys;
1162
- constructor(keys?: Iterable<SelectKeyInput>);
1163
- static from(input: SelectInput): Select;
1164
- static all(): Select;
1165
- get values(): string[];
1166
- toJSON(): {
1167
- keys: string[];
1168
- };
1169
- }
1170
-
1171
- type RankLiteral = Record<string, unknown>;
1172
- type RankInput = RankExpression | RankLiteral | number | null | undefined;
1173
- declare abstract class RankExpressionBase {
1174
- abstract toJSON(): Record<string, unknown>;
1175
- add(...others: RankInput[]): RankExpression;
1176
- subtract(other: RankInput): RankExpression;
1177
- multiply(...others: RankInput[]): RankExpression;
1178
- divide(other: RankInput): RankExpression;
1179
- negate(): RankExpression;
1180
- abs(): RankExpression;
1181
- exp(): RankExpression;
1182
- log(): RankExpression;
1183
- max(...others: RankInput[]): RankExpression;
1184
- min(...others: RankInput[]): RankExpression;
1185
- }
1186
- declare abstract class RankExpression extends RankExpressionBase {
1187
- static from(input: RankInput): RankExpression | undefined;
1188
- }
1189
- interface KnnOptions {
1190
- query: IterableInput<number> | SparseVector | string;
1191
- key?: string | Key;
1192
- limit?: number;
1193
- default?: number | null;
1194
- returnRank?: boolean;
1195
- }
1196
- declare const Val: (value: number) => RankExpression;
1197
- declare const Knn: (options: KnnOptions) => RankExpression;
1198
- interface RrfOptions {
1199
- ranks: RankInput[];
1200
- k?: number;
1201
- weights?: number[];
1202
- normalize?: boolean;
1203
- }
1204
- declare const Rrf: ({ ranks, k, weights, normalize }: RrfOptions) => RankExpression;
1205
- declare const Sum: (...inputs: RankInput[]) => RankExpression;
1206
- declare const Sub: (left: RankInput, right: RankInput) => RankExpression;
1207
- declare const Mul: (...inputs: RankInput[]) => RankExpression;
1208
- declare const Div: (left: RankInput, right: RankInput) => RankExpression;
1209
- declare const Abs: (input: RankInput) => RankExpression;
1210
- declare const Exp: (input: RankInput) => RankExpression;
1211
- declare const Log: (input: RankInput) => RankExpression;
1212
- declare const Max: (...inputs: RankInput[]) => RankExpression;
1213
- declare const Min: (...inputs: RankInput[]) => RankExpression;
1214
-
1215
- interface SearchInit {
1216
- where?: WhereInput;
1217
- rank?: RankInput;
1218
- limit?: LimitInput;
1219
- select?: SelectInput;
1220
- }
1221
- declare class Search {
1222
- private _where?;
1223
- private _rank?;
1224
- private _limit;
1225
- private _select;
1226
- constructor(init?: SearchInit);
1227
- private clone;
1228
- where(where?: WhereInput): Search;
1229
- rank(rank?: RankInput): Search;
1230
- limit(limit?: LimitInput, offset?: number): Search;
1231
- select(keys?: SelectInput): Search;
1232
- select(...keys: SelectKeyInput[]): Search;
1233
- selectAll(): Search;
1234
- get whereClause(): WhereExpression | undefined;
1235
- get rankExpression(): RankExpression | undefined;
1236
- get limitConfig(): Limit;
1237
- get selectConfig(): Select;
1238
- toPayload(): SearchPayload;
1239
- }
1240
- type SearchLike = Search | SearchInit;
1241
- declare const toSearch: (input: SearchLike) => Search;
1242
-
1243
- interface SearchResultRow {
1244
- id: string;
1245
- document?: string | null;
1246
- embedding?: number[] | null;
1247
- metadata?: Metadata | null;
1248
- score?: number | null;
1249
- }
1250
- declare class SearchResult {
1251
- readonly ids: string[][];
1252
- readonly documents: Array<Array<string | null> | null>;
1253
- readonly embeddings: Array<Array<Array<number> | null> | null>;
1254
- readonly metadatas: Array<Array<Metadata | null> | null>;
1255
- readonly scores: Array<Array<number | null> | null>;
1256
- readonly select: SearchResponse["select"];
1257
- constructor(response: SearchResponse);
1258
- rows(): SearchResultRow[][];
1259
- }
1260
-
1261
1263
  /**
1262
1264
  * Interface for collection operations using collection ID.
1263
1265
  * Provides methods for adding, querying, updating, and deleting records.