Skip to content

Commit 9155723

Browse files
authored
Merge branch 'develop' into gu/pydantic_dataclasses
2 parents cf7e023 + fbd3b33 commit 9155723

38 files changed

+1378
-642
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Platform team's approval is required for all code changes (excluding notebook changes)
2-
* @Labelbox/platform
1+
# SDK team's approval is required for all code changes (excluding notebook changes)
2+
* @Labelbox/sdk
33
*.ipynb

docs/labelbox/fact-checking-tool.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Fact Checking Tool
2+
===============================================================================================
3+
4+
.. automodule:: labelbox.schema.tool_building.fact_checking_tool
5+
:members:
6+
:show-inheritance:

docs/labelbox/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Labelbox Python SDK Documentation
1919
enums
2020
exceptions
2121
export-task
22+
fact-checking-tool
2223
foundry-client
2324
foundry-model
2425
identifiable
@@ -39,14 +40,15 @@ Labelbox Python SDK Documentation
3940
pagination
4041
project
4142
project-model-config
43+
prompt-issue-tool
4244
quality-mode
4345
request-client
4446
resource-tag
4547
review
4648
search-filters
4749
send-to-annotate-params
4850
slice
49-
step_reasoning_tool
51+
step-reasoning-tool
5052
task
5153
task-queue
5254
user

docs/labelbox/prompt-issue-tool.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Step Reasoning Tool
2+
===============================================================================================
3+
4+
.. automodule:: labelbox.schema.tool_building.prompt_issue_tool
5+
:members:
6+
:show-inheritance:

