@@ -304,6 +304,7 @@ def update_properties_in_project(
304304 title : Optional [str ] = None ,
305305 use_honeypot : Optional [bool ] = None ,
306306 metadata_types : Optional [dict ] = None ,
307+ metadata_properties : Optional [dict ] = None ,
307308 seconds_to_label_before_auto_assign : Optional [int ] = None ,
308309 should_auto_assign : Optional [bool ] = None ,
309310 ) -> Dict [str , Any ]:
@@ -339,36 +340,59 @@ def update_properties_in_project(
339340 in honeypot or consensus settings
340341 title: Title of the project
341342 use_honeypot: Activate / Deactivate the use of honeypot in the project
342- metadata_types: Types of the project metadata.
343+ metadata_types: DEPRECATED. Types of the project metadata.
343344 Should be a `dict` of metadata fields name as keys and metadata types as values.
344345 Currently, possible types are: `string`, `number`
346+ metadata_properties: Properties of the project metadata.
347+ Should be a `dict` of metadata fields name as keys and metadata properties as values.
348+ Each property is a dict with the following keys:
349+ - `type`: Type of the metadata. Currently, possible types are: `string`, `number`
350+ - `filterable`: If `True`, the metadata can be used as filters in project queue
351+ - `visibleByLabeler`: If `True`, the metadata is visible one the asset by labelers
352+ - `visibleByReviewer`: If `True`, the metadata is visible one the asset by reviewers
345353 seconds_to_label_before_auto_assign: DEPRECATED, use `should_auto_assign` instead.
346354 should_auto_assign: If `True`, assets are automatically assigned to users when they start annotating.
347355
348356 Returns:
349357 A dict with the changed properties which indicates if the mutation was successful,
350358 else an error message.
351359
352- !!! example "Change Metadata Types "
353- Metadata fields are by default interpreted as `string` types. To change the type
354- of a metadata field, you can use the `update_properties_in_project` function with the
355- metadata_types argument. `metadata_types ` is given as a dict of metadata field names
356- as keys and metadata types as values.
360+ !!! example "Change Metadata Properties "
361+ Metadata fields are by default interpreted as `string` types and have default properties.
362+ To change the properties of a metadata field, you can use the `update_properties_in_project`
363+ function with the `metadata_properties` argument. `metadata_properties ` is given as a dict
364+ of metadata field names as keys and metadata properties as values.
357365
358366 ```python
359367 kili.update_properties_in_project(
360368 project_id = project_id,
361- metadata_types = {
362- 'customConsensus': 'number',
363- 'sensitiveData': 'string',
364- 'uploadedFromCloud': 'string',
365- 'modelLabelErrorScore': 'number'
369+ metadata_properties = {
370+ 'customConsensus': {
371+ 'filterable': True,
372+ 'type': 'number',
373+ 'visibleByLabeler': True,
374+ 'visibleByReviewer': True,
375+ },
376+ 'sensitiveData': {
377+ 'filterable': True,
378+ 'type': 'string',
379+ 'visibleByLabeler': False,
380+ 'visibleByReviewer': True,
381+ }
366382 }
367383 )
368384 ```
369385
370- Not providing a type for a metadata field or providing an unsupported one
371- will default to the `string` type.
386+ Not providing a property or providing an unsupported one will use the default values:
387+ ```
388+ filterable: True
389+ type: 'string'
390+ visibleByLabeler: True
391+ visibleByReviewer: True
392+ ```
393+
394+ !!! note "Deprecated: Change Metadata Types"
395+ The `metadata_types` parameter is deprecated. Please use `metadata_properties` instead.
372396 """
373397 if seconds_to_label_before_auto_assign is not None :
374398 warnings .warn (
@@ -378,6 +402,14 @@ def update_properties_in_project(
378402 stacklevel = 1 ,
379403 )
380404
405+ if metadata_types is not None :
406+ warnings .warn (
407+ "metadata_types is going to be deprecated. Please use"
408+ " `metadata_properties` field instead to configure metadata properties." ,
409+ DeprecationWarning ,
410+ stacklevel = 1 ,
411+ )
412+
381413 return ProjectUseCases (self .kili_api_gateway ).update_properties_in_project (
382414 ProjectId (project_id ),
383415 can_navigate_between_assets = can_navigate_between_assets ,
@@ -400,6 +432,7 @@ def update_properties_in_project(
400432 use_honeypot = use_honeypot ,
401433 title = title ,
402434 metadata_types = metadata_types ,
435+ metadata_properties = metadata_properties ,
403436 should_auto_assign = should_auto_assign ,
404437 seconds_to_label_before_auto_assign = seconds_to_label_before_auto_assign ,
405438 )
0 commit comments