Skip to content

Commit 60be7e3

Browse files
authored
[CHORE] Fix typing on empty configuration json returned, remove validation on num_threads in python (#4325)
## Description of changes This PR fixes a typing error when an empty configuration json is returned during get_configuration and removes validation on num_threads in python ## Test plan *How are these changes tested?* - [ ] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes *Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs repository](https://github.com/chroma-core/docs)?*
1 parent 868ac53 commit 60be7e3

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

Diff for: chromadb/api/collection_configuration.py

-8
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,6 @@ def validate_create_hnsw_config(
475475
if config["batch_size"] > config["sync_threshold"]:
476476
raise ValueError("batch_size must be less than or equal to sync_threshold")
477477
if "num_threads" in config:
478-
if config["num_threads"] > cpu_count():
479-
raise ValueError(
480-
"num_threads must be less than or equal to the number of available threads"
481-
)
482478
if config["num_threads"] <= 0:
483479
raise ValueError("num_threads must be greater than 0")
484480
if "resize_factor" in config:
@@ -535,10 +531,6 @@ def validate_update_hnsw_config(
535531
if config["ef_search"] <= 0:
536532
raise ValueError("ef_search must be greater than 0")
537533
if "num_threads" in config:
538-
if config["num_threads"] > cpu_count():
539-
raise ValueError(
540-
"num_threads must be less than or equal to the number of available threads"
541-
)
542534
if config["num_threads"] <= 0:
543535
raise ValueError("num_threads must be greater than 0")
544536
if "batch_size" in config and "sync_threshold" in config:

Diff for: chromadb/types.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
from chromadb.serde import BaseModelJSONSerializable
1717
from chromadb.api.collection_configuration import (
1818
CollectionConfiguration,
19+
HNSWConfiguration,
20+
SpannConfiguration,
1921
collection_configuration_to_json,
2022
load_collection_configuration_from_json,
2123
)
@@ -153,7 +155,8 @@ def get_configuration(self) -> CollectionConfiguration:
153155
stacklevel=2,
154156
)
155157
return CollectionConfiguration(
156-
hnsw={},
158+
hnsw=HNSWConfiguration(),
159+
spann=SpannConfiguration(),
157160
embedding_function=None,
158161
)
159162

0 commit comments

Comments
 (0)