Skip to content

Commit af51006

Browse files
committed
[BUG] Replace empty config objects with None during deserializing
1 parent bba1822 commit af51006

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

chromadb/types.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
from chromadb.serde import BaseModelJSONSerializable
1717
from chromadb.api.collection_configuration import (
1818
CollectionConfiguration,
19-
HNSWConfiguration,
20-
SpannConfiguration,
2119
collection_configuration_to_json,
2220
load_collection_configuration_from_json,
2321
)
@@ -155,8 +153,8 @@ def get_configuration(self) -> CollectionConfiguration:
155153
stacklevel=2,
156154
)
157155
return CollectionConfiguration(
158-
hnsw=HNSWConfiguration(),
159-
spann=SpannConfiguration(),
156+
hnsw=None,
157+
spann=None,
160158
embedding_function=None,
161159
)
162160

@@ -175,11 +173,6 @@ def get_model_fields(self) -> Dict[Any, Any]:
175173
@override
176174
def from_json(cls, json_map: Dict[str, Any]) -> Self:
177175
"""Deserializes a Collection object from JSON"""
178-
configuration: CollectionConfiguration = {
179-
"hnsw": {},
180-
"spann": {},
181-
"embedding_function": None,
182-
}
183176
try:
184177
configuration_json = json_map.get("configuration_json", None)
185178
configuration = load_collection_configuration_from_json(configuration_json)
@@ -189,6 +182,11 @@ def from_json(cls, json_map: Dict[str, Any]) -> Self:
189182
DeprecationWarning,
190183
stacklevel=2,
191184
)
185+
configuration = CollectionConfiguration(
186+
hnsw=None,
187+
spann=None,
188+
embedding_function=None,
189+
)
192190
return cls(
193191
id=json_map["id"],
194192
name=json_map["name"],

0 commit comments

Comments
 (0)