libs/labelbox/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ dev-dependencies = [
7474
line-length = 80
7575

7676
[tool.ruff.lint]
77-
ignore = ["F841", "E722", "F811", "F402", "F601", "F403", "F821", "F541"]
77+
ignore = ["F841", "E722", "F811", "F403", "F821", "F541"]
7878
exclude = ["**/__init__.py"]
7979

8080
[tool.rye.scripts]

libs/labelbox/src/labelbox/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,14 @@
4646
from labelbox.schema.model_config import ModelConfig
4747
from labelbox.schema.model_run import DataSplit, ModelRun
4848
from labelbox.schema.ontology import (
49-
Classification,
5049
FeatureSchema,
5150
Ontology,
5251
OntologyBuilder,
53-
Option,
54-
PromptResponseClassification,
55-
ResponseOption,
5652
Tool,
5753
)
58-
from labelbox.schema.ontology import PromptResponseClassification
59-
from labelbox.schema.ontology import ResponseOption
54+
from labelbox.schema.tool_building.fact_checking_tool import FactCheckingTool
55+
from labelbox.schema.tool_building.step_reasoning_tool import StepReasoningTool
56+
from labelbox.schema.tool_building.prompt_issue_tool import PromptIssueTool
6057
from labelbox.schema.role import Role, ProjectRole
6158
from labelbox.schema.invite import Invite, InviteLimit
6259
from labelbox.schema.data_row_metadata import (
@@ -94,3 +91,10 @@
9491
from labelbox.schema.task_queue import TaskQueue
9592
from labelbox.schema.user import User
9693
from labelbox.schema.webhook import Webhook
94+
from labelbox.schema.tool_building.classification import (
95+
Classification,
96+
Option,
97+
ResponseOption,
98+
PromptResponseClassification,
99+
)
100+
from lbox.exceptions import *

libs/labelbox/src/labelbox/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ def _create_project(self, input: _CoreProjectInput) -> Project:
860860
extra_params = {k: v for k, v in extra_params.items() if v is not None}
861861
return self._create(Entity.Project, params, extra_params)
862862

863-
def get_roles(self) -> List[Role]:
863+
def get_roles(self) -> Dict[str, Role]:
864864
"""
865865
Returns:
866866
Roles: Provides information on available roles within an organization.

libs/labelbox/src/labelbox/schema/annotation_import.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Union,
1515
cast,
1616
)
17+
import warnings
1718

1819
import requests
1920
from google.api_core import retry
@@ -72,7 +73,7 @@ def errors(self) -> List[Dict[str, Any]]:
7273
See `AnnotationImport.statuses` for more details.
7374
* This information will expire after 24 hours.
7475
"""
75-
self.wait_until_done()
76+
self.wait_till_done()
7677
return self._fetch_remote_ndjson(self.error_file_url)
7778

7879
@property
@@ -101,15 +102,20 @@ def statuses(self) -> List[Dict[str, Any]]:
101102
102103
* This information will expire after 24 hours.
103104
"""
104-
self.wait_until_done()
105+
self.wait_till_done()
105106
return self._fetch_remote_ndjson(self.status_file_url)
106107

107-
def wait_till_done(
108+
def wait_until_done(
108109
self, sleep_time_seconds: int = 10, show_progress: bool = False
109110
) -> None:
110-
self.wait_until_done(sleep_time_seconds, show_progress)
111+
warnings.warn(
112+
"The method wait_until_done for AnnotationImport is deprecated and will be removed in the next major release. Use the wait_till_done method instead.",
113+
DeprecationWarning,
114+
stacklevel=2,
115+
)
116+
self.wait_till_done(sleep_time_seconds, show_progress)
111117

112-
def wait_until_done(
118+
def wait_till_done(
113119
self, sleep_time_seconds: int = 10, show_progress: bool = False
114120
) -> None:
115121
"""Blocks import job until certain conditions are met.
@@ -587,6 +593,20 @@ def parent_id(self) -> str:
587593
"""
588594
return self.project().uid
589595

596+
def delete(self) -> None:
597+
"""
598+
Deletes a MALPredictionImport job
599+
"""
600+
601+
query_string = """
602+
mutation deleteModelAssistedLabelingPredictionImportPyApi($id: ID!) {
603+
deleteModelAssistedLabelingPredictionImport(where: { id: $id }) {
604+
id
605+
}
606+
}
607+
"""
608+
self.client.execute(query_string, {"id": self.uid})
609+
590610
@classmethod
591611
def create_from_file(
592612
cls, client: "labelbox.Client", project_id: str, name: str, path: str

libs/labelbox/src/labelbox/schema/create_batches_task.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
from typing import TYPE_CHECKING, Callable, List, Optional, Dict, Any
3+
import warnings
34

45
from labelbox.orm.model import Entity
56

@@ -23,6 +24,11 @@ def __init__(
2324
]
2425

2526
def wait_until_done(self, timeout_seconds: int = 300) -> None:
27+
warnings.warn(
28+
"The method wait_until_done for CreateBatchesTask is deprecated and will be removed in the next major release. Use the wait_till_done method instead.",
29+
DeprecationWarning,
30+
stacklevel=2,
31+
)
2632
self.wait_till_done(timeout_seconds)
2733

2834
def wait_till_done(self, timeout_seconds: int = 300) -> None:

libs/labelbox/src/labelbox/schema/data_row_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
from labelbox.schema.identifiable import GlobalKey, UniqueId
3131
from labelbox.schema.identifiables import DataRowIdentifiers, UniqueIds
32-
from labelbox.schema.ontology import SchemaId
32+
from labelbox.schema.tool_building.types import SchemaId
3333
from labelbox.utils import (
3434
_CamelCaseMixin,
3535
format_iso_datetime,

libs/labelbox/src/labelbox/schema/export_task.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
TypeVar,
1717
Union,
1818
)
19+
import warnings
1920

2021
import requests
2122
from pydantic import BaseModel
@@ -484,6 +485,11 @@ def organization(self):
484485
return self._task.organization
485486

486487
def wait_until_done(self, timeout_seconds: int = 7200) -> None:
488+
warnings.warn(
489+
"The method wait_until_done for ExportTask is deprecated and will be removed in the next major release. Use the wait_till_done method instead.",
490+
DeprecationWarning,
491+
stacklevel=2,
492+
)
487493
self.wait_till_done(timeout_seconds)
488494

489495
def wait_till_done(self, timeout_seconds: int = 7200) -> None:

libs/labelbox/src/labelbox/schema/labeling_service_dashboard.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,17 @@ class LabelingServiceDashboard(_CamelCaseMixin):
7171
created_at: Optional[datetime] = Field(frozen=True, default=None)
7272
updated_at: Optional[datetime] = Field(frozen=True, default=None)
7373
created_by_id: Optional[str] = Field(frozen=True, default=None)
74-
status: LabelingServiceStatus = Field(frozen=True, default=None)
74+
status: Optional[LabelingServiceStatus] = Field(frozen=True, default=None)
7575
data_rows_count: int = Field(frozen=True)
7676
tasks_completed_count: int = Field(frozen=True)
7777
tasks_remaining_count: Optional[int] = Field(frozen=True, default=None)
7878
media_type: Optional[MediaType] = Field(frozen=True, default=None)
79-
editor_task_type: EditorTaskType = Field(frozen=True, default=None)
80-
tags: List[LabelingServiceDashboardTags] = Field(frozen=True, default=None)
79+
editor_task_type: Optional[EditorTaskType] = Field(
80+
frozen=True, default=None
81+
)
82+
tags: Optional[List[LabelingServiceDashboardTags]] = Field(
83+
frozen=True, default=None
84+
)
8185

8286
client: Any # type Any to avoid circular import from client
8387

libs/labelbox/src/labelbox/schema/model_run.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _upsert_labels_by_label_ids(
119119
MEALabelRegistrationTaskStatus(where: $where) {status errorMessage}
120120
}
121121
"""
122-
return self._wait_until_done(
122+
return self._wait_till_done(
123123
lambda: self.client.execute(
124124
status_query_str, {"where": {"id": task_id}}
125125
)["MEALabelRegistrationTaskStatus"],
@@ -144,7 +144,7 @@ def _upsert_labels_by_project_id(
144144
MEALabelRegistrationTaskStatus(where: $where) {status errorMessage}
145145
}
146146
"""
147-
return self._wait_until_done(
147+
return self._wait_till_done(
148148
lambda: self.client.execute(
149149
status_query_str, {"where": {"id": task_id}}
150150
)["MEALabelRegistrationTaskStatus"],
@@ -182,14 +182,14 @@ def upsert_data_rows(
182182
MEADataRowRegistrationTaskStatus(where: $where) {status errorMessage}
183183
}
184184
"""
185-
return self._wait_until_done(
185+
return self._wait_till_done(
186186
lambda: self.client.execute(
187187
status_query_str, {"where": {"id": task_id}}
188188
)["MEADataRowRegistrationTaskStatus"],
189189
timeout_seconds=timeout_seconds,
190190
)
191191

192-
def _wait_until_done(self, status_fn, timeout_seconds=120, sleep_time=5):
192+
def _wait_till_done(self, status_fn, timeout_seconds=120, sleep_time=5):
193193
# Do not use this function outside of the scope of upsert_data_rows or upsert_labels. It could change.
194194
original_timeout = timeout_seconds
195195
while True:
@@ -419,7 +419,7 @@ def assign_data_rows_to_split(
419419
assignDataRowsToDataSplitTaskStatus(where: {id : $id}){status errorMessage}}
420420
"""
421421

422-
return self._wait_until_done(
422+
return self._wait_till_done(
423423
lambda: self.client.execute(
424424
status_query_str, {"id": task_id}, experimental=True
425425
)["assignDataRowsToDataSplitTaskStatus"],

0 commit comments

Comments
 (0)