Skip to content

Commit 4fe10b2

Browse files
committed
Backwards compatible interface
1 parent 3336e2b commit 4fe10b2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

libs/labelbox/src/labelbox/client.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,8 @@ def create_project(self, **kwargs) -> Project:
733733
description (str): A short summary for the project
734734
media_type (MediaType): The type of assets that this project will accept
735735
queue_mode (Optional[QueueMode]): The queue mode to use
736+
quality_mode (Optional[QualityMode]): The quality mode to use (e.g. Benchmark, Consensus). Defaults to
737+
Benchmark
736738
quality_modes (Optional[List[QualityMode]]): The quality modes to use (e.g. Benchmark, Consensus). Defaults to
737739
Benchmark.
738740
Returns:
@@ -786,17 +788,23 @@ def create_project(self, **kwargs) -> Project:
786788
editor_task_type_value = None
787789

788790
quality_modes = kwargs.get("quality_modes")
789-
if not quality_modes:
791+
quality_mode = kwargs.get("quality_mode")
792+
if quality_modes and quality_mode:
793+
raise ValueError(
794+
"Cannot use both quality_modes and quality_mode at the same time. Use one or the other.")
795+
796+
if not quality_modes and not quality_mode:
790797
logger.info("Defaulting quality modes to Benchmark.")
791798

792799
data = kwargs
793800
data.pop("quality_modes", None)
794-
if quality_modes is None or quality_modes == [QualityMode.Benchmark]:
801+
data.pop("quality_mode", None)
802+
if quality_modes is None or quality_modes == [QualityMode.Benchmark] or quality_mode == QualityMode.Benchmark:
795803
data[
796804
"auto_audit_number_of_labels"] = BENCHMARK_AUTO_AUDIT_NUMBER_OF_LABELS
797805
data["auto_audit_percentage"] = BENCHMARK_AUTO_AUDIT_PERCENTAGE
798806
data["is_benchmark_enabled"] = True
799-
elif QualityMode.Consensus in quality_modes:
807+
elif QualityMode.Consensus in (quality_modes if quality_modes else []) or quality_mode == QualityMode.Consensus:
800808
data[
801809
"auto_audit_number_of_labels"] = CONSENSUS_AUTO_AUDIT_NUMBER_OF_LABELS
802810
data["auto_audit_percentage"] = CONSENSUS_AUTO_AUDIT_PERCENTAGE

0 commit comments

Comments
 (0)