From 206046e664666da63fd87caf923d3598a3590771 Mon Sep 17 00:00:00 2001 From: nupursharma-labellerr Date: Tue, 2 Dec 2025 12:55:11 +0530 Subject: [PATCH 1/3] [LABIMP-8415] Added text based project support : --- labellerr/core/projects/__init__.py | 2 ++ labellerr/core/projects/text_project.py | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 labellerr/core/projects/text_project.py diff --git a/labellerr/core/projects/__init__.py b/labellerr/core/projects/__init__.py index 2c737be..89ba938 100644 --- a/labellerr/core/projects/__init__.py +++ b/labellerr/core/projects/__init__.py @@ -10,6 +10,7 @@ from .document_project import DocucmentProject as LabellerrDocumentProject from .image_project import ImageProject as LabellerrImageProject from .video_project import VideoProject as LabellerrVideoProject +from .text_project import TextProject as LabellerrTextProject from .base import LabellerrProject from ..annotation_templates import LabellerrAnnotationTemplate from typing import List @@ -20,6 +21,7 @@ "LabellerrDocumentProject", "LabellerrImageProject", "LabellerrVideoProject", + "LabellerrTextProject", ] diff --git a/labellerr/core/projects/text_project.py b/labellerr/core/projects/text_project.py new file mode 100644 index 0000000..904f136 --- /dev/null +++ b/labellerr/core/projects/text_project.py @@ -0,0 +1,9 @@ +from .base import LabellerrProject, LabellerrProjectMeta + + +class TextProject(LabellerrProject): + + pass + + +LabellerrProjectMeta._register("text", TextProject) From 01adf9a794652acb28dc1e322742c58d169cfc1d Mon Sep 17 00:00:00 2001 From: nupursharma-labellerr Date: Tue, 9 Dec 2025 11:36:35 +0530 Subject: [PATCH 2/3] [LABIMP-8422] List templates API integration --- .../core/annotation_templates/__init__.py | 31 ++++++++++++++++++- labellerr/core/annotation_templates/base.py | 28 +++++++++++++++-- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/labellerr/core/annotation_templates/__init__.py b/labellerr/core/annotation_templates/__init__.py index f89441b..f807b2c 100644 --- a/labellerr/core/annotation_templates/__init__.py +++ b/labellerr/core/annotation_templates/__init__.py @@ -1,8 +1,15 @@ from .base import LabellerrAnnotationTemplate -from ..schemas.annotation_templates import CreateTemplateParams, QuestionType, Option +from ..schemas.annotation_templates import ( + CreateTemplateParams, + QuestionType, + Option, + DatasetDataType, +) from .. import constants from ..client import LabellerrClient import uuid +from typing import List + __all__ = [ "LabellerrAnnotationTemplate", @@ -62,3 +69,25 @@ def create_template( client=client, annotation_template_id=response.get("response", None).get("template_id"), ) + + +def list_templates( + client: LabellerrClient, data_type: DatasetDataType +) -> List[LabellerrAnnotationTemplate]: + """ """ + unique_id = str(uuid.uuid4()) + url = ( + f"{constants.BASE_URL}/annotations/list_questions_templates?client_id={client.client_id}&data_type={data_type}" + f"&uuid={unique_id}" + ) + + response = client.make_request( + "GET", + url, + extra_headers={"content-type": "application/json"}, + request_id=unique_id, + ) + return [ + LabellerrAnnotationTemplate(client, item.get("template_id")) + for item in response.get("response", []) + ] diff --git a/labellerr/core/annotation_templates/base.py b/labellerr/core/annotation_templates/base.py index 21a24af..8622197 100644 --- a/labellerr/core/annotation_templates/base.py +++ b/labellerr/core/annotation_templates/base.py @@ -45,6 +45,28 @@ def __new__(cls, client: "LabellerrClient", annotation_template_id: str): def __init__(self, client: "LabellerrClient", annotation_template_id: str): self.client = client - self.annotation_template_id = annotation_template_id - # Use the data already fetched in __new__ - self.annotation_template_data = self.__annotation_template_data + self.__annotation_template_id = annotation_template_id + + @property + def template_name(self): + return self.__annotation_template_data.get("template_name") + + @property + def data_type(self): + return self.__annotation_template_data.get("data_type") + + @property + def template_id(self): + return self.__annotation_template_id + + @property + def created_at(self): + return self.__annotation_template_data.get("created_at") + + @property + def created_by(self): + return self.__annotation_template_data.get("created_by") + + @property + def questions(self): + return self.__annotation_template_data.get("questions") From 92f3b60e50dc9b3f03c3a661de478f50ce5bc715 Mon Sep 17 00:00:00 2001 From: nupursharma-labellerr Date: Thu, 11 Dec 2025 12:40:26 +0530 Subject: [PATCH 3/3] [LABIMP-8483] Updated the property to annotation_template_id --- labellerr/core/annotation_templates/base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/labellerr/core/annotation_templates/base.py b/labellerr/core/annotation_templates/base.py index 8622197..ea00cfc 100644 --- a/labellerr/core/annotation_templates/base.py +++ b/labellerr/core/annotation_templates/base.py @@ -48,15 +48,15 @@ def __init__(self, client: "LabellerrClient", annotation_template_id: str): self.__annotation_template_id = annotation_template_id @property - def template_name(self): - return self.__annotation_template_data.get("template_name") + def annotation_template_name(self): + return self.__annotation_template_data.get("annotation_template_name") @property - def data_type(self): - return self.__annotation_template_data.get("data_type") + def annotation_data_type(self): + return self.__annotation_template_data.get("annotation_data_type") @property - def template_id(self): + def annotation_template_id(self): return self.__annotation_template_id @property