Skip to content

Commit 3f1fdcc

Browse files
author
Val Brodsky
committed
Add upload_type to Project
1 parent 39a8b0b commit 3f1fdcc

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

libs/labelbox/src/labelbox/schema/ontology_kind.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ def is_supported(cls, value):
3434
return isinstance(value, cls)
3535

3636
@classmethod
37-
def _missing_(cls, name) -> 'EditorTaskType':
37+
def _missing_(cls, value) -> 'EditorTaskType':
3838
"""Handle missing null new task types
3939
Handle upper case names for compatibility with
4040
the GraphQL"""
4141

42-
if name is None:
42+
if value is None:
4343
return cls.Missing
4444

4545
for name, member in cls.__members__.items():
46-
if name == name.upper():
46+
if name == str(value).upper():
4747
return member
4848

4949
return cls.Missing
@@ -71,3 +71,24 @@ def map_to_editor_task_type(onotology_kind: OntologyKind,
7171
return EditorTaskType.ModelChatEvaluation
7272
else:
7373
return EditorTaskType.Missing
74+
75+
76+
class UploadType(Enum):
77+
Auto = 'AUTO',
78+
Manual = 'MANUAL',
79+
Missing = None
80+
81+
@classmethod
82+
def is_supported(cls, value):
83+
return isinstance(value, cls)
84+
85+
@classmethod
86+
def _missing_(cls, value: object) -> 'UploadType':
87+
if value is None:
88+
return cls.Missing
89+
90+
for name, member in cls.__members__.items():
91+
if name == str(value).upper():
92+
return member
93+
94+
return cls.Missing

libs/labelbox/src/labelbox/schema/project.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
from labelbox.schema.resource_tag import ResourceTag
3838
from labelbox.schema.task import Task
3939
from labelbox.schema.task_queue import TaskQueue
40-
from labelbox.schema.ontology_kind import (EditorTaskType, OntologyKind)
40+
from labelbox.schema.ontology_kind import (EditorTaskType, OntologyKind,
41+
UploadType)
4142
from labelbox.schema.project_overview import ProjectOverview, ProjectOverviewDetailed
4243

4344
if TYPE_CHECKING:
@@ -121,6 +122,7 @@ class Project(DbObject, Updateable, Deletable):
121122
editor_task_type = Field.Enum(EditorTaskType, "editor_task_type")
122123
data_row_count = Field.Int("data_row_count")
123124
model_setup_complete: Field = Field.Boolean("model_setup_complete")
125+
upload_type: Field = Field.Enum(UploadType, "upload_type")
124126

125127
# Relationships
126128
created_by = Relationship.ToOne("User", False, "created_by")
@@ -145,8 +147,7 @@ def is_chat_evaluation(self) -> bool:
145147
return self.media_type == MediaType.Conversational and self.editor_task_type == EditorTaskType.ModelChatEvaluation
146148

147149
def is_auto_data_generation(self) -> bool:
148-
return self.media_type == MediaType.LLMPromptCreation or self.media_type == MediaType.LLMPromptResponseCreation or self.is_chat_evaluation(
149-
)
150+
return (self.upload_type == UploadType.Auto) is True
150151

151152
def project_model_configs(self):
152153
query_str = """query ProjectModelConfigsPyApi($id: ID!) {

libs/labelbox/tests/unit/test_project.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_project_editor_task_type(api_editor_task_type,
3232
"queueMode": "BATCH",
3333
"setupComplete": "2021-06-01T00:00:00.000Z",
3434
"modelSetupComplete": None,
35+
"uploadType": "Auto",
3536
})
3637

3738
assert project.editor_task_type == expected_editor_task_type

0 commit comments

Comments
 (0)