diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml index c10e74ca7..f1608af5f 100644 --- a/.mock/definition/__package__.yml +++ b/.mock/definition/__package__.yml @@ -4275,7 +4275,7 @@ types: docs: Task Serializer with project scheme configs validation properties: agreement: string - agreement_filtered: string + agreement_selected: string annotations: string annotations_ids: string annotations_results: string @@ -4722,7 +4722,7 @@ types: docs: Task Serializer with project scheme configs validation properties: agreement: string - agreement_filtered: string + agreement_selected: string annotations: string annotations_ids: string annotations_results: string @@ -6058,6 +6058,7 @@ types: minLength: 1 maxLength: 1000 organization: optional + project_id: integer project_settings: optional require_comment_on_skip: type: optional diff --git a/.mock/definition/dataManager.yml b/.mock/definition/dataManager.yml index a671f8d7a..29f804103 100644 --- a/.mock/definition/dataManager.yml +++ b/.mock/definition/dataManager.yml @@ -29,6 +29,8 @@ service: response: body: key: value + audiences: + - internal api_dm_project_retrieve: path: /api/dm/project/ method: GET diff --git a/.mock/definition/machineLearning.yml b/.mock/definition/machineLearning.yml deleted file mode 100644 index 9bbd70d79..000000000 --- a/.mock/definition/machineLearning.yml +++ /dev/null @@ -1,40 +0,0 @@ -service: - auth: false - base-path: '' - endpoints: - api_ml_predict_create: - path: /api/ml/{id}/predict - method: POST - auth: true - docs: |2- - - Create predictions for all tasks using a specific ML backend so that you can set up an active learning strategy - based on the confidence or uncertainty scores associated with the predictions. Creating predictions requires - a Label Studio ML backend set up and configured for your project. - - See [Set up machine learning](https://labelstud.io/guide/ml.html) for more details - about a Label Studio ML backend. - - Reference the ML backend ID in the path of this API call. Get the ML backend ID by - [listing the ML backends for a project](https://labelstud.io/api/#operation/api_ml_list). - - source: - openapi: openapi/openapi.yaml - path-parameters: - id: - type: integer - docs: A unique integer value identifying this ML backend. - display-name: Create predictions - request: - name: ApiMlPredictCreateRequest - query-parameters: - batch_size: - type: optional - docs: >- - Computed number of tasks without predictions that the ML backend - needs to predict. - examples: - - path-parameters: - id: 1 - source: - openapi: openapi/openapi.yaml diff --git a/.mock/definition/ml.yml b/.mock/definition/ml.yml index 8373d7e80..b3d16dc37 100644 --- a/.mock/definition/ml.yml +++ b/.mock/definition/ml.yml @@ -309,6 +309,48 @@ service: task: 1 audiences: - public + predict_all_tasks: + path: /api/ml/{id}/predict + method: POST + auth: true + docs: >- + Note: not available in the community edition of Label Studio. + + + Create predictions for all tasks using a specific ML backend so that you + can set up an active learning strategy based on the confidence or + uncertainty scores associated with the predictions. Creating predictions + requires a Label Studio ML backend set up and configured for your + project. + + + See [Set up machine learning](https://labelstud.io/guide/ml.html) for + more details about a Label Studio ML backend. + + + Reference the ML backend ID in the path of this API call. Get the ML + backend ID by [listing the ML backends for a + project](https://labelstud.io/api/#operation/api_ml_list). + source: + openapi: openapi/openapi.yaml + path-parameters: + id: + type: integer + docs: A unique integer value identifying this ML backend. + display-name: Create predictions for all tasks + request: + name: MlPredictAllTasksRequest + query-parameters: + batch_size: + type: optional + docs: >- + Computed number of tasks without predictions that the ML backend + needs to predict. + examples: + - path-parameters: + id: 1 + audiences: + - public test_predict: path: /api/ml/{id}/predict/test method: POST diff --git a/.mock/definition/organizations.yml b/.mock/definition/organizations.yml index 2e7da056c..59cba9e71 100644 --- a/.mock/definition/organizations.yml +++ b/.mock/definition/organizations.yml @@ -89,7 +89,7 @@ service: token: token audiences: - public - api_organizations_partial_update: + update: path: /api/organizations/{id} method: PATCH auth: true @@ -157,7 +157,9 @@ service: id: 1 title: title token: token - api_organizations_set_default_role_partial_update: + audiences: + - public + update_default_role: path: /api/organizations/{id}/set-default-role method: PATCH auth: true @@ -255,6 +257,8 @@ service: label_stream_navigation_disabled_at: '2024-01-15T09:30:00Z' organization: 1 read_only_quick_view_enabled_at: '2024-01-15T09:30:00Z' + audiences: + - public source: openapi: openapi/openapi.yaml types: diff --git a/.mock/definition/projectTemplates.yml b/.mock/definition/projectTemplates.yml index 6c9beb7cf..3f83a55b7 100644 --- a/.mock/definition/projectTemplates.yml +++ b/.mock/definition/projectTemplates.yml @@ -4,7 +4,7 @@ service: auth: false base-path: '' endpoints: - api_project_templates_list: + list: path: /api/project-templates/ method: GET auth: true @@ -13,7 +13,7 @@ service: openapi: openapi/openapi.yaml display-name: Get project templates request: - name: ApiProjectTemplatesListRequest + name: ProjectTemplatesListRequest query-parameters: ordering: type: optional @@ -42,7 +42,9 @@ service: tags: key: value updated_at: '2024-01-15T09:30:00Z' - api_project_templates_create: + audiences: + - public + create: path: /api/project-templates/ method: POST auth: true @@ -59,6 +61,7 @@ service: examples: - request: name: name + project_id: 1 response: body: assignment_settings: @@ -79,7 +82,9 @@ service: tags: key: value updated_at: '2024-01-15T09:30:00Z' - api_project_templates_retrieve: + audiences: + - public + get: path: /api/project-templates/{id} method: GET auth: true @@ -115,6 +120,8 @@ service: tags: key: value updated_at: '2024-01-15T09:30:00Z' + audiences: + - public api_project_templates_update: path: /api/project-templates/{id} method: PUT @@ -136,6 +143,7 @@ service: id: 1 request: name: name + project_id: 1 response: body: assignment_settings: @@ -156,7 +164,9 @@ service: tags: key: value updated_at: '2024-01-15T09:30:00Z' - api_project_templates_destroy: + audiences: + - internal + delete: path: /api/project-templates/{id} method: DELETE auth: true @@ -169,7 +179,9 @@ service: examples: - path-parameters: id: 1 - api_project_templates_partial_update: + audiences: + - public + update: path: /api/project-templates/{id} method: PATCH auth: true @@ -202,6 +214,7 @@ service: minLength: 1 maxLength: 1000 organization: optional + project_id: optional project_settings: optional require_comment_on_skip: type: optional @@ -237,7 +250,9 @@ service: tags: key: value updated_at: '2024-01-15T09:30:00Z' - api_project_templates_create_project_create: + audiences: + - public + create_project_from_template: path: /api/project-templates/{id}/create-project method: POST auth: true @@ -250,7 +265,7 @@ service: id: integer display-name: Create project from template request: - name: ApiProjectTemplatesCreateProjectCreateRequest + name: ProjectTemplatesCreateProjectFromTemplateRequest body: properties: description: @@ -367,5 +382,7 @@ service: useful_annotation_number: 1 workspace: workspace workspace_title: workspace_title + audiences: + - public source: openapi: openapi/openapi.yaml diff --git a/.mock/definition/tasks.yml b/.mock/definition/tasks.yml index c168b024c..c45adf0fa 100644 --- a/.mock/definition/tasks.yml +++ b/.mock/definition/tasks.yml @@ -170,7 +170,7 @@ service: body: tasks: - agreement: agreement - agreement_filtered: agreement_filtered + agreement_selected: agreement_selected annotations: annotations annotations_ids: annotations_ids annotations_results: annotations_results @@ -330,7 +330,7 @@ service: response: body: agreement: agreement - agreement_filtered: agreement_filtered + agreement_selected: agreement_selected annotations: annotations annotations_ids: annotations_ids annotations_results: annotations_results @@ -484,7 +484,7 @@ service: response: body: agreement: agreement - agreement_filtered: agreement_filtered + agreement_selected: agreement_selected annotations: annotations annotations_ids: annotations_ids annotations_results: annotations_results diff --git a/.mock/openapi/openapi.yaml b/.mock/openapi/openapi.yaml index 364a5d088..0685b6e4a 100644 --- a/.mock/openapi/openapi.yaml +++ b/.mock/openapi/openapi.yaml @@ -3116,6 +3116,8 @@ paths: summary: Get action form tags: - Data Manager + x-fern-audiences: + - internal /api/dm/project/: get: description: Retrieve the project state for the data manager. @@ -4745,7 +4747,7 @@ paths: x-fern-sdk-method-name: predict_interactive /api/ml/{id}/predict: post: - description: "\n Create predictions for all tasks using a specific ML backend so that you can set up an active learning strategy\n based on the confidence or uncertainty scores associated with the predictions. Creating predictions requires \n a Label Studio ML backend set up and configured for your project. \n\n See [Set up machine learning](https://labelstud.io/guide/ml.html) for more details \n about a Label Studio ML backend.\n\n Reference the ML backend ID in the path of this API call. Get the ML backend ID by \n [listing the ML backends for a project](https://labelstud.io/api/#operation/api_ml_list).\n " + description: "Note: not available in the community edition of Label Studio. \n\nCreate predictions for all tasks using a specific ML backend so that you can set up an active learning strategy based on the confidence or uncertainty scores associated with the predictions. Creating predictions requires a Label Studio ML backend set up and configured for your project. \n\nSee [Set up machine learning](https://labelstud.io/guide/ml.html) for more details about a Label Studio ML backend. \n\nReference the ML backend ID in the path of this API call. Get the ML backend ID by [listing the ML backends for a project](https://labelstud.io/api/#operation/api_ml_list)." operationId: api_ml_predict_create parameters: - description: Computed number of tasks without predictions that the ML backend needs to predict. @@ -4764,9 +4766,13 @@ paths: description: Predictions have successfully started. security: - Token: [] - summary: Create predictions + summary: Create predictions for all tasks tags: - Machine Learning + x-fern-audiences: + - public + x-fern-sdk-group-name: ml + x-fern-sdk-method-name: predict_all_tasks /api/ml/{id}/predict/test: post: description: "\n After you add an ML backend, call this API with the ML backend ID to run a test prediction on specific task data \n " @@ -5253,6 +5259,11 @@ paths: summary: Update organization tags: - Organizations + x-fern-audiences: + - public + x-fern-sdk-group-name: + - organizations + x-fern-sdk-method-name: update /api/organizations/{id}/memberships: get: description: Retrieve a list of all users and roles in a specific organization. @@ -5471,6 +5482,11 @@ paths: summary: Update default role tags: - Organizations + x-fern-audiences: + - public + x-fern-sdk-group-name: + - organizations + x-fern-sdk-method-name: update_default_role /api/predictions/: get: description: List all predictions and their IDs. @@ -5938,6 +5954,11 @@ paths: summary: Get project templates tags: - Project Templates + x-fern-audiences: + - public + x-fern-sdk-group-name: + - project-templates + x-fern-sdk-method-name: list post: description: Create a project template for an organization. operationId: api_project_templates_create @@ -5965,6 +5986,11 @@ paths: summary: Create project template tags: - Project Templates + x-fern-audiences: + - public + x-fern-sdk-group-name: + - project-templates + x-fern-sdk-method-name: create /api/project-templates/{id}: delete: description: Delete a specific project template by ID for an organization. @@ -5983,6 +6009,11 @@ paths: summary: Delete a project template tags: - Project Templates + x-fern-audiences: + - public + x-fern-sdk-group-name: + - project-templates + x-fern-sdk-method-name: delete get: description: Get a specific project template by ID for an organization. operationId: api_project_templates_retrieve @@ -6004,6 +6035,11 @@ paths: summary: Get a project template tags: - Project Templates + x-fern-audiences: + - public + x-fern-sdk-group-name: + - project-templates + x-fern-sdk-method-name: get patch: description: Update the details of a specific project template by ID for an organization. operationId: api_project_templates_partial_update @@ -6036,6 +6072,11 @@ paths: summary: Update a project template tags: - Project Templates + x-fern-audiences: + - public + x-fern-sdk-group-name: + - project-templates + x-fern-sdk-method-name: update put: description: Overwrite a specific project template by ID for an organization. operationId: api_project_templates_update @@ -6069,6 +6110,8 @@ paths: summary: Overwrite a project template tags: - Project Templates + x-fern-audiences: + - internal /api/project-templates/{id}/create-project: post: description: Create a project from a specific project template by ID for an organization. @@ -6109,6 +6152,11 @@ paths: summary: Create project from template tags: - Project Templates + x-fern-audiences: + - public + x-fern-sdk-group-name: + - project-templates + x-fern-sdk-method-name: create_project_from_template /api/projects/: get: description: Retrieve a list of projects. @@ -22201,7 +22249,7 @@ components: agreement: readOnly: true type: string - agreement_filtered: + agreement_selected: readOnly: true type: string annotations: @@ -22404,7 +22452,7 @@ components: type: array required: - agreement - - agreement_filtered + - agreement_selected - annotations - annotations_ids - annotations_results @@ -22734,7 +22782,7 @@ components: agreement: readOnly: true type: string - agreement_filtered: + agreement_selected: readOnly: true type: string annotations: @@ -22937,7 +22985,7 @@ components: type: array required: - agreement - - agreement_filtered + - agreement_selected - annotations - annotations_ids - annotations_results @@ -25584,6 +25632,9 @@ components: organization: nullable: true type: integer + project_id: + type: integer + writeOnly: true project_settings: description: general dict serialized project settings require_comment_on_skip: @@ -26715,6 +26766,9 @@ components: organization: nullable: true type: integer + project_id: + type: integer + writeOnly: true project_settings: description: general dict serialized project settings require_comment_on_skip: @@ -26728,6 +26782,7 @@ components: tags: {} required: - name + - project_id type: object PromptsStatusEnum: description: |- diff --git a/poetry.lock b/poetry.lock index df8860c6d..fa995836b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1266,13 +1266,13 @@ testing = ["coverage", "pytest", "pytest-benchmark"] [[package]] name = "pydantic" -version = "2.11.7" +version = "2.11.8" description = "Data validation using Python type hints" optional = false python-versions = ">=3.9" files = [ - {file = "pydantic-2.11.7-py3-none-any.whl", hash = "sha256:dde5df002701f6de26248661f6835bbe296a47bf73990135c7d07ce741b9623b"}, - {file = "pydantic-2.11.7.tar.gz", hash = "sha256:d989c3c6cb79469287b1569f7447a17848c998458d49ebe294e975b9baf0f0db"}, + {file = "pydantic-2.11.8-py3-none-any.whl", hash = "sha256:830ec4cccc3cf21be1ef5aec1d3348a179c92a61a7dab0e59837f9cc9fa93351"}, + {file = "pydantic-2.11.8.tar.gz", hash = "sha256:3d080f4a3ac6bde98e959ba552124d46be9f565b7be67769e49fcb286bae1bfb"}, ] [package.dependencies] diff --git a/reference.md b/reference.md index 0442c4bca..b12d0fd82 100644 --- a/reference.md +++ b/reference.md @@ -4758,8 +4758,7 @@ client.organizations.get( -## JwtSettings -
client.jwt_settings.get() +
client.organizations.update(...)
@@ -4771,7 +4770,7 @@ client.organizations.get(
-Retrieve JWT settings for the currently active organization. +Update organization details including title, embed domains, and custom scripts settings.
@@ -4791,7 +4790,9 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.jwt_settings.get() +client.organizations.update( + id=1, +) ``` @@ -4807,69 +4808,63 @@ client.jwt_settings.get()
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**id:** `int`
- -
+
+
+**contact_info:** `typing.Optional[str]` +
-
-
client.jwt_settings.update(...)
-#### 📝 Description - -
-
+**created_by:** `typing.Optional[int]` + +
+
-Update JWT settings for the currently active organization. -
-
+**custom_scripts_editable_by:** `typing.Optional[str]` +
-#### 🔌 Usage -
+**custom_scripts_enabled:** `typing.Optional[bool]` + +
+
+
-```python -from label_studio_sdk import LabelStudio - -client = LabelStudio( - api_key="YOUR_API_KEY", -) -client.jwt_settings.update( - api_token_ttl_days=1, -) - -``` -
-
+**email_notification_settings:** `typing.Optional[typing.Optional[typing.Any]]` + -#### ⚙️ Parameters -
+**embed_domains:** `typing.Optional[typing.Sequence[typing.Dict[str, str]]]` + +
+
+
-**api_token_ttl_days:** `int` +**embed_settings:** `typing.Optional[typing.Optional[typing.Any]]`
@@ -4877,7 +4872,7 @@ client.jwt_settings.update(
-**api_tokens_enabled:** `typing.Optional[bool]` — Enable JWT API token authentication for this organization +**title:** `typing.Optional[str]`
@@ -4885,7 +4880,7 @@ client.jwt_settings.update(
-**legacy_api_tokens_enabled:** `typing.Optional[bool]` — Enable legacy API token authentication for this organization +**token:** `typing.Optional[str]`
@@ -4905,8 +4900,7 @@ client.jwt_settings.update(
-## Ml -
client.ml.list(...) +
client.organizations.update_default_role(...)
@@ -4918,12 +4912,7 @@ client.jwt_settings.update(
- - List all configured ML backends for a specific project by ID. - Use the following cURL command: - ```bash - curl http://localhost:8000/api/ml?project={project_id} -H 'Authorization: Token abc123' - +Update the default role for members of a specific organization.
@@ -4943,7 +4932,9 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.ml.list() +client.organizations.update_default_role( + id=1, +) ``` @@ -4959,7 +4950,7 @@ client.ml.list()
-**project:** `typing.Optional[int]` — Project ID +**id:** `int`
@@ -4967,73 +4958,62 @@ client.ml.list()
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**annotator_reviewer_firewall_enabled_at:** `typing.Optional[dt.datetime]` — Set to current time to restrict data sharing between annotators and reviewers in the label stream, review stream, and notifications (which will be disabled). In these settings, information about annotator and reviewer identity is suppressed in the UI.
- -
- - - - -
- -
client.ml.create(...) -
-
- -#### 📝 Description
-
-
+**custom_scripts_editable_by:** `typing.Optional[PatchedDefaultRoleRequestCustomScriptsEditableBy]` +Set the minimum user role that can edit custom scripts in the UI. - Add an ML backend to a project using the Label Studio UI or by sending a POST request using the following cURL - command: - ```bash - curl -X POST -H 'Content-type: application/json' http://localhost:8000/api/ml -H 'Authorization: Token abc123'\ - --data '{"url": "http://localhost:9090", "project": {project_id}}' +* `AD` - Administrator +* `MA` - Manager
-
-
- -#### 🔌 Usage
+**custom_scripts_enabled_at:** `typing.Optional[dt.datetime]` — Set to current time to enabled custom scripts for this organization. Can only be enabled if no organization members are active members of any other organizations; otherwise an error will be raised. If this occurs, contact the LEAP team for assistance with enabling custom scripts. + +
+
+
-```python -from label_studio_sdk import LabelStudio +**default_role:** `typing.Optional[DefaultRoleEnum]` -client = LabelStudio( - api_key="YOUR_API_KEY", -) -client.ml.create() +Default membership role for invited users -``` -
-
+* `OW` - Owner +* `AD` - Administrator +* `MA` - Manager +* `RE` - Reviewer +* `AN` - Annotator +* `DI` - Deactivated +* `NO` - Not Activated +
-#### ⚙️ Parameters -
+**email_notification_settings:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+
-**auth_method:** `typing.Optional[MlCreateRequestAuthMethod]` — Auth method +**embed_domains:** `typing.Optional[typing.Optional[typing.Any]]`
@@ -5041,7 +5021,7 @@ client.ml.create()
-**basic_auth_pass:** `typing.Optional[str]` — Basic auth password +**embed_settings:** `typing.Optional[typing.Optional[typing.Any]]`
@@ -5049,7 +5029,7 @@ client.ml.create()
-**basic_auth_user:** `typing.Optional[str]` — Basic auth user +**external_id:** `typing.Optional[str]` — External ID to uniquely identify this organization
@@ -5057,7 +5037,7 @@ client.ml.create()
-**description:** `typing.Optional[str]` — Description +**extra_data_on_activity_logs:** `typing.Optional[bool]`
@@ -5065,7 +5045,7 @@ client.ml.create()
-**extra_params:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` — Extra parameters +**label_stream_navigation_disabled_at:** `typing.Optional[dt.datetime]` — Set to current time to disable the label stream navigation for this organization. This will prevent users from going back in the label stream to view previous labels.
@@ -5073,7 +5053,7 @@ client.ml.create()
-**is_interactive:** `typing.Optional[bool]` — Is interactive +**organization:** `typing.Optional[int]` — A unique integer value identifying this organization.
@@ -5081,7 +5061,7 @@ client.ml.create()
-**project:** `typing.Optional[int]` — Project ID +**read_only_quick_view_enabled_at:** `typing.Optional[dt.datetime]` — Set to current time to prevent creating or editing annotations in quick view.
@@ -5089,26 +5069,63 @@ client.ml.create()
-**timeout:** `typing.Optional[int]` — Response model timeout +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ + + + + +
+ +## JwtSettings +
client.jwt_settings.get()
-**title:** `typing.Optional[str]` — Title - +#### 📝 Description + +
+
+ +
+
+ +Retrieve JWT settings for the currently active organization. +
+
+#### 🔌 Usage +
-**url:** `typing.Optional[str]` — ML backend URL - +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.jwt_settings.get() + +```
+
+
+ +#### ⚙️ Parameters + +
+
@@ -5125,7 +5142,7 @@ client.ml.create()
-
client.ml.get(...) +
client.jwt_settings.update(...)
@@ -5137,12 +5154,7 @@ client.ml.create()
- - Get details about a specific ML backend connection by ID. For example, make a GET request using the - following cURL command: - ```bash - curl http://localhost:8000/api/ml/{ml_backend_ID} -H 'Authorization: Token abc123' - +Update JWT settings for the currently active organization.
@@ -5162,8 +5174,8 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.ml.get( - id=1, +client.jwt_settings.update( + api_token_ttl_days=1, ) ``` @@ -5180,7 +5192,23 @@ client.ml.get(
-**id:** `int` +**api_token_ttl_days:** `int` + +
+
+ +
+
+ +**api_tokens_enabled:** `typing.Optional[bool]` — Enable JWT API token authentication for this organization + +
+
+ +
+
+ +**legacy_api_tokens_enabled:** `typing.Optional[bool]` — Enable legacy API token authentication for this organization
@@ -5200,7 +5228,8 @@ client.ml.get(
-
client.ml.delete(...) +## Ml +
client.ml.list(...)
@@ -5213,10 +5242,10 @@ client.ml.get(
- Remove an existing ML backend connection by ID. For example, use the - following cURL command: + List all configured ML backends for a specific project by ID. + Use the following cURL command: ```bash - curl -X DELETE http://localhost:8000/api/ml/{ml_backend_ID} -H 'Authorization: Token abc123' + curl http://localhost:8000/api/ml?project={project_id} -H 'Authorization: Token abc123'
@@ -5237,9 +5266,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.ml.delete( - id=1, -) +client.ml.list() ``` @@ -5255,7 +5282,7 @@ client.ml.delete(
-**id:** `int` +**project:** `typing.Optional[int]` — Project ID
@@ -5275,7 +5302,7 @@ client.ml.delete(
-
client.ml.update(...) +
client.ml.create(...)
@@ -5288,10 +5315,11 @@ client.ml.delete(
- Update ML backend parameters using the Label Studio UI or by sending a PATCH request using the following cURL command: + Add an ML backend to a project using the Label Studio UI or by sending a POST request using the following cURL + command: ```bash - curl -X PATCH -H 'Content-type: application/json' http://localhost:8000/api/ml/{ml_backend_ID} -H 'Authorization: Token abc123'\ - --data '{"url": "http://localhost:9091"}' + curl -X POST -H 'Content-type: application/json' http://localhost:8000/api/ml -H 'Authorization: Token abc123'\ + --data '{"url": "http://localhost:9090", "project": {project_id}}'
@@ -5312,9 +5340,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.ml.update( - id=1, -) +client.ml.create() ``` @@ -5330,15 +5356,7 @@ client.ml.update(
-**id:** `int` - -
-
- -
-
- -**auth_method:** `typing.Optional[MlUpdateRequestAuthMethod]` — Auth method +**auth_method:** `typing.Optional[MlCreateRequestAuthMethod]` — Auth method
@@ -5430,7 +5448,7 @@ client.ml.update(
-
client.ml.predict_interactive(...) +
client.ml.get(...)
@@ -5443,10 +5461,11 @@ client.ml.update(
- Send a request to the machine learning backend set up to be used for interactive preannotations to retrieve a - predicted region based on annotator input. - See [set up machine learning](https://labelstud.io/guide/ml.html#Get-interactive-preannotations) for more. - + Get details about a specific ML backend connection by ID. For example, make a GET request using the + following cURL command: + ```bash + curl http://localhost:8000/api/ml/{ml_backend_ID} -H 'Authorization: Token abc123' +
@@ -5466,9 +5485,8 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.ml.predict_interactive( +client.ml.get( id=1, - task=1, ) ``` @@ -5485,23 +5503,7 @@ client.ml.predict_interactive(
-**id:** `int` — A unique integer value identifying this ML backend. - -
-
- -
-
- -**task:** `int` — ID of task to annotate - -
-
- -
-
- -**context:** `typing.Optional[typing.Optional[typing.Any]]` +**id:** `int`
@@ -5521,7 +5523,7 @@ client.ml.predict_interactive(
-
client.ml.train(...) +
client.ml.delete(...)
@@ -5534,11 +5536,11 @@ client.ml.predict_interactive(
- After you add an ML backend, call this API with the ML backend ID to start training with - already-labeled tasks. - - Get the ML backend ID by [listing the ML backends for a project](https://labelstud.io/api/#operation/api_ml_list). - + Remove an existing ML backend connection by ID. For example, use the + following cURL command: + ```bash + curl -X DELETE http://localhost:8000/api/ml/{ml_backend_ID} -H 'Authorization: Token abc123' +
@@ -5558,7 +5560,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.ml.train( +client.ml.delete( id=1, ) @@ -5576,15 +5578,7 @@ client.ml.train(
-**id:** `int` — A unique integer value identifying this ML backend. - -
-
- -
-
- -**use_ground_truth:** `typing.Optional[bool]` — Whether to include ground truth annotations in training +**id:** `int`
@@ -5604,7 +5598,7 @@ client.ml.train(
-
client.ml.list_model_versions(...) +
client.ml.update(...)
@@ -5616,7 +5610,12 @@ client.ml.train(
-Get available versions of the model. + + Update ML backend parameters using the Label Studio UI or by sending a PATCH request using the following cURL command: + ```bash + curl -X PATCH -H 'Content-type: application/json' http://localhost:8000/api/ml/{ml_backend_ID} -H 'Authorization: Token abc123'\ + --data '{"url": "http://localhost:9091"}' +
@@ -5636,7 +5635,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.ml.list_model_versions( +client.ml.update( id=1, ) @@ -5662,68 +5661,79 @@ client.ml.list_model_versions(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**auth_method:** `typing.Optional[MlUpdateRequestAuthMethod]` — Auth method
- -
+
+
+**basic_auth_pass:** `typing.Optional[str]` — Basic auth password +
-
-## ModelProviders -
client.model_providers.list(...)
-#### 📝 Description +**basic_auth_user:** `typing.Optional[str]` — Basic auth user + +
+
+**description:** `typing.Optional[str]` — Description + +
+
+
-List all model provider connections. -
-
+**extra_params:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` — Extra parameters + -#### 🔌 Usage -
+**is_interactive:** `typing.Optional[bool]` — Is interactive + +
+
+
-```python -from label_studio_sdk import LabelStudio - -client = LabelStudio( - api_key="YOUR_API_KEY", -) -client.model_providers.list() - -``` +**project:** `typing.Optional[int]` — Project ID +
+ +
+
+ +**timeout:** `typing.Optional[int]` — Response model timeout +
-#### ⚙️ Parameters -
+**title:** `typing.Optional[str]` — Title + +
+
+
-**ordering:** `typing.Optional[str]` — Which field to use when ordering the results. +**url:** `typing.Optional[str]` — ML backend URL
@@ -5743,7 +5753,7 @@ client.model_providers.list()
-
client.model_providers.create(...) +
client.ml.predict_interactive(...)
@@ -5755,7 +5765,11 @@ client.model_providers.list()
-Create a new model provider connection. + + Send a request to the machine learning backend set up to be used for interactive preannotations to retrieve a + predicted region based on annotator input. + See [set up machine learning](https://labelstud.io/guide/ml.html#Get-interactive-preannotations) for more. +
@@ -5775,7 +5789,10 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.model_providers.create() +client.ml.predict_interactive( + id=1, + task=1, +) ``` @@ -5791,7 +5808,7 @@ client.model_providers.create()
-**api_key:** `typing.Optional[str]` — Model provider API key +**id:** `int` — A unique integer value identifying this ML backend.
@@ -5799,7 +5816,7 @@ client.model_providers.create()
-**auth_token:** `typing.Optional[str]` — Model provider Auth token +**task:** `int` — ID of task to annotate
@@ -5807,7 +5824,7 @@ client.model_providers.create()
-**budget_alert_threshold:** `typing.Optional[float]` — Budget alert threshold for the given provider connection +**context:** `typing.Optional[typing.Optional[typing.Any]]`
@@ -5815,63 +5832,75 @@ client.model_providers.create()
-**cached_available_models:** `typing.Optional[str]` — List of available models from the provider +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ +
-
-
-**deployment_name:** `typing.Optional[str]` — Azure OpenAI deployment name -
+
+
client.ml.predict_all_tasks(...)
-**endpoint:** `typing.Optional[str]` — Azure OpenAI endpoint - -
-
+#### 📝 Description
-**google_application_credentials:** `typing.Optional[str]` — The content of GOOGLE_APPLICATION_CREDENTIALS json file - -
-
-
-**google_location:** `typing.Optional[str]` — Google project location - +Note: not available in the community edition of Label Studio. + +Create predictions for all tasks using a specific ML backend so that you can set up an active learning strategy based on the confidence or uncertainty scores associated with the predictions. Creating predictions requires a Label Studio ML backend set up and configured for your project. + +See [Set up machine learning](https://labelstud.io/guide/ml.html) for more details about a Label Studio ML backend. + +Reference the ML backend ID in the path of this API call. Get the ML backend ID by [listing the ML backends for a project](https://labelstud.io/api/#operation/api_ml_list). +
+
+#### 🔌 Usage +
-**google_project_id:** `typing.Optional[str]` — Google project ID - -
-
-
-**is_internal:** `typing.Optional[bool]` — Whether the model provider connection is internal, not visible to the user - +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.ml.predict_all_tasks( + id=1, +) + +``` +
+
+#### ⚙️ Parameters +
-**provider:** `typing.Optional[ProviderEnum]` +
+
+ +**id:** `int` — A unique integer value identifying this ML backend.
@@ -5879,7 +5908,7 @@ client.model_providers.create()
-**scope:** `typing.Optional[ScopeEnum]` +**batch_size:** `typing.Optional[int]` — Computed number of tasks without predictions that the ML backend needs to predict.
@@ -5899,7 +5928,7 @@ client.model_providers.create()
-
client.model_providers.list_model_provider_choices() +
client.ml.train(...)
@@ -5911,7 +5940,12 @@ client.model_providers.create()
-List all possible model provider choices + + After you add an ML backend, call this API with the ML backend ID to start training with + already-labeled tasks. + + Get the ML backend ID by [listing the ML backends for a project](https://labelstud.io/api/#operation/api_ml_list). +
@@ -5931,7 +5965,9 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.model_providers.list_model_provider_choices() +client.ml.train( + id=1, +) ``` @@ -5947,6 +5983,22 @@ client.model_providers.list_model_provider_choices()
+**id:** `int` — A unique integer value identifying this ML backend. + +
+
+ +
+
+ +**use_ground_truth:** `typing.Optional[bool]` — Whether to include ground truth annotations in training + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -5959,7 +6011,7 @@ client.model_providers.list_model_provider_choices()
-
client.model_providers.get(...) +
client.ml.list_model_versions(...)
@@ -5971,7 +6023,7 @@ client.model_providers.list_model_provider_choices()
-Retrieve a specific model provider connection. +Get available versions of the model.
@@ -5991,8 +6043,8 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.model_providers.get( - id="id", +client.ml.list_model_versions( + id=1, ) ``` @@ -6009,7 +6061,7 @@ client.model_providers.get(
-**id:** `str` +**id:** `int`
@@ -6029,7 +6081,8 @@ client.model_providers.get(
-
client.model_providers.delete(...) +## ModelProviders +
client.model_providers.list(...)
@@ -6041,7 +6094,7 @@ client.model_providers.get(
-Delete a model provider connection by ID +List all model provider connections.
@@ -6061,9 +6114,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.model_providers.delete( - id="id", -) +client.model_providers.list() ``` @@ -6079,7 +6130,7 @@ client.model_providers.delete(
-**id:** `str` +**ordering:** `typing.Optional[str]` — Which field to use when ordering the results.
@@ -6099,7 +6150,7 @@ client.model_providers.delete(
-
client.model_providers.update(...) +
client.model_providers.create(...)
@@ -6111,7 +6162,7 @@ client.model_providers.delete(
-Update a specific model provider connection by ID. +Create a new model provider connection.
@@ -6131,9 +6182,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.model_providers.update( - id="id", -) +client.model_providers.create() ``` @@ -6149,14 +6198,6 @@ client.model_providers.update(
-**id:** `str` - -
-
- -
-
- **api_key:** `typing.Optional[str]` — Model provider API key
@@ -6265,8 +6306,7 @@ client.model_providers.update(
-## Prompts -
client.prompts.batch_failed_predictions(...) +
client.model_providers.list_model_provider_choices()
@@ -6278,7 +6318,7 @@ client.model_providers.update(
-Create a new batch of failed predictions. +List all possible model provider choices
@@ -6298,10 +6338,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.prompts.batch_failed_predictions( - failed_predictions=[], - modelrun_id=1, -) +client.model_providers.list_model_provider_choices() ``` @@ -6317,38 +6354,6 @@ client.prompts.batch_failed_predictions(
-**failed_predictions:** `typing.Sequence[typing.Optional[typing.Any]]` - -
-
- -
-
- -**modelrun_id:** `int` - -
-
- -
-
- -**num_failed_predictions:** `typing.Optional[int]` — Number of failed predictions being sent (for telemetry only, has no effect) - -
-
- -
-
- -**job_id:** `typing.Optional[str]` - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -6361,7 +6366,7 @@ client.prompts.batch_failed_predictions(
-
client.prompts.batch_predictions(...) +
client.model_providers.get(...)
@@ -6373,7 +6378,7 @@ client.prompts.batch_failed_predictions(
-Create a new batch prediction. +Retrieve a specific model provider connection.
@@ -6393,9 +6398,8 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.prompts.batch_predictions( - modelrun_id=1, - results=[], +client.model_providers.get( + id="id", ) ``` @@ -6412,31 +6416,7 @@ client.prompts.batch_predictions(
-**modelrun_id:** `int` - -
-
- -
-
- -**results:** `typing.Sequence[typing.Optional[typing.Any]]` - -
-
- -
-
- -**num_predictions:** `typing.Optional[int]` — Number of predictions being sent (for telemetry only, has no effect) - -
-
- -
-
- -**job_id:** `typing.Optional[str]` +**id:** `str`
@@ -6456,7 +6436,7 @@ client.prompts.batch_predictions(
-
client.prompts.list(...) +
client.model_providers.delete(...)
@@ -6468,7 +6448,7 @@ client.prompts.batch_predictions(
-List all prompts. +Delete a model provider connection by ID
@@ -6488,7 +6468,9 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.prompts.list() +client.model_providers.delete( + id="id", +) ``` @@ -6504,7 +6486,7 @@ client.prompts.list()
-**ordering:** `typing.Optional[str]` — Which field to use when ordering the results. +**id:** `str`
@@ -6524,7 +6506,7 @@ client.prompts.list()
-
client.prompts.create(...) +
client.model_providers.update(...)
@@ -6536,7 +6518,7 @@ client.prompts.list()
-Create a new prompt. +Update a specific model provider connection by ID.
@@ -6556,8 +6538,8 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.prompts.create( - title="title", +client.model_providers.update( + id="id", ) ``` @@ -6574,7 +6556,7 @@ client.prompts.create(
-**title:** `str` — Model name +**id:** `str`
@@ -6582,7 +6564,7 @@ client.prompts.create(
-**associated_projects:** `typing.Optional[typing.Sequence[int]]` +**api_key:** `typing.Optional[str]` — Model provider API key
@@ -6590,7 +6572,7 @@ client.prompts.create(
-**created_by:** `typing.Optional[UserSimpleRequest]` — User who created Dataset +**auth_token:** `typing.Optional[str]` — Model provider Auth token
@@ -6598,7 +6580,7 @@ client.prompts.create(
-**description:** `typing.Optional[str]` — Model description +**budget_alert_threshold:** `typing.Optional[float]` — Budget alert threshold for the given provider connection
@@ -6606,7 +6588,7 @@ client.prompts.create(
-**input_fields:** `typing.Optional[typing.Optional[typing.Any]]` +**cached_available_models:** `typing.Optional[str]` — List of available models from the provider
@@ -6614,7 +6596,7 @@ client.prompts.create(
-**organization:** `typing.Optional[int]` +**deployment_name:** `typing.Optional[str]` — Azure OpenAI deployment name
@@ -6622,7 +6604,7 @@ client.prompts.create(
-**output_classes:** `typing.Optional[typing.Optional[typing.Any]]` +**endpoint:** `typing.Optional[str]` — Azure OpenAI endpoint
@@ -6630,7 +6612,47 @@ client.prompts.create(
-**skill_name:** `typing.Optional[SkillNameEnum]` +**google_application_credentials:** `typing.Optional[str]` — The content of GOOGLE_APPLICATION_CREDENTIALS json file + +
+
+ +
+
+ +**google_location:** `typing.Optional[str]` — Google project location + +
+
+ +
+
+ +**google_project_id:** `typing.Optional[str]` — Google project ID + +
+
+ +
+
+ +**is_internal:** `typing.Optional[bool]` — Whether the model provider connection is internal, not visible to the user + +
+
+ +
+
+ +**provider:** `typing.Optional[ProviderEnum]` + +
+
+ +
+
+ +**scope:** `typing.Optional[ScopeEnum]`
@@ -6650,7 +6672,8 @@ client.prompts.create(
-
client.prompts.compatible_projects(...) +## Prompts +
client.prompts.batch_failed_predictions(...)
@@ -6662,7 +6685,7 @@ client.prompts.create(
-Retrieve a list of compatible project for prompt. +Create a new batch of failed predictions.
@@ -6682,7 +6705,10 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.prompts.compatible_projects() +client.prompts.batch_failed_predictions( + failed_predictions=[], + modelrun_id=1, +) ``` @@ -6698,7 +6724,7 @@ client.prompts.compatible_projects()
-**ordering:** `typing.Optional[str]` — Which field to use when ordering the results. +**failed_predictions:** `typing.Sequence[typing.Optional[typing.Any]]`
@@ -6706,7 +6732,7 @@ client.prompts.compatible_projects()
-**page:** `typing.Optional[int]` — A page number within the paginated result set. +**modelrun_id:** `int`
@@ -6714,7 +6740,7 @@ client.prompts.compatible_projects()
-**page_size:** `typing.Optional[int]` — Number of results to return per page. +**num_failed_predictions:** `typing.Optional[int]` — Number of failed predictions being sent (for telemetry only, has no effect)
@@ -6722,7 +6748,7 @@ client.prompts.compatible_projects()
-**project_type:** `typing.Optional[PromptsCompatibleProjectsRequestProjectType]` — Skill to filter by +**job_id:** `typing.Optional[str]`
@@ -6742,7 +6768,7 @@ client.prompts.compatible_projects()
-
client.prompts.get(...) +
client.prompts.batch_predictions(...)
@@ -6754,7 +6780,7 @@ client.prompts.compatible_projects()
-Retrieve a specific prompt. +Create a new batch prediction.
@@ -6774,8 +6800,9 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.prompts.get( - id="id", +client.prompts.batch_predictions( + modelrun_id=1, + results=[], ) ``` @@ -6792,7 +6819,31 @@ client.prompts.get(
-**id:** `str` +**modelrun_id:** `int` + +
+
+ +
+
+ +**results:** `typing.Sequence[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**num_predictions:** `typing.Optional[int]` — Number of predictions being sent (for telemetry only, has no effect) + +
+
+ +
+
+ +**job_id:** `typing.Optional[str]`
@@ -6812,7 +6863,7 @@ client.prompts.get(
-
client.prompts.delete(...) +
client.prompts.list(...)
@@ -6824,7 +6875,7 @@ client.prompts.get(
-Delete a prompt by ID +List all prompts.
@@ -6844,9 +6895,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.prompts.delete( - id="id", -) +client.prompts.list() ``` @@ -6862,7 +6911,7 @@ client.prompts.delete(
-**id:** `str` +**ordering:** `typing.Optional[str]` — Which field to use when ordering the results.
@@ -6882,7 +6931,7 @@ client.prompts.delete(
-
client.prompts.update(...) +
client.prompts.create(...)
@@ -6894,7 +6943,7 @@ client.prompts.delete(
-Update a specific prompt by ID. +Create a new prompt.
@@ -6914,8 +6963,8 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.prompts.update( - id="id", +client.prompts.create( + title="title", ) ``` @@ -6932,7 +6981,7 @@ client.prompts.update(
-**id:** `str` +**title:** `str` — Model name
@@ -6996,14 +7045,6 @@ client.prompts.update(
-**title:** `typing.Optional[str]` — Model name - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -7016,8 +7057,7 @@ client.prompts.update(
-## Predictions -
client.predictions.list(...) +
client.prompts.compatible_projects(...)
@@ -7029,7 +7069,7 @@ client.prompts.update(
-List all predictions and their IDs. +Retrieve a list of compatible project for prompt.
@@ -7049,7 +7089,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.predictions.list() +client.prompts.compatible_projects() ``` @@ -7065,7 +7105,7 @@ client.predictions.list()
-**project:** `typing.Optional[int]` — Filter predictions by project ID +**ordering:** `typing.Optional[str]` — Which field to use when ordering the results.
@@ -7073,7 +7113,23 @@ client.predictions.list()
-**task:** `typing.Optional[int]` — Filter predictions by task ID +**page:** `typing.Optional[int]` — A page number within the paginated result set. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Number of results to return per page. + +
+
+ +
+
+ +**project_type:** `typing.Optional[PromptsCompatibleProjectsRequestProjectType]` — Skill to filter by
@@ -7093,7 +7149,7 @@ client.predictions.list()
-
client.predictions.create(...) +
client.prompts.get(...)
@@ -7105,7 +7161,7 @@ client.predictions.list()
-Create a prediction for a specific task. +Retrieve a specific prompt.
@@ -7125,27 +7181,8 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.predictions.create( - model_version="yolo-v8", - result=[ - { - "from_name": "bboxes", - "image_rotation": 0, - "original_height": 1080, - "original_width": 1920, - "to_name": "image", - "type": "rectanglelabels", - "value": { - "height": 60, - "rotation": 0, - "values": {"rectanglelabels": ["Person"]}, - "width": 50, - "x": 20, - "y": 30, - }, - } - ], - score=0.95, +client.prompts.get( + id="id", ) ``` @@ -7162,7 +7199,7 @@ client.predictions.create(
-**model_version:** `typing.Optional[str]` — Model version - tag for predictions that can be used to filter tasks in Data Manager, as well as select specific model version for showing preannotations in the labeling interface +**id:** `str`
@@ -7170,23 +7207,69 @@ client.predictions.create(
-**result:** `typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]` — Prediction result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/predictions) +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ +
+ + + + +
+
client.prompts.delete(...)
-**score:** `typing.Optional[float]` — Prediction score. Can be used in Data Manager to sort task by model confidence. Task with the lowest score will be shown first. - +#### 📝 Description + +
+
+ +
+
+ +Delete a prompt by ID +
+
+#### 🔌 Usage +
-**task:** `typing.Optional[int]` — Task ID for which the prediction is created +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.prompts.delete( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str`
@@ -7206,7 +7289,7 @@ client.predictions.create(
-
client.predictions.get(...) +
client.prompts.update(...)
@@ -7218,7 +7301,7 @@ client.predictions.create(
-Get details about a specific prediction by its ID. +Update a specific prompt by ID.
@@ -7238,8 +7321,8 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.predictions.get( - id=1, +client.prompts.update( + id="id", ) ``` @@ -7256,7 +7339,71 @@ client.predictions.get(
-**id:** `int` — Prediction ID +**id:** `str` + +
+
+ +
+
+ +**associated_projects:** `typing.Optional[typing.Sequence[int]]` + +
+
+ +
+
+ +**created_by:** `typing.Optional[UserSimpleRequest]` — User who created Dataset + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — Model description + +
+
+ +
+
+ +**input_fields:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**organization:** `typing.Optional[int]` + +
+
+ +
+
+ +**output_classes:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**skill_name:** `typing.Optional[SkillNameEnum]` + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — Model name
@@ -7276,7 +7423,8 @@ client.predictions.get(
-
client.predictions.delete(...) +## Predictions +
client.predictions.list(...)
@@ -7288,7 +7436,7 @@ client.predictions.get(
-Delete a prediction by prediction ID. +List all predictions and their IDs.
@@ -7308,9 +7456,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.predictions.delete( - id=1, -) +client.predictions.list() ``` @@ -7326,7 +7472,15 @@ client.predictions.delete(
-**id:** `int` — Prediction ID +**project:** `typing.Optional[int]` — Filter predictions by project ID + +
+
+ +
+
+ +**task:** `typing.Optional[int]` — Filter predictions by task ID
@@ -7346,7 +7500,7 @@ client.predictions.delete(
-
client.predictions.update(...) +
client.predictions.create(...)
@@ -7358,7 +7512,7 @@ client.predictions.delete(
-Update prediction data by prediction ID. +Create a prediction for a specific task.
@@ -7378,8 +7532,7 @@ from label_studio_sdk import LabelStudio client = LabelStudio( api_key="YOUR_API_KEY", ) -client.predictions.update( - id=1, +client.predictions.create( model_version="yolo-v8", result=[ { @@ -7416,7 +7569,7 @@ client.predictions.update(
-**id:** `int` — Prediction ID +**model_version:** `typing.Optional[str]` — Model version - tag for predictions that can be used to filter tasks in Data Manager, as well as select specific model version for showing preannotations in the labeling interface
@@ -7424,7 +7577,7 @@ client.predictions.update(
-**model_version:** `typing.Optional[str]` — Model version - tag for predictions that can be used to filter tasks in Data Manager, as well as select specific model version for showing preannotations in the labeling interface +**result:** `typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]` — Prediction result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/predictions)
@@ -7432,7 +7585,7 @@ client.predictions.update(
-**result:** `typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]` — Prediction result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/predictions) +**score:** `typing.Optional[float]` — Prediction score. Can be used in Data Manager to sort task by model confidence. Task with the lowest score will be shown first.
@@ -7440,7 +7593,7 @@ client.predictions.update(
-**score:** `typing.Optional[float]` — Prediction score. Can be used in Data Manager to sort task by model confidence. Task with the lowest score will be shown first. +**task:** `typing.Optional[int]` — Task ID for which the prediction is created
@@ -7448,7 +7601,891 @@ client.predictions.update(
-**task:** `typing.Optional[int]` — Task ID for which the prediction is created +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+ +
+ + + + +
+ +
client.predictions.get(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get details about a specific prediction by its ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.predictions.get( + id=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `int` — Prediction ID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.predictions.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a prediction by prediction ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.predictions.delete( + id=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `int` — Prediction ID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.predictions.update(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update prediction data by prediction ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.predictions.update( + id=1, + model_version="yolo-v8", + result=[ + { + "from_name": "bboxes", + "image_rotation": 0, + "original_height": 1080, + "original_width": 1920, + "to_name": "image", + "type": "rectanglelabels", + "value": { + "height": 60, + "rotation": 0, + "values": {"rectanglelabels": ["Person"]}, + "width": 50, + "x": 20, + "y": 30, + }, + } + ], + score=0.95, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `int` — Prediction ID + +
+
+ +
+
+ +**model_version:** `typing.Optional[str]` — Model version - tag for predictions that can be used to filter tasks in Data Manager, as well as select specific model version for showing preannotations in the labeling interface + +
+
+ +
+
+ +**result:** `typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]` — Prediction result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/predictions) + +
+
+ +
+
+ +**score:** `typing.Optional[float]` — Prediction score. Can be used in Data Manager to sort task by model confidence. Task with the lowest score will be shown first. + +
+
+ +
+
+ +**task:** `typing.Optional[int]` — Task ID for which the prediction is created + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ProjectTemplates +
client.project_templates.list(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of all project templates for an organization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.project_templates.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**ordering:** `typing.Optional[str]` — Which field to use when ordering the results. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.project_templates.create(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a project template for an organization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.project_templates.create( + name="name", + project_id=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` + +
+
+ +
+
+ +**project_id:** `int` + +
+
+ +
+
+ +**assignment_settings:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**created_by:** `typing.Optional[int]` + +
+
+ +
+
+ +**custom_script:** `typing.Optional[str]` — custom script for projects created from this template + +
+
+ +
+
+ +**description:** `typing.Optional[str]` + +
+
+ +
+
+ +**organization:** `typing.Optional[int]` + +
+
+ +
+
+ +**project_settings:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**require_comment_on_skip:** `typing.Optional[bool]` — flag to require comment on skip + +
+
+ +
+
+ +**review_settings:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**show_unused_data_columns_to_annotators:** `typing.Optional[bool]` + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.project_templates.get(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a specific project template by ID for an organization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.project_templates.get( + id=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `int` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.project_templates.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a specific project template by ID for an organization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.project_templates.delete( + id=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `int` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.project_templates.update(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the details of a specific project template by ID for an organization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.project_templates.update( + id=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `int` + +
+
+ +
+
+ +**assignment_settings:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**created_by:** `typing.Optional[int]` + +
+
+ +
+
+ +**custom_script:** `typing.Optional[str]` — custom script for projects created from this template + +
+
+ +
+
+ +**description:** `typing.Optional[str]` + +
+
+ +
+
+ +**name:** `typing.Optional[str]` + +
+
+ +
+
+ +**organization:** `typing.Optional[int]` + +
+
+ +
+
+ +**project_id:** `typing.Optional[int]` + +
+
+ +
+
+ +**project_settings:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**require_comment_on_skip:** `typing.Optional[bool]` — flag to require comment on skip + +
+
+ +
+
+ +**review_settings:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**show_unused_data_columns_to_annotators:** `typing.Optional[bool]` + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.Optional[typing.Any]]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.project_templates.create_project_from_template(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a project from a specific project template by ID for an organization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from label_studio_sdk import LabelStudio + +client = LabelStudio( + api_key="YOUR_API_KEY", +) +client.project_templates.create_project_from_template( + id=1, + title="title", + workspace_id=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `int` + +
+
+ +
+
+ +**title:** `str` — The title of the project to be created from the template. + +
+
+ +
+
+ +**workspace_id:** `int` — A unique integer value identifying the workspace in which to create the project. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — A description for the project.
diff --git a/src/label_studio_sdk/__init__.py b/src/label_studio_sdk/__init__.py index 2e8e4fc0f..d6ac4c687 100644 --- a/src/label_studio_sdk/__init__.py +++ b/src/label_studio_sdk/__init__.py @@ -46,6 +46,8 @@ ConvertedFormatRequest, CountLimit, CustomScriptsEditableByEnum, + DefaultRole, + DefaultRoleCustomScriptsEditableBy, DefaultRoleEnum, EditionEnum, Export, @@ -78,9 +80,12 @@ LseOrganization, LseOrganizationCustomScriptsEditableBy, LseOrganizationMemberList, + LseProject, LseProjectCreate, LseProjectCreateSampling, LseProjectCreateSkipQueue, + LseProjectSampling, + LseProjectSkipQueue, LseProjectUpdate, LseProjectUpdateSampling, LseProjectUpdateSkipQueue, @@ -154,6 +159,8 @@ ProjectSampling, ProjectSkipQueue, ProjectSubsetEnum, + ProjectTemplate, + ProjectTemplateRequest, PromptsStatusEnum, ProviderEnum, ReasonEnum, @@ -238,6 +245,7 @@ model_providers, organizations, predictions, + project_templates, projects, prompts, session_policy, @@ -275,6 +283,7 @@ from .import_storage import ImportStorageListTypesResponseItem from .ml import MlCreateRequestAuthMethod, MlListModelVersionsResponse, MlUpdateRequestAuthMethod from .model_providers import ModelProvidersListModelProviderChoicesResponse +from .organizations import PatchedDefaultRoleRequestCustomScriptsEditableBy from .projects import ( LseProjectCreateRequestSampling, LseProjectCreateRequestSkipQueue, @@ -391,6 +400,8 @@ "ConvertedFormatRequest", "CountLimit", "CustomScriptsEditableByEnum", + "DefaultRole", + "DefaultRoleCustomScriptsEditableBy", "DefaultRoleEnum", "EditionEnum", "Export", @@ -429,11 +440,14 @@ "LseOrganization", "LseOrganizationCustomScriptsEditableBy", "LseOrganizationMemberList", + "LseProject", "LseProjectCreate", "LseProjectCreateRequestSampling", "LseProjectCreateRequestSkipQueue", "LseProjectCreateSampling", "LseProjectCreateSkipQueue", + "LseProjectSampling", + "LseProjectSkipQueue", "LseProjectUpdate", "LseProjectUpdateSampling", "LseProjectUpdateSkipQueue", @@ -498,6 +512,7 @@ "PaginatedPaginatedProjectMemberList", "PaginatedProjectMember", "PaginatedRoleBasedTaskList", + "PatchedDefaultRoleRequestCustomScriptsEditableBy", "PatchedLseProjectUpdateRequestSampling", "PatchedLseProjectUpdateRequestSkipQueue", "Pause", @@ -515,6 +530,8 @@ "ProjectSampling", "ProjectSkipQueue", "ProjectSubsetEnum", + "ProjectTemplate", + "ProjectTemplateRequest", "ProjectsDuplicateResponse", "ProjectsImportTasksResponse", "ProjectsListRequestFilter", @@ -630,6 +647,7 @@ "model_providers", "organizations", "predictions", + "project_templates", "projects", "prompts", "session_policy", diff --git a/src/label_studio_sdk/base_client.py b/src/label_studio_sdk/base_client.py index 5e15b2828..97c219e18 100644 --- a/src/label_studio_sdk/base_client.py +++ b/src/label_studio_sdk/base_client.py @@ -23,6 +23,7 @@ from .model_providers.client import ModelProvidersClient from .prompts.client import PromptsClient from .predictions.client import PredictionsClient +from .project_templates.client import ProjectTemplatesClient from .projects.client import ProjectsClient from .tasks.client import TasksClient from .session_policy.client import SessionPolicyClient @@ -51,6 +52,7 @@ from .model_providers.client import AsyncModelProvidersClient from .prompts.client import AsyncPromptsClient from .predictions.client import AsyncPredictionsClient +from .project_templates.client import AsyncProjectTemplatesClient from .projects.client import AsyncProjectsClient from .tasks.client import AsyncTasksClient from .session_policy.client import AsyncSessionPolicyClient @@ -142,6 +144,7 @@ def __init__( self.model_providers = ModelProvidersClient(client_wrapper=self._client_wrapper) self.prompts = PromptsClient(client_wrapper=self._client_wrapper) self.predictions = PredictionsClient(client_wrapper=self._client_wrapper) + self.project_templates = ProjectTemplatesClient(client_wrapper=self._client_wrapper) self.projects = ProjectsClient(client_wrapper=self._client_wrapper) self.tasks = TasksClient(client_wrapper=self._client_wrapper) self.session_policy = SessionPolicyClient(client_wrapper=self._client_wrapper) @@ -233,6 +236,7 @@ def __init__( self.model_providers = AsyncModelProvidersClient(client_wrapper=self._client_wrapper) self.prompts = AsyncPromptsClient(client_wrapper=self._client_wrapper) self.predictions = AsyncPredictionsClient(client_wrapper=self._client_wrapper) + self.project_templates = AsyncProjectTemplatesClient(client_wrapper=self._client_wrapper) self.projects = AsyncProjectsClient(client_wrapper=self._client_wrapper) self.tasks = AsyncTasksClient(client_wrapper=self._client_wrapper) self.session_policy = AsyncSessionPolicyClient(client_wrapper=self._client_wrapper) diff --git a/src/label_studio_sdk/ml/client.py b/src/label_studio_sdk/ml/client.py index 7558f23f0..bb079d7fb 100644 --- a/src/label_studio_sdk/ml/client.py +++ b/src/label_studio_sdk/ml/client.py @@ -457,6 +457,64 @@ def predict_interactive( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def predict_all_tasks( + self, + id: int, + *, + batch_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Note: not available in the community edition of Label Studio. + + Create predictions for all tasks using a specific ML backend so that you can set up an active learning strategy based on the confidence or uncertainty scores associated with the predictions. Creating predictions requires a Label Studio ML backend set up and configured for your project. + + See [Set up machine learning](https://labelstud.io/guide/ml.html) for more details about a Label Studio ML backend. + + Reference the ML backend ID in the path of this API call. Get the ML backend ID by [listing the ML backends for a project](https://labelstud.io/api/#operation/api_ml_list). + + Parameters + ---------- + id : int + A unique integer value identifying this ML backend. + + batch_size : typing.Optional[int] + Computed number of tasks without predictions that the ML backend needs to predict. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from label_studio_sdk import LabelStudio + + client = LabelStudio( + api_key="YOUR_API_KEY", + ) + client.ml.predict_all_tasks( + id=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/ml/{jsonable_encoder(id)}/predict", + method="POST", + params={ + "batch_size": batch_size, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def train( self, id: int, @@ -1064,6 +1122,72 @@ async def main() -> None: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + async def predict_all_tasks( + self, + id: int, + *, + batch_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Note: not available in the community edition of Label Studio. + + Create predictions for all tasks using a specific ML backend so that you can set up an active learning strategy based on the confidence or uncertainty scores associated with the predictions. Creating predictions requires a Label Studio ML backend set up and configured for your project. + + See [Set up machine learning](https://labelstud.io/guide/ml.html) for more details about a Label Studio ML backend. + + Reference the ML backend ID in the path of this API call. Get the ML backend ID by [listing the ML backends for a project](https://labelstud.io/api/#operation/api_ml_list). + + Parameters + ---------- + id : int + A unique integer value identifying this ML backend. + + batch_size : typing.Optional[int] + Computed number of tasks without predictions that the ML backend needs to predict. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from label_studio_sdk import AsyncLabelStudio + + client = AsyncLabelStudio( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.ml.predict_all_tasks( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/ml/{jsonable_encoder(id)}/predict", + method="POST", + params={ + "batch_size": batch_size, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + async def train( self, id: int, diff --git a/src/label_studio_sdk/organizations/__init__.py b/src/label_studio_sdk/organizations/__init__.py index cd30f0883..faea629fa 100644 --- a/src/label_studio_sdk/organizations/__init__.py +++ b/src/label_studio_sdk/organizations/__init__.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +from .types import PatchedDefaultRoleRequestCustomScriptsEditableBy from . import invites, members -__all__ = ["invites", "members"] +__all__ = ["PatchedDefaultRoleRequestCustomScriptsEditableBy", "invites", "members"] diff --git a/src/label_studio_sdk/organizations/client.py b/src/label_studio_sdk/organizations/client.py index 38b3dc029..eaebaacbc 100644 --- a/src/label_studio_sdk/organizations/client.py +++ b/src/label_studio_sdk/organizations/client.py @@ -1,9 +1,9 @@ # This file was auto-generated by Fern from our API Definition. +import typing from ..core.client_wrapper import SyncClientWrapper from .invites.client import InvitesClient from .members.client import MembersClient -import typing from ..core.request_options import RequestOptions from ..types.organization_invite import OrganizationInvite from ..core.unchecked_base_model import construct_type @@ -12,10 +12,23 @@ from ..types.organization_id import OrganizationId from ..types.lse_organization import LseOrganization from ..core.jsonable_encoder import jsonable_encoder +from ..errors.bad_request_error import BadRequestError +from ..errors.forbidden_error import ForbiddenError +from ..errors.not_found_error import NotFoundError +import datetime as dt +from .types.patched_default_role_request_custom_scripts_editable_by import ( + PatchedDefaultRoleRequestCustomScriptsEditableBy, +) +from ..types.default_role_enum import DefaultRoleEnum +from ..types.default_role import DefaultRole +from ..core.serialization import convert_and_respect_annotation_metadata from ..core.client_wrapper import AsyncClientWrapper from .invites.client import AsyncInvitesClient from .members.client import AsyncMembersClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + class OrganizationsClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -163,6 +176,257 @@ def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = Non raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def update( + self, + id: int, + *, + contact_info: typing.Optional[str] = OMIT, + created_by: typing.Optional[int] = OMIT, + custom_scripts_editable_by: typing.Optional[str] = OMIT, + custom_scripts_enabled: typing.Optional[bool] = OMIT, + email_notification_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + embed_domains: typing.Optional[typing.Sequence[typing.Dict[str, str]]] = OMIT, + embed_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + title: typing.Optional[str] = OMIT, + token: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LseOrganization: + """ + Update organization details including title, embed domains, and custom scripts settings. + + Parameters + ---------- + id : int + + contact_info : typing.Optional[str] + + created_by : typing.Optional[int] + + custom_scripts_editable_by : typing.Optional[str] + + custom_scripts_enabled : typing.Optional[bool] + + email_notification_settings : typing.Optional[typing.Optional[typing.Any]] + + embed_domains : typing.Optional[typing.Sequence[typing.Dict[str, str]]] + + embed_settings : typing.Optional[typing.Optional[typing.Any]] + + title : typing.Optional[str] + + token : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LseOrganization + + + Examples + -------- + from label_studio_sdk import LabelStudio + + client = LabelStudio( + api_key="YOUR_API_KEY", + ) + client.organizations.update( + id=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/organizations/{jsonable_encoder(id)}", + method="PATCH", + json={ + "contact_info": contact_info, + "created_by": created_by, + "custom_scripts_editable_by": custom_scripts_editable_by, + "custom_scripts_enabled": custom_scripts_enabled, + "email_notification_settings": email_notification_settings, + "embed_domains": embed_domains, + "embed_settings": embed_settings, + "title": title, + "token": token, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + LseOrganization, + construct_type( + type_=LseOrganization, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 400: + raise BadRequestError( + typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + if _response.status_code == 403: + raise ForbiddenError( + typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_default_role( + self, + id: int, + *, + annotator_reviewer_firewall_enabled_at: typing.Optional[dt.datetime] = OMIT, + custom_scripts_editable_by: typing.Optional[PatchedDefaultRoleRequestCustomScriptsEditableBy] = OMIT, + custom_scripts_enabled_at: typing.Optional[dt.datetime] = OMIT, + default_role: typing.Optional[DefaultRoleEnum] = OMIT, + email_notification_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + embed_domains: typing.Optional[typing.Optional[typing.Any]] = OMIT, + embed_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + external_id: typing.Optional[str] = OMIT, + extra_data_on_activity_logs: typing.Optional[bool] = OMIT, + label_stream_navigation_disabled_at: typing.Optional[dt.datetime] = OMIT, + organization: typing.Optional[int] = OMIT, + read_only_quick_view_enabled_at: typing.Optional[dt.datetime] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DefaultRole: + """ + Update the default role for members of a specific organization. + + Parameters + ---------- + id : int + + annotator_reviewer_firewall_enabled_at : typing.Optional[dt.datetime] + Set to current time to restrict data sharing between annotators and reviewers in the label stream, review stream, and notifications (which will be disabled). In these settings, information about annotator and reviewer identity is suppressed in the UI. + + custom_scripts_editable_by : typing.Optional[PatchedDefaultRoleRequestCustomScriptsEditableBy] + Set the minimum user role that can edit custom scripts in the UI. + + * `AD` - Administrator + * `MA` - Manager + + custom_scripts_enabled_at : typing.Optional[dt.datetime] + Set to current time to enabled custom scripts for this organization. Can only be enabled if no organization members are active members of any other organizations; otherwise an error will be raised. If this occurs, contact the LEAP team for assistance with enabling custom scripts. + + default_role : typing.Optional[DefaultRoleEnum] + Default membership role for invited users + + * `OW` - Owner + * `AD` - Administrator + * `MA` - Manager + * `RE` - Reviewer + * `AN` - Annotator + * `DI` - Deactivated + * `NO` - Not Activated + + email_notification_settings : typing.Optional[typing.Optional[typing.Any]] + + embed_domains : typing.Optional[typing.Optional[typing.Any]] + + embed_settings : typing.Optional[typing.Optional[typing.Any]] + + external_id : typing.Optional[str] + External ID to uniquely identify this organization + + extra_data_on_activity_logs : typing.Optional[bool] + + label_stream_navigation_disabled_at : typing.Optional[dt.datetime] + Set to current time to disable the label stream navigation for this organization. This will prevent users from going back in the label stream to view previous labels. + + organization : typing.Optional[int] + A unique integer value identifying this organization. + + read_only_quick_view_enabled_at : typing.Optional[dt.datetime] + Set to current time to prevent creating or editing annotations in quick view. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DefaultRole + + + Examples + -------- + from label_studio_sdk import LabelStudio + + client = LabelStudio( + api_key="YOUR_API_KEY", + ) + client.organizations.update_default_role( + id=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/organizations/{jsonable_encoder(id)}/set-default-role", + method="PATCH", + json={ + "annotator_reviewer_firewall_enabled_at": annotator_reviewer_firewall_enabled_at, + "custom_scripts_editable_by": convert_and_respect_annotation_metadata( + object_=custom_scripts_editable_by, + annotation=PatchedDefaultRoleRequestCustomScriptsEditableBy, + direction="write", + ), + "custom_scripts_enabled_at": custom_scripts_enabled_at, + "default_role": default_role, + "email_notification_settings": email_notification_settings, + "embed_domains": embed_domains, + "embed_settings": embed_settings, + "external_id": external_id, + "extra_data_on_activity_logs": extra_data_on_activity_logs, + "label_stream_navigation_disabled_at": label_stream_navigation_disabled_at, + "organization": organization, + "read_only_quick_view_enabled_at": read_only_quick_view_enabled_at, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + DefaultRole, + construct_type( + type_=DefaultRole, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + class AsyncOrganizationsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -333,3 +597,270 @@ async def main() -> None: except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update( + self, + id: int, + *, + contact_info: typing.Optional[str] = OMIT, + created_by: typing.Optional[int] = OMIT, + custom_scripts_editable_by: typing.Optional[str] = OMIT, + custom_scripts_enabled: typing.Optional[bool] = OMIT, + email_notification_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + embed_domains: typing.Optional[typing.Sequence[typing.Dict[str, str]]] = OMIT, + embed_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + title: typing.Optional[str] = OMIT, + token: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LseOrganization: + """ + Update organization details including title, embed domains, and custom scripts settings. + + Parameters + ---------- + id : int + + contact_info : typing.Optional[str] + + created_by : typing.Optional[int] + + custom_scripts_editable_by : typing.Optional[str] + + custom_scripts_enabled : typing.Optional[bool] + + email_notification_settings : typing.Optional[typing.Optional[typing.Any]] + + embed_domains : typing.Optional[typing.Sequence[typing.Dict[str, str]]] + + embed_settings : typing.Optional[typing.Optional[typing.Any]] + + title : typing.Optional[str] + + token : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LseOrganization + + + Examples + -------- + import asyncio + + from label_studio_sdk import AsyncLabelStudio + + client = AsyncLabelStudio( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.organizations.update( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/organizations/{jsonable_encoder(id)}", + method="PATCH", + json={ + "contact_info": contact_info, + "created_by": created_by, + "custom_scripts_editable_by": custom_scripts_editable_by, + "custom_scripts_enabled": custom_scripts_enabled, + "email_notification_settings": email_notification_settings, + "embed_domains": embed_domains, + "embed_settings": embed_settings, + "title": title, + "token": token, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + LseOrganization, + construct_type( + type_=LseOrganization, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 400: + raise BadRequestError( + typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + if _response.status_code == 403: + raise ForbiddenError( + typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_default_role( + self, + id: int, + *, + annotator_reviewer_firewall_enabled_at: typing.Optional[dt.datetime] = OMIT, + custom_scripts_editable_by: typing.Optional[PatchedDefaultRoleRequestCustomScriptsEditableBy] = OMIT, + custom_scripts_enabled_at: typing.Optional[dt.datetime] = OMIT, + default_role: typing.Optional[DefaultRoleEnum] = OMIT, + email_notification_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + embed_domains: typing.Optional[typing.Optional[typing.Any]] = OMIT, + embed_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + external_id: typing.Optional[str] = OMIT, + extra_data_on_activity_logs: typing.Optional[bool] = OMIT, + label_stream_navigation_disabled_at: typing.Optional[dt.datetime] = OMIT, + organization: typing.Optional[int] = OMIT, + read_only_quick_view_enabled_at: typing.Optional[dt.datetime] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DefaultRole: + """ + Update the default role for members of a specific organization. + + Parameters + ---------- + id : int + + annotator_reviewer_firewall_enabled_at : typing.Optional[dt.datetime] + Set to current time to restrict data sharing between annotators and reviewers in the label stream, review stream, and notifications (which will be disabled). In these settings, information about annotator and reviewer identity is suppressed in the UI. + + custom_scripts_editable_by : typing.Optional[PatchedDefaultRoleRequestCustomScriptsEditableBy] + Set the minimum user role that can edit custom scripts in the UI. + + * `AD` - Administrator + * `MA` - Manager + + custom_scripts_enabled_at : typing.Optional[dt.datetime] + Set to current time to enabled custom scripts for this organization. Can only be enabled if no organization members are active members of any other organizations; otherwise an error will be raised. If this occurs, contact the LEAP team for assistance with enabling custom scripts. + + default_role : typing.Optional[DefaultRoleEnum] + Default membership role for invited users + + * `OW` - Owner + * `AD` - Administrator + * `MA` - Manager + * `RE` - Reviewer + * `AN` - Annotator + * `DI` - Deactivated + * `NO` - Not Activated + + email_notification_settings : typing.Optional[typing.Optional[typing.Any]] + + embed_domains : typing.Optional[typing.Optional[typing.Any]] + + embed_settings : typing.Optional[typing.Optional[typing.Any]] + + external_id : typing.Optional[str] + External ID to uniquely identify this organization + + extra_data_on_activity_logs : typing.Optional[bool] + + label_stream_navigation_disabled_at : typing.Optional[dt.datetime] + Set to current time to disable the label stream navigation for this organization. This will prevent users from going back in the label stream to view previous labels. + + organization : typing.Optional[int] + A unique integer value identifying this organization. + + read_only_quick_view_enabled_at : typing.Optional[dt.datetime] + Set to current time to prevent creating or editing annotations in quick view. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DefaultRole + + + Examples + -------- + import asyncio + + from label_studio_sdk import AsyncLabelStudio + + client = AsyncLabelStudio( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.organizations.update_default_role( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/organizations/{jsonable_encoder(id)}/set-default-role", + method="PATCH", + json={ + "annotator_reviewer_firewall_enabled_at": annotator_reviewer_firewall_enabled_at, + "custom_scripts_editable_by": convert_and_respect_annotation_metadata( + object_=custom_scripts_editable_by, + annotation=PatchedDefaultRoleRequestCustomScriptsEditableBy, + direction="write", + ), + "custom_scripts_enabled_at": custom_scripts_enabled_at, + "default_role": default_role, + "email_notification_settings": email_notification_settings, + "embed_domains": embed_domains, + "embed_settings": embed_settings, + "external_id": external_id, + "extra_data_on_activity_logs": extra_data_on_activity_logs, + "label_stream_navigation_disabled_at": label_stream_navigation_disabled_at, + "organization": organization, + "read_only_quick_view_enabled_at": read_only_quick_view_enabled_at, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + DefaultRole, + construct_type( + type_=DefaultRole, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/label_studio_sdk/organizations/types/__init__.py b/src/label_studio_sdk/organizations/types/__init__.py new file mode 100644 index 000000000..885594eaf --- /dev/null +++ b/src/label_studio_sdk/organizations/types/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .patched_default_role_request_custom_scripts_editable_by import PatchedDefaultRoleRequestCustomScriptsEditableBy + +__all__ = ["PatchedDefaultRoleRequestCustomScriptsEditableBy"] diff --git a/src/label_studio_sdk/organizations/types/patched_default_role_request_custom_scripts_editable_by.py b/src/label_studio_sdk/organizations/types/patched_default_role_request_custom_scripts_editable_by.py new file mode 100644 index 000000000..2008fb24f --- /dev/null +++ b/src/label_studio_sdk/organizations/types/patched_default_role_request_custom_scripts_editable_by.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ...types.custom_scripts_editable_by_enum import CustomScriptsEditableByEnum +from ...types.null_enum import NullEnum + +PatchedDefaultRoleRequestCustomScriptsEditableBy = typing.Union[CustomScriptsEditableByEnum, NullEnum] diff --git a/src/label_studio_sdk/project_templates/__init__.py b/src/label_studio_sdk/project_templates/__init__.py new file mode 100644 index 000000000..f3ea2659b --- /dev/null +++ b/src/label_studio_sdk/project_templates/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/src/label_studio_sdk/project_templates/client.py b/src/label_studio_sdk/project_templates/client.py new file mode 100644 index 000000000..902160f37 --- /dev/null +++ b/src/label_studio_sdk/project_templates/client.py @@ -0,0 +1,909 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.project_template import ProjectTemplate +from ..core.unchecked_base_model import construct_type +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..core.jsonable_encoder import jsonable_encoder +from ..types.lse_project import LseProject +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ProjectTemplatesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[ProjectTemplate]: + """ + Get a list of all project templates for an organization. + + Parameters + ---------- + ordering : typing.Optional[str] + Which field to use when ordering the results. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[ProjectTemplate] + + + Examples + -------- + from label_studio_sdk import LabelStudio + + client = LabelStudio( + api_key="YOUR_API_KEY", + ) + client.project_templates.list() + """ + _response = self._client_wrapper.httpx_client.request( + "api/project-templates/", + method="GET", + params={ + "ordering": ordering, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + typing.List[ProjectTemplate], + construct_type( + type_=typing.List[ProjectTemplate], # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create( + self, + *, + name: str, + project_id: int, + assignment_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + created_by: typing.Optional[int] = OMIT, + custom_script: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + organization: typing.Optional[int] = OMIT, + project_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + require_comment_on_skip: typing.Optional[bool] = OMIT, + review_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + show_unused_data_columns_to_annotators: typing.Optional[bool] = OMIT, + tags: typing.Optional[typing.Optional[typing.Any]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProjectTemplate: + """ + Create a project template for an organization. + + Parameters + ---------- + name : str + + project_id : int + + assignment_settings : typing.Optional[typing.Optional[typing.Any]] + + created_by : typing.Optional[int] + + custom_script : typing.Optional[str] + custom script for projects created from this template + + description : typing.Optional[str] + + organization : typing.Optional[int] + + project_settings : typing.Optional[typing.Optional[typing.Any]] + + require_comment_on_skip : typing.Optional[bool] + flag to require comment on skip + + review_settings : typing.Optional[typing.Optional[typing.Any]] + + show_unused_data_columns_to_annotators : typing.Optional[bool] + + tags : typing.Optional[typing.Optional[typing.Any]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectTemplate + + + Examples + -------- + from label_studio_sdk import LabelStudio + + client = LabelStudio( + api_key="YOUR_API_KEY", + ) + client.project_templates.create( + name="name", + project_id=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "api/project-templates/", + method="POST", + json={ + "assignment_settings": assignment_settings, + "created_by": created_by, + "custom_script": custom_script, + "description": description, + "name": name, + "organization": organization, + "project_id": project_id, + "project_settings": project_settings, + "require_comment_on_skip": require_comment_on_skip, + "review_settings": review_settings, + "show_unused_data_columns_to_annotators": show_unused_data_columns_to_annotators, + "tags": tags, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ProjectTemplate, + construct_type( + type_=ProjectTemplate, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> ProjectTemplate: + """ + Get a specific project template by ID for an organization. + + Parameters + ---------- + id : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectTemplate + + + Examples + -------- + from label_studio_sdk import LabelStudio + + client = LabelStudio( + api_key="YOUR_API_KEY", + ) + client.project_templates.get( + id=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/project-templates/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ProjectTemplate, + construct_type( + type_=ProjectTemplate, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a specific project template by ID for an organization. + + Parameters + ---------- + id : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from label_studio_sdk import LabelStudio + + client = LabelStudio( + api_key="YOUR_API_KEY", + ) + client.project_templates.delete( + id=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/project-templates/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update( + self, + id: int, + *, + assignment_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + created_by: typing.Optional[int] = OMIT, + custom_script: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + organization: typing.Optional[int] = OMIT, + project_id: typing.Optional[int] = OMIT, + project_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + require_comment_on_skip: typing.Optional[bool] = OMIT, + review_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + show_unused_data_columns_to_annotators: typing.Optional[bool] = OMIT, + tags: typing.Optional[typing.Optional[typing.Any]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProjectTemplate: + """ + Update the details of a specific project template by ID for an organization. + + Parameters + ---------- + id : int + + assignment_settings : typing.Optional[typing.Optional[typing.Any]] + + created_by : typing.Optional[int] + + custom_script : typing.Optional[str] + custom script for projects created from this template + + description : typing.Optional[str] + + name : typing.Optional[str] + + organization : typing.Optional[int] + + project_id : typing.Optional[int] + + project_settings : typing.Optional[typing.Optional[typing.Any]] + + require_comment_on_skip : typing.Optional[bool] + flag to require comment on skip + + review_settings : typing.Optional[typing.Optional[typing.Any]] + + show_unused_data_columns_to_annotators : typing.Optional[bool] + + tags : typing.Optional[typing.Optional[typing.Any]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectTemplate + + + Examples + -------- + from label_studio_sdk import LabelStudio + + client = LabelStudio( + api_key="YOUR_API_KEY", + ) + client.project_templates.update( + id=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/project-templates/{jsonable_encoder(id)}", + method="PATCH", + json={ + "assignment_settings": assignment_settings, + "created_by": created_by, + "custom_script": custom_script, + "description": description, + "name": name, + "organization": organization, + "project_id": project_id, + "project_settings": project_settings, + "require_comment_on_skip": require_comment_on_skip, + "review_settings": review_settings, + "show_unused_data_columns_to_annotators": show_unused_data_columns_to_annotators, + "tags": tags, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ProjectTemplate, + construct_type( + type_=ProjectTemplate, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create_project_from_template( + self, + id: int, + *, + title: str, + workspace_id: int, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LseProject: + """ + Create a project from a specific project template by ID for an organization. + + Parameters + ---------- + id : int + + title : str + The title of the project to be created from the template. + + workspace_id : int + A unique integer value identifying the workspace in which to create the project. + + description : typing.Optional[str] + A description for the project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LseProject + Project created successfully + + Examples + -------- + from label_studio_sdk import LabelStudio + + client = LabelStudio( + api_key="YOUR_API_KEY", + ) + client.project_templates.create_project_from_template( + id=1, + title="title", + workspace_id=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/project-templates/{jsonable_encoder(id)}/create-project", + method="POST", + json={ + "description": description, + "title": title, + "workspace_id": workspace_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + LseProject, + construct_type( + type_=LseProject, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncProjectTemplatesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[ProjectTemplate]: + """ + Get a list of all project templates for an organization. + + Parameters + ---------- + ordering : typing.Optional[str] + Which field to use when ordering the results. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[ProjectTemplate] + + + Examples + -------- + import asyncio + + from label_studio_sdk import AsyncLabelStudio + + client = AsyncLabelStudio( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.project_templates.list() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "api/project-templates/", + method="GET", + params={ + "ordering": ordering, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + typing.List[ProjectTemplate], + construct_type( + type_=typing.List[ProjectTemplate], # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create( + self, + *, + name: str, + project_id: int, + assignment_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + created_by: typing.Optional[int] = OMIT, + custom_script: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + organization: typing.Optional[int] = OMIT, + project_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + require_comment_on_skip: typing.Optional[bool] = OMIT, + review_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + show_unused_data_columns_to_annotators: typing.Optional[bool] = OMIT, + tags: typing.Optional[typing.Optional[typing.Any]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProjectTemplate: + """ + Create a project template for an organization. + + Parameters + ---------- + name : str + + project_id : int + + assignment_settings : typing.Optional[typing.Optional[typing.Any]] + + created_by : typing.Optional[int] + + custom_script : typing.Optional[str] + custom script for projects created from this template + + description : typing.Optional[str] + + organization : typing.Optional[int] + + project_settings : typing.Optional[typing.Optional[typing.Any]] + + require_comment_on_skip : typing.Optional[bool] + flag to require comment on skip + + review_settings : typing.Optional[typing.Optional[typing.Any]] + + show_unused_data_columns_to_annotators : typing.Optional[bool] + + tags : typing.Optional[typing.Optional[typing.Any]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectTemplate + + + Examples + -------- + import asyncio + + from label_studio_sdk import AsyncLabelStudio + + client = AsyncLabelStudio( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.project_templates.create( + name="name", + project_id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "api/project-templates/", + method="POST", + json={ + "assignment_settings": assignment_settings, + "created_by": created_by, + "custom_script": custom_script, + "description": description, + "name": name, + "organization": organization, + "project_id": project_id, + "project_settings": project_settings, + "require_comment_on_skip": require_comment_on_skip, + "review_settings": review_settings, + "show_unused_data_columns_to_annotators": show_unused_data_columns_to_annotators, + "tags": tags, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ProjectTemplate, + construct_type( + type_=ProjectTemplate, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> ProjectTemplate: + """ + Get a specific project template by ID for an organization. + + Parameters + ---------- + id : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectTemplate + + + Examples + -------- + import asyncio + + from label_studio_sdk import AsyncLabelStudio + + client = AsyncLabelStudio( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.project_templates.get( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/project-templates/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ProjectTemplate, + construct_type( + type_=ProjectTemplate, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a specific project template by ID for an organization. + + Parameters + ---------- + id : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from label_studio_sdk import AsyncLabelStudio + + client = AsyncLabelStudio( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.project_templates.delete( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/project-templates/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update( + self, + id: int, + *, + assignment_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + created_by: typing.Optional[int] = OMIT, + custom_script: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + organization: typing.Optional[int] = OMIT, + project_id: typing.Optional[int] = OMIT, + project_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + require_comment_on_skip: typing.Optional[bool] = OMIT, + review_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT, + show_unused_data_columns_to_annotators: typing.Optional[bool] = OMIT, + tags: typing.Optional[typing.Optional[typing.Any]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProjectTemplate: + """ + Update the details of a specific project template by ID for an organization. + + Parameters + ---------- + id : int + + assignment_settings : typing.Optional[typing.Optional[typing.Any]] + + created_by : typing.Optional[int] + + custom_script : typing.Optional[str] + custom script for projects created from this template + + description : typing.Optional[str] + + name : typing.Optional[str] + + organization : typing.Optional[int] + + project_id : typing.Optional[int] + + project_settings : typing.Optional[typing.Optional[typing.Any]] + + require_comment_on_skip : typing.Optional[bool] + flag to require comment on skip + + review_settings : typing.Optional[typing.Optional[typing.Any]] + + show_unused_data_columns_to_annotators : typing.Optional[bool] + + tags : typing.Optional[typing.Optional[typing.Any]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectTemplate + + + Examples + -------- + import asyncio + + from label_studio_sdk import AsyncLabelStudio + + client = AsyncLabelStudio( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.project_templates.update( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/project-templates/{jsonable_encoder(id)}", + method="PATCH", + json={ + "assignment_settings": assignment_settings, + "created_by": created_by, + "custom_script": custom_script, + "description": description, + "name": name, + "organization": organization, + "project_id": project_id, + "project_settings": project_settings, + "require_comment_on_skip": require_comment_on_skip, + "review_settings": review_settings, + "show_unused_data_columns_to_annotators": show_unused_data_columns_to_annotators, + "tags": tags, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ProjectTemplate, + construct_type( + type_=ProjectTemplate, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_project_from_template( + self, + id: int, + *, + title: str, + workspace_id: int, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LseProject: + """ + Create a project from a specific project template by ID for an organization. + + Parameters + ---------- + id : int + + title : str + The title of the project to be created from the template. + + workspace_id : int + A unique integer value identifying the workspace in which to create the project. + + description : typing.Optional[str] + A description for the project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LseProject + Project created successfully + + Examples + -------- + import asyncio + + from label_studio_sdk import AsyncLabelStudio + + client = AsyncLabelStudio( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.project_templates.create_project_from_template( + id=1, + title="title", + workspace_id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/project-templates/{jsonable_encoder(id)}/create-project", + method="POST", + json={ + "description": description, + "title": title, + "workspace_id": workspace_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + LseProject, + construct_type( + type_=LseProject, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/label_studio_sdk/types/__init__.py b/src/label_studio_sdk/types/__init__.py index 4bdf5fbbb..e63feb006 100644 --- a/src/label_studio_sdk/types/__init__.py +++ b/src/label_studio_sdk/types/__init__.py @@ -47,6 +47,8 @@ from .converted_format_request import ConvertedFormatRequest from .count_limit import CountLimit from .custom_scripts_editable_by_enum import CustomScriptsEditableByEnum +from .default_role import DefaultRole +from .default_role_custom_scripts_editable_by import DefaultRoleCustomScriptsEditableBy from .default_role_enum import DefaultRoleEnum from .edition_enum import EditionEnum from .export import Export @@ -79,9 +81,12 @@ from .lse_organization import LseOrganization from .lse_organization_custom_scripts_editable_by import LseOrganizationCustomScriptsEditableBy from .lse_organization_member_list import LseOrganizationMemberList +from .lse_project import LseProject from .lse_project_create import LseProjectCreate from .lse_project_create_sampling import LseProjectCreateSampling from .lse_project_create_skip_queue import LseProjectCreateSkipQueue +from .lse_project_sampling import LseProjectSampling +from .lse_project_skip_queue import LseProjectSkipQueue from .lse_project_update import LseProjectUpdate from .lse_project_update_sampling import LseProjectUpdateSampling from .lse_project_update_skip_queue import LseProjectUpdateSkipQueue @@ -155,6 +160,8 @@ from .project_sampling import ProjectSampling from .project_skip_queue import ProjectSkipQueue from .project_subset_enum import ProjectSubsetEnum +from .project_template import ProjectTemplate +from .project_template_request import ProjectTemplateRequest from .prompts_status_enum import PromptsStatusEnum from .provider_enum import ProviderEnum from .reason_enum import ReasonEnum @@ -260,6 +267,8 @@ "ConvertedFormatRequest", "CountLimit", "CustomScriptsEditableByEnum", + "DefaultRole", + "DefaultRoleCustomScriptsEditableBy", "DefaultRoleEnum", "EditionEnum", "Export", @@ -292,9 +301,12 @@ "LseOrganization", "LseOrganizationCustomScriptsEditableBy", "LseOrganizationMemberList", + "LseProject", "LseProjectCreate", "LseProjectCreateSampling", "LseProjectCreateSkipQueue", + "LseProjectSampling", + "LseProjectSkipQueue", "LseProjectUpdate", "LseProjectUpdateSampling", "LseProjectUpdateSkipQueue", @@ -368,6 +380,8 @@ "ProjectSampling", "ProjectSkipQueue", "ProjectSubsetEnum", + "ProjectTemplate", + "ProjectTemplateRequest", "PromptsStatusEnum", "ProviderEnum", "ReasonEnum", diff --git a/src/label_studio_sdk/types/default_role.py b/src/label_studio_sdk/types/default_role.py new file mode 100644 index 000000000..fe031178a --- /dev/null +++ b/src/label_studio_sdk/types/default_role.py @@ -0,0 +1,75 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.unchecked_base_model import UncheckedBaseModel +import typing +import datetime as dt +import pydantic +from .default_role_custom_scripts_editable_by import DefaultRoleCustomScriptsEditableBy +from .default_role_enum import DefaultRoleEnum +from ..core.pydantic_utilities import IS_PYDANTIC_V2 + + +class DefaultRole(UncheckedBaseModel): + annotator_reviewer_firewall_enabled_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + Set to current time to restrict data sharing between annotators and reviewers in the label stream, review stream, and notifications (which will be disabled). In these settings, information about annotator and reviewer identity is suppressed in the UI. + """ + + custom_scripts_editable_by: typing.Optional[DefaultRoleCustomScriptsEditableBy] = pydantic.Field(default=None) + """ + Set the minimum user role that can edit custom scripts in the UI. + + * `AD` - Administrator + * `MA` - Manager + """ + + custom_scripts_enabled_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + Set to current time to enabled custom scripts for this organization. Can only be enabled if no organization members are active members of any other organizations; otherwise an error will be raised. If this occurs, contact the LEAP team for assistance with enabling custom scripts. + """ + + default_role: typing.Optional[DefaultRoleEnum] = pydantic.Field(default=None) + """ + Default membership role for invited users + + * `OW` - Owner + * `AD` - Administrator + * `MA` - Manager + * `RE` - Reviewer + * `AN` - Annotator + * `DI` - Deactivated + * `NO` - Not Activated + """ + + email_notification_settings: typing.Optional[typing.Optional[typing.Any]] = None + embed_domains: typing.Optional[typing.Optional[typing.Any]] = None + embed_settings: typing.Optional[typing.Optional[typing.Any]] = None + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + External ID to uniquely identify this organization + """ + + extra_data_on_activity_logs: typing.Optional[bool] = None + label_stream_navigation_disabled_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + Set to current time to disable the label stream navigation for this organization. This will prevent users from going back in the label stream to view previous labels. + """ + + organization: int = pydantic.Field() + """ + A unique integer value identifying this organization. + """ + + read_only_quick_view_enabled_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + Set to current time to prevent creating or editing annotations in quick view. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/label_studio_sdk/types/default_role_custom_scripts_editable_by.py b/src/label_studio_sdk/types/default_role_custom_scripts_editable_by.py new file mode 100644 index 000000000..e22ee2a88 --- /dev/null +++ b/src/label_studio_sdk/types/default_role_custom_scripts_editable_by.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from .custom_scripts_editable_by_enum import CustomScriptsEditableByEnum +from .null_enum import NullEnum + +DefaultRoleCustomScriptsEditableBy = typing.Union[CustomScriptsEditableByEnum, NullEnum] diff --git a/src/label_studio_sdk/types/lse_project.py b/src/label_studio_sdk/types/lse_project.py new file mode 100644 index 000000000..29b04970d --- /dev/null +++ b/src/label_studio_sdk/types/lse_project.py @@ -0,0 +1,223 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.unchecked_base_model import UncheckedBaseModel +import typing +from .assignment_settings import AssignmentSettings +import pydantic +import datetime as dt +from .user_simple import UserSimple +from .review_settings import ReviewSettings +from .lse_project_sampling import LseProjectSampling +from .lse_project_skip_queue import LseProjectSkipQueue +from ..core.pydantic_utilities import IS_PYDANTIC_V2 + + +class LseProject(UncheckedBaseModel): + """ + Serializer get numbers from project queryset annotation, + make sure, that you use correct one(Project.objects.with_counts()) + """ + + annotation_limit_count: typing.Optional[int] = None + annotation_limit_percent: typing.Optional[str] = None + annotator_evaluation_minimum_score: typing.Optional[str] = None + annotator_evaluation_minimum_tasks: typing.Optional[int] = None + assignment_settings: AssignmentSettings + color: typing.Optional[str] = None + comment_classification_config: typing.Optional[str] = None + config_has_control_tags: bool = pydantic.Field() + """ + Flag to detect is project ready for labeling + """ + + config_suitable_for_bulk_annotation: bool = pydantic.Field() + """ + Flag to detect is project ready for bulk annotation + """ + + control_weights: typing.Optional[typing.Optional[typing.Any]] = None + created_at: dt.datetime + created_by: typing.Optional[UserSimple] = pydantic.Field(default=None) + """ + Project owner + """ + + custom_script: typing.Optional[str] = None + custom_task_lock_ttl: typing.Optional[int] = pydantic.Field(default=None) + """ + TTL in seconds for task reservations, on new and existing tasks + """ + + data_types: typing.Optional[typing.Any] = None + description: typing.Optional[str] = pydantic.Field(default=None) + """ + Project description + """ + + duplication_done: typing.Optional[bool] = None + duplication_status: typing.Optional[str] = None + enable_empty_annotation: typing.Optional[bool] = pydantic.Field(default=None) + """ + Allow annotators to submit empty annotations + """ + + evaluate_predictions_automatically: typing.Optional[bool] = pydantic.Field(default=None) + """ + Retrieve and display predictions when loading a task + """ + + expert_instruction: typing.Optional[str] = pydantic.Field(default=None) + """ + Labeling instructions in HTML format + """ + + finished_task_number: int = pydantic.Field() + """ + Finished tasks + """ + + ground_truth_number: int = pydantic.Field() + """ + Honeypot annotation number in project + """ + + id: int + is_draft: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the project is in the middle of being created + """ + + is_published: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the project is published to annotators + """ + + label_config: typing.Optional[str] = pydantic.Field(default=None) + """ + Label config in XML format. See more about it in documentation + """ + + maximum_annotations: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of annotations for one task. If the number of annotations per task is equal or greater to this value, the task is completed (is_labeled=True) + """ + + members: str + members_count: int + min_annotations_to_start_training: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum number of completed tasks after which model training is started + """ + + model_version: typing.Optional[str] = pydantic.Field(default=None) + """ + Machine learning model version + """ + + num_tasks_with_annotations: int = pydantic.Field() + """ + Tasks with annotations count + """ + + organization: typing.Optional[int] = None + overlap_cohort_percentage: typing.Optional[int] = None + parsed_label_config: typing.Optional[typing.Any] = None + pause_on_failed_annotator_evaluation: typing.Optional[bool] = None + pinned_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + Pinned date and time + """ + + prompts: str + queue_done: str + queue_left: str + queue_total: str + require_comment_on_skip: typing.Optional[bool] = None + reveal_preannotations_interactively: typing.Optional[bool] = pydantic.Field(default=None) + """ + Reveal pre-annotations interactively + """ + + review_settings: ReviewSettings + reviewer_queue_total: str + sampling: typing.Optional[LseProjectSampling] = None + show_annotation_history: typing.Optional[bool] = pydantic.Field(default=None) + """ + Show annotation history to annotator + """ + + show_collab_predictions: typing.Optional[bool] = pydantic.Field(default=None) + """ + If set, the annotator can view model predictions + """ + + show_ground_truth_first: typing.Optional[bool] = None + show_instruction: typing.Optional[bool] = pydantic.Field(default=None) + """ + Show instructions to the annotator before they start + """ + + show_overlap_first: typing.Optional[bool] = None + show_skip_button: typing.Optional[bool] = pydantic.Field(default=None) + """ + Show a skip button in interface and allow annotators to skip the task + """ + + show_unused_data_columns_to_annotators: typing.Optional[bool] = None + skip_queue: typing.Optional[LseProjectSkipQueue] = None + skipped_annotations_number: int = pydantic.Field() + """ + Skipped by collaborators annotation number in project + """ + + start_training_on_annotation_update: bool = pydantic.Field() + """ + Start model training after any annotations are submitted or updated + """ + + task_data_login: typing.Optional[str] = pydantic.Field(default=None) + """ + Task data credentials: login + """ + + task_data_password: typing.Optional[str] = pydantic.Field(default=None) + """ + Task data credentials: password + """ + + task_number: int = pydantic.Field() + """ + Total task number in project + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + Project name. Must be between 3 and 50 characters long. + """ + + total_annotations_number: int = pydantic.Field() + """ + Total annotations number in project including skipped_annotations_number and ground_truth_number. + """ + + total_predictions_number: int = pydantic.Field() + """ + Total predictions number in project including skipped_annotations_number, ground_truth_number, and useful_annotation_number. + """ + + useful_annotation_number: int = pydantic.Field() + """ + Useful annotation number in project not including skipped_annotations_number and ground_truth_number. Total annotations = annotation_number + skipped_annotations_number + ground_truth_number + """ + + workspace: str + workspace_title: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/label_studio_sdk/types/lse_project_sampling.py b/src/label_studio_sdk/types/lse_project_sampling.py new file mode 100644 index 000000000..fa58a1f30 --- /dev/null +++ b/src/label_studio_sdk/types/lse_project_sampling.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from .sampling_enum import SamplingEnum +from .null_enum import NullEnum + +LseProjectSampling = typing.Union[SamplingEnum, NullEnum] diff --git a/src/label_studio_sdk/types/lse_project_skip_queue.py b/src/label_studio_sdk/types/lse_project_skip_queue.py new file mode 100644 index 000000000..d99889b8c --- /dev/null +++ b/src/label_studio_sdk/types/lse_project_skip_queue.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from .skip_queue_enum import SkipQueueEnum +from .null_enum import NullEnum + +LseProjectSkipQueue = typing.Union[SkipQueueEnum, NullEnum] diff --git a/src/label_studio_sdk/types/lse_task.py b/src/label_studio_sdk/types/lse_task.py index 11d635034..2d945fc25 100644 --- a/src/label_studio_sdk/types/lse_task.py +++ b/src/label_studio_sdk/types/lse_task.py @@ -15,7 +15,7 @@ class LseTask(UncheckedBaseModel): """ agreement: str - agreement_filtered: str + agreement_selected: str annotations: str annotations_ids: str annotations_results: str diff --git a/src/label_studio_sdk/types/lse_task_serializer_for_reviewers.py b/src/label_studio_sdk/types/lse_task_serializer_for_reviewers.py index 435a0efb2..eeea92c75 100644 --- a/src/label_studio_sdk/types/lse_task_serializer_for_reviewers.py +++ b/src/label_studio_sdk/types/lse_task_serializer_for_reviewers.py @@ -15,7 +15,7 @@ class LseTaskSerializerForReviewers(UncheckedBaseModel): """ agreement: str - agreement_filtered: str + agreement_selected: str annotations: str annotations_ids: str annotations_results: str diff --git a/src/label_studio_sdk/types/project_template.py b/src/label_studio_sdk/types/project_template.py new file mode 100644 index 000000000..eddd5cfb0 --- /dev/null +++ b/src/label_studio_sdk/types/project_template.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.unchecked_base_model import UncheckedBaseModel +import typing +import datetime as dt +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 + + +class ProjectTemplate(UncheckedBaseModel): + assignment_settings: typing.Optional[typing.Optional[typing.Any]] = None + created_at: dt.datetime + created_by: typing.Optional[int] = None + custom_script: typing.Optional[str] = pydantic.Field(default=None) + """ + custom script for projects created from this template + """ + + description: typing.Optional[str] = None + id: int + name: str + organization: typing.Optional[int] = None + project_settings: typing.Optional[typing.Optional[typing.Any]] = None + require_comment_on_skip: typing.Optional[bool] = pydantic.Field(default=None) + """ + flag to require comment on skip + """ + + review_settings: typing.Optional[typing.Optional[typing.Any]] = None + show_unused_data_columns_to_annotators: typing.Optional[bool] = None + tags: typing.Optional[typing.Optional[typing.Any]] = None + updated_at: dt.datetime + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/label_studio_sdk/types/project_template_request.py b/src/label_studio_sdk/types/project_template_request.py new file mode 100644 index 000000000..c55507957 --- /dev/null +++ b/src/label_studio_sdk/types/project_template_request.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.unchecked_base_model import UncheckedBaseModel +import typing +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 + + +class ProjectTemplateRequest(UncheckedBaseModel): + assignment_settings: typing.Optional[typing.Optional[typing.Any]] = None + created_by: typing.Optional[int] = None + custom_script: typing.Optional[str] = pydantic.Field(default=None) + """ + custom script for projects created from this template + """ + + description: typing.Optional[str] = None + name: str + organization: typing.Optional[int] = None + project_id: int + project_settings: typing.Optional[typing.Optional[typing.Any]] = None + require_comment_on_skip: typing.Optional[bool] = pydantic.Field(default=None) + """ + flag to require comment on skip + """ + + review_settings: typing.Optional[typing.Optional[typing.Any]] = None + show_unused_data_columns_to_annotators: typing.Optional[bool] = None + tags: typing.Optional[typing.Optional[typing.Any]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/tests/test_ml.py b/tests/test_ml.py index 23362f9bf..a252626c5 100644 --- a/tests/test_ml.py +++ b/tests/test_ml.py @@ -231,6 +231,19 @@ async def test_predict_interactive(client: LabelStudio, async_client: AsyncLabel ) +async def test_predict_all_tasks(client: LabelStudio, async_client: AsyncLabelStudio) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert ( + client.ml.predict_all_tasks(id=1) # type: ignore[func-returns-value] + is None + ) + + assert ( + await async_client.ml.predict_all_tasks(id=1) # type: ignore[func-returns-value] + is None + ) + + async def test_train(client: LabelStudio, async_client: AsyncLabelStudio) -> None: # Type ignore to avoid mypy complaining about the function not being meant to return a value assert ( diff --git a/tests/test_organizations.py b/tests/test_organizations.py index d0b3ea84c..c446f342b 100644 --- a/tests/test_organizations.py +++ b/tests/test_organizations.py @@ -68,3 +68,78 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: async_response = await async_client.organizations.get(id=1) validate_response(async_response, expected_response, expected_types) + + +async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> None: + expected_response: typing.Any = { + "billing": { + "manual_role_management": "manual_role_management", + "manual_workspace_management": "manual_workspace_management", + }, + "created_at": "2024-01-15T09:30:00Z", + "custom_scripts_editable_by": "AD", + "custom_scripts_enabled": "custom_scripts_enabled", + "default_role": "OW", + "email_notification_settings": "email_notification_settings", + "embed_domains": {"key": "value"}, + "embed_settings": {"key": "value"}, + "external_id": "external_id", + "id": 1, + "title": "title", + "token": "token", + } + expected_types: typing.Any = { + "billing": {"manual_role_management": None, "manual_workspace_management": None}, + "created_at": "datetime", + "custom_scripts_editable_by": None, + "custom_scripts_enabled": None, + "default_role": None, + "email_notification_settings": None, + "embed_domains": None, + "embed_settings": None, + "external_id": None, + "id": "integer", + "title": None, + "token": None, + } + response = client.organizations.update(id=1) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.organizations.update(id=1) + validate_response(async_response, expected_response, expected_types) + + +async def test_update_default_role(client: LabelStudio, async_client: AsyncLabelStudio) -> None: + expected_response: typing.Any = { + "annotator_reviewer_firewall_enabled_at": "2024-01-15T09:30:00Z", + "custom_scripts_editable_by": "AD", + "custom_scripts_enabled_at": "2024-01-15T09:30:00Z", + "default_role": "OW", + "email_notification_settings": {"key": "value"}, + "embed_domains": {"key": "value"}, + "embed_settings": {"key": "value"}, + "external_id": "external_id", + "extra_data_on_activity_logs": True, + "label_stream_navigation_disabled_at": "2024-01-15T09:30:00Z", + "organization": 1, + "read_only_quick_view_enabled_at": "2024-01-15T09:30:00Z", + } + expected_types: typing.Any = { + "annotator_reviewer_firewall_enabled_at": "datetime", + "custom_scripts_editable_by": None, + "custom_scripts_enabled_at": "datetime", + "default_role": None, + "email_notification_settings": None, + "embed_domains": None, + "embed_settings": None, + "external_id": None, + "extra_data_on_activity_logs": None, + "label_stream_navigation_disabled_at": "datetime", + "organization": "integer", + "read_only_quick_view_enabled_at": "datetime", + } + response = client.organizations.update_default_role(id=1) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.organizations.update_default_role(id=1) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_project_templates.py b/tests/test_project_templates.py new file mode 100644 index 000000000..2c8855bfc --- /dev/null +++ b/tests/test_project_templates.py @@ -0,0 +1,368 @@ +# This file was auto-generated by Fern from our API Definition. + +from label_studio_sdk import LabelStudio +from label_studio_sdk import AsyncLabelStudio +import typing +from .utilities import validate_response + + +async def test_list_(client: LabelStudio, async_client: AsyncLabelStudio) -> None: + expected_response: typing.Any = [ + { + "assignment_settings": {"key": "value"}, + "created_at": "2024-01-15T09:30:00Z", + "created_by": 1, + "custom_script": "custom_script", + "description": "description", + "id": 1, + "name": "name", + "organization": 1, + "project_settings": {"key": "value"}, + "require_comment_on_skip": True, + "review_settings": {"key": "value"}, + "show_unused_data_columns_to_annotators": True, + "tags": {"key": "value"}, + "updated_at": "2024-01-15T09:30:00Z", + } + ] + expected_types: typing.Tuple[typing.Any, typing.Any] = ( + "list", + { + 0: { + "assignment_settings": None, + "created_at": "datetime", + "created_by": "integer", + "custom_script": None, + "description": None, + "id": "integer", + "name": None, + "organization": "integer", + "project_settings": None, + "require_comment_on_skip": None, + "review_settings": None, + "show_unused_data_columns_to_annotators": None, + "tags": None, + "updated_at": "datetime", + } + }, + ) + response = client.project_templates.list() + validate_response(response, expected_response, expected_types) + + async_response = await async_client.project_templates.list() + validate_response(async_response, expected_response, expected_types) + + +async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> None: + expected_response: typing.Any = { + "assignment_settings": {"key": "value"}, + "created_at": "2024-01-15T09:30:00Z", + "created_by": 1, + "custom_script": "custom_script", + "description": "description", + "id": 1, + "name": "name", + "organization": 1, + "project_settings": {"key": "value"}, + "require_comment_on_skip": True, + "review_settings": {"key": "value"}, + "show_unused_data_columns_to_annotators": True, + "tags": {"key": "value"}, + "updated_at": "2024-01-15T09:30:00Z", + } + expected_types: typing.Any = { + "assignment_settings": None, + "created_at": "datetime", + "created_by": "integer", + "custom_script": None, + "description": None, + "id": "integer", + "name": None, + "organization": "integer", + "project_settings": None, + "require_comment_on_skip": None, + "review_settings": None, + "show_unused_data_columns_to_annotators": None, + "tags": None, + "updated_at": "datetime", + } + response = client.project_templates.create(name="name", project_id=1) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.project_templates.create(name="name", project_id=1) + validate_response(async_response, expected_response, expected_types) + + +async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: + expected_response: typing.Any = { + "assignment_settings": {"key": "value"}, + "created_at": "2024-01-15T09:30:00Z", + "created_by": 1, + "custom_script": "custom_script", + "description": "description", + "id": 1, + "name": "name", + "organization": 1, + "project_settings": {"key": "value"}, + "require_comment_on_skip": True, + "review_settings": {"key": "value"}, + "show_unused_data_columns_to_annotators": True, + "tags": {"key": "value"}, + "updated_at": "2024-01-15T09:30:00Z", + } + expected_types: typing.Any = { + "assignment_settings": None, + "created_at": "datetime", + "created_by": "integer", + "custom_script": None, + "description": None, + "id": "integer", + "name": None, + "organization": "integer", + "project_settings": None, + "require_comment_on_skip": None, + "review_settings": None, + "show_unused_data_columns_to_annotators": None, + "tags": None, + "updated_at": "datetime", + } + response = client.project_templates.get(id=1) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.project_templates.get(id=1) + validate_response(async_response, expected_response, expected_types) + + +async def test_delete(client: LabelStudio, async_client: AsyncLabelStudio) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert ( + client.project_templates.delete(id=1) # type: ignore[func-returns-value] + is None + ) + + assert ( + await async_client.project_templates.delete(id=1) # type: ignore[func-returns-value] + is None + ) + + +async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> None: + expected_response: typing.Any = { + "assignment_settings": {"key": "value"}, + "created_at": "2024-01-15T09:30:00Z", + "created_by": 1, + "custom_script": "custom_script", + "description": "description", + "id": 1, + "name": "name", + "organization": 1, + "project_settings": {"key": "value"}, + "require_comment_on_skip": True, + "review_settings": {"key": "value"}, + "show_unused_data_columns_to_annotators": True, + "tags": {"key": "value"}, + "updated_at": "2024-01-15T09:30:00Z", + } + expected_types: typing.Any = { + "assignment_settings": None, + "created_at": "datetime", + "created_by": "integer", + "custom_script": None, + "description": None, + "id": "integer", + "name": None, + "organization": "integer", + "project_settings": None, + "require_comment_on_skip": None, + "review_settings": None, + "show_unused_data_columns_to_annotators": None, + "tags": None, + "updated_at": "datetime", + } + response = client.project_templates.update(id=1) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.project_templates.update(id=1) + validate_response(async_response, expected_response, expected_types) + + +async def test_create_project_from_template(client: LabelStudio, async_client: AsyncLabelStudio) -> None: + expected_response: typing.Any = { + "annotation_limit_count": 1, + "annotation_limit_percent": "annotation_limit_percent", + "annotator_evaluation_minimum_score": "annotator_evaluation_minimum_score", + "annotator_evaluation_minimum_tasks": 1, + "assignment_settings": {"id": 1, "label_stream_task_distribution": "auto_distribution", "project": 1}, + "color": "color", + "comment_classification_config": "comment_classification_config", + "config_has_control_tags": True, + "config_suitable_for_bulk_annotation": True, + "control_weights": {"key": "value"}, + "created_at": "2024-01-15T09:30:00Z", + "created_by": { + "avatar": "avatar", + "email": "email", + "first_name": "first_name", + "id": 1, + "last_name": "last_name", + }, + "custom_script": "custom_script", + "custom_task_lock_ttl": 1, + "data_types": {"key": "value"}, + "description": "description", + "duplication_done": True, + "duplication_status": "duplication_status", + "enable_empty_annotation": True, + "evaluate_predictions_automatically": True, + "expert_instruction": "expert_instruction", + "finished_task_number": 1, + "ground_truth_number": 1, + "id": 1, + "is_draft": True, + "is_published": True, + "label_config": "label_config", + "maximum_annotations": 1, + "members": "members", + "members_count": 1, + "min_annotations_to_start_training": 1, + "model_version": "model_version", + "num_tasks_with_annotations": 1, + "organization": 1, + "overlap_cohort_percentage": 1, + "parsed_label_config": {"key": "value"}, + "pause_on_failed_annotator_evaluation": True, + "pinned_at": "2024-01-15T09:30:00Z", + "prompts": "prompts", + "queue_done": "queue_done", + "queue_left": "queue_left", + "queue_total": "queue_total", + "require_comment_on_skip": True, + "reveal_preannotations_interactively": True, + "review_settings": { + "anonymize_annotations": True, + "id": 1, + "instruction": "instruction", + "only_finished_tasks": True, + "project": 1, + "requeue_rejected_tasks_mode": "requeue", + "requeue_rejected_tasks_to_annotator": True, + "require_comment_on_reject": True, + "review_criteria": "all", + "review_only_manual_assignments": True, + "show_agreement_to_reviewers": True, + "show_data_manager_to_reviewers": True, + "show_instruction": True, + "show_unused_data_columns_to_reviewers": True, + }, + "reviewer_queue_total": "reviewer_queue_total", + "sampling": "Sequential sampling", + "show_annotation_history": True, + "show_collab_predictions": True, + "show_ground_truth_first": True, + "show_instruction": True, + "show_overlap_first": True, + "show_skip_button": True, + "show_unused_data_columns_to_annotators": True, + "skip_queue": "REQUEUE_FOR_ME", + "skipped_annotations_number": 1, + "start_training_on_annotation_update": True, + "task_data_login": "task_data_login", + "task_data_password": "task_data_password", + "task_number": 1, + "title": "title", + "total_annotations_number": 1, + "total_predictions_number": 1, + "useful_annotation_number": 1, + "workspace": "workspace", + "workspace_title": "workspace_title", + } + expected_types: typing.Any = { + "annotation_limit_count": "integer", + "annotation_limit_percent": None, + "annotator_evaluation_minimum_score": None, + "annotator_evaluation_minimum_tasks": "integer", + "assignment_settings": {"id": "integer", "label_stream_task_distribution": None, "project": "integer"}, + "color": None, + "comment_classification_config": None, + "config_has_control_tags": None, + "config_suitable_for_bulk_annotation": None, + "control_weights": None, + "created_at": "datetime", + "created_by": {"avatar": None, "email": None, "first_name": None, "id": "integer", "last_name": None}, + "custom_script": None, + "custom_task_lock_ttl": "integer", + "data_types": None, + "description": None, + "duplication_done": None, + "duplication_status": None, + "enable_empty_annotation": None, + "evaluate_predictions_automatically": None, + "expert_instruction": None, + "finished_task_number": "integer", + "ground_truth_number": "integer", + "id": "integer", + "is_draft": None, + "is_published": None, + "label_config": None, + "maximum_annotations": "integer", + "members": None, + "members_count": "integer", + "min_annotations_to_start_training": "integer", + "model_version": None, + "num_tasks_with_annotations": "integer", + "organization": "integer", + "overlap_cohort_percentage": "integer", + "parsed_label_config": None, + "pause_on_failed_annotator_evaluation": None, + "pinned_at": "datetime", + "prompts": None, + "queue_done": None, + "queue_left": None, + "queue_total": None, + "require_comment_on_skip": None, + "reveal_preannotations_interactively": None, + "review_settings": { + "anonymize_annotations": None, + "id": "integer", + "instruction": None, + "only_finished_tasks": None, + "project": "integer", + "requeue_rejected_tasks_mode": None, + "requeue_rejected_tasks_to_annotator": None, + "require_comment_on_reject": None, + "review_criteria": None, + "review_only_manual_assignments": None, + "show_agreement_to_reviewers": None, + "show_data_manager_to_reviewers": None, + "show_instruction": None, + "show_unused_data_columns_to_reviewers": None, + }, + "reviewer_queue_total": None, + "sampling": None, + "show_annotation_history": None, + "show_collab_predictions": None, + "show_ground_truth_first": None, + "show_instruction": None, + "show_overlap_first": None, + "show_skip_button": None, + "show_unused_data_columns_to_annotators": None, + "skip_queue": None, + "skipped_annotations_number": "integer", + "start_training_on_annotation_update": None, + "task_data_login": None, + "task_data_password": None, + "task_number": "integer", + "title": None, + "total_annotations_number": "integer", + "total_predictions_number": "integer", + "useful_annotation_number": "integer", + "workspace": None, + "workspace_title": None, + } + response = client.project_templates.create_project_from_template(id=1, title="title", workspace_id=1) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.project_templates.create_project_from_template( + id=1, title="title", workspace_id=1 + ) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_tasks.py b/tests/test_tasks.py index eb00a36ce..cff84d376 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -77,7 +77,7 @@ async def test_delete_all_tasks(client: LabelStudio, async_client: AsyncLabelStu async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> None: expected_response: typing.Any = { "agreement": "agreement", - "agreement_filtered": "agreement_filtered", + "agreement_selected": "agreement_selected", "annotations": "annotations", "annotations_ids": "annotations_ids", "annotations_results": "annotations_results", @@ -155,7 +155,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No } expected_types: typing.Any = { "agreement": None, - "agreement_filtered": None, + "agreement_selected": None, "annotations": None, "annotations_ids": None, "annotations_results": None, @@ -247,7 +247,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: expected_response: typing.Any = { "agreement": "agreement", - "agreement_filtered": "agreement_filtered", + "agreement_selected": "agreement_selected", "annotations": "annotations", "annotations_ids": "annotations_ids", "annotations_results": "annotations_results", @@ -305,7 +305,7 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: } expected_types: typing.Any = { "agreement": None, - "agreement_filtered": None, + "agreement_selected": None, "annotations": None, "annotations_ids": None, "annotations_results": None, @@ -394,7 +394,7 @@ async def test_delete(client: LabelStudio, async_client: AsyncLabelStudio) -> No async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> None: expected_response: typing.Any = { "agreement": "agreement", - "agreement_filtered": "agreement_filtered", + "agreement_selected": "agreement_selected", "annotations": "annotations", "annotations_ids": "annotations_ids", "annotations_results": "annotations_results", @@ -452,7 +452,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No } expected_types: typing.Any = { "agreement": None, - "agreement_filtered": None, + "agreement_selected": None, "annotations": None, "annotations_ids": None, "annotations_results": None,