11"""Client presentation methods for projects."""
2-
32import warnings
43from typing import (
54 Any ,
1615from typeguard import typechecked
1716
1817from kili .adapters .kili_api_gateway .helpers .queries import QueryOptions
19- from kili .core .enums import ProjectType
18+ from kili .core .enums import DemoProjectType , ProjectType
2019from kili .domain .project import ComplianceTag , InputType , ProjectFilters , ProjectId
2120from kili .domain .tag import TagId
2221from kili .domain .types import ListOrTuple
22+ from kili .exceptions import IncompatibleArgumentsError
2323from kili .presentation .client .helpers .common_validators import (
2424 disable_tqdm_if_as_generator ,
2525)
@@ -46,6 +46,7 @@ def create_project(
4646 project_type : Optional [ProjectType ] = None ,
4747 tags : Optional [ListOrTuple [str ]] = None ,
4848 compliance_tags : Optional [ListOrTuple [ComplianceTag ]] = None ,
49+ from_demo_project : Optional [DemoProjectType ] = None ,
4950 ) -> Dict [Literal ["id" ], str ]:
5051 """Create a project.
5152
@@ -55,34 +56,31 @@ def create_project(
5556 title: Title of the project.
5657 description: Description of the project.
5758 project_id: Identifier of the project to copy.
58- project_type: Currently, one of:
59-
60- - `IMAGE_CLASSIFICATION_MULTI`
61- - `IMAGE_CLASSIFICATION_SINGLE`
62- - `IMAGE_OBJECT_DETECTION_POLYGON`
63- - `IMAGE_OBJECT_DETECTION_RECTANGLE`
64- - `IMAGE_OBJECT_DETECTION_SEMANTIC`
65- - `IMAGE_POSE_ESTIMATION`
66- - `OCR`
67- - `PDF_CLASSIFICATION_MULTI`
68- - `PDF_CLASSIFICATION_SINGLE`
69- - `PDF_NAMED_ENTITY_RECOGNITION`
70- - `PDF_OBJECT_DETECTION_RECTANGLE`
71- - `SPEECH_TO_TEXT`
72- - `TEXT_CLASSIFICATION_MULTI`
73- - `TEXT_CLASSIFICATION_SINGLE`
74- - `TEXT_NER`
75- - `TEXT_TRANSCRIPTION`
76- - `TIME_SERIES`
77- - `VIDEO_CLASSIFICATION_SINGLE`
78- - `VIDEO_FRAME_CLASSIFICATION`
79- - `VIDEO_FRAME_OBJECT_TRACKING`
80-
59+ project_type: Will be deprecated soon, use from_demo_project instead.
8160 tags: Tags to add to the project. The tags must already exist in the organization.
8261 compliance_tags: Compliance tags of the project.
8362 Compliance tags are used to categorize projects based on the sensitivity of
8463 the data being handled and the legal constraints associated with it.
8564 Possible values are: `PHI` and `PII`.
65+ from_demo_project: Currently, one of:
66+
67+ - `DEMO_COMPUTER_VISION_TUTORIAL`
68+ - `DEMO_TEXT_TUTORIAL`
69+ - `DEMO_PDF_TUTORIAL`
70+ - `VIDEO_FRAME_OBJECT_TRACKING`
71+ - `DEMO_SEGMENTATION_COCO`
72+ - `DEMO_NER`
73+ - `DEMO_ID_OCR`
74+ - `DEMO_REVIEWS`
75+ - `DEMO_OCR`
76+ - `DEMO_NER_TWEETS`
77+ - `DEMO_PLASTIC`
78+ - `DEMO_CHATBOT`
79+ - `DEMO_PDF`
80+ - `DEMO_ANIMALS`
81+ - `DEMO_LLM`
82+ - `DEMO_LLM_INSTR_FOLLOWING`
83+ - `DEMO_SEGMENTATION`
8684
8785 Returns:
8886 A dict with the id of the created project.
@@ -94,6 +92,18 @@ def create_project(
9492 For more detailed examples on how to create projects,
9593 see [the recipe](https://docs.kili-technology.com/recipes/creating-a-project).
9694 """
95+ if project_type is not None :
96+ warnings .warn (
97+ "Parameter project_type will be soon deprecated, please use from_demo_project instead." ,
98+ DeprecationWarning ,
99+ stacklevel = 1 ,
100+ )
101+
102+ if project_type is not None and from_demo_project is not None :
103+ raise IncompatibleArgumentsError (
104+ "Either provide project_type or from_demo_project. Not both at the same time."
105+ )
106+
97107 project_id = ProjectUseCases (self .kili_api_gateway ).create_project (
98108 input_type = input_type ,
99109 json_interface = json_interface ,
@@ -102,6 +112,7 @@ def create_project(
102112 project_id = project_id ,
103113 project_type = project_type ,
104114 compliance_tags = compliance_tags ,
115+ from_demo_project = from_demo_project ,
105116 )
106117
107118 if tags is not None :
0 commit comments