Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions labellerr/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# labellerr/client.py

import re
import requests
import uuid
from .exceptions import LabellerrError
Expand Down Expand Up @@ -1038,12 +1038,17 @@ def initiate_create_project(self, payload):
result = {}
# validate all the parameters
required_params = ['client_id', 'dataset_name', 'dataset_description', 'data_type', 'created_by', 'project_name','autolabel']
required_params = ['client_id', 'dataset_name', 'dataset_description', 'data_type', 'created_by', 'project_name','autolabel']
for param in required_params:
if param not in payload:
raise LabellerrError(f"Required parameter {param} is missing")
if param == 'client_id' and not isinstance(payload[param], str):
raise LabellerrError("client_id must be a non-empty string")

email = payload.get("created_by")
if not re.match(r"^[^@]+@[^@]+\.[^@]+$", email or ""):
raise LabellerrError("Please enter email id in created_by")

# annotation_guide is only required if annotation_template_id is not provided
if not payload.get('annotation_template_id'):
if 'annotation_guide' not in payload:
Expand All @@ -1054,7 +1059,7 @@ def initiate_create_project(self, payload):
if guide['option_type'] not in OPTION_TYPE_LIST:
raise LabellerrError(f"option_type must be one of {OPTION_TYPE_LIST}")


if 'folder_to_upload' in payload and 'files_to_upload' in payload:
raise LabellerrError("Cannot provide both files_to_upload and folder_to_upload")

Expand Down