diff --git a/generated/model.py b/generated/model.py index 24a7d303..910ad20a 100644 --- a/generated/model.py +++ b/generated/model.py @@ -87,4 +87,4 @@ class PaginatedImageQueryList(BaseModel): count: Optional[int] = Field(None, example=123) next: Optional[AnyUrl] = Field(None, example="http://api.example.org/accounts/?page=4") previous: Optional[AnyUrl] = Field(None, example="http://api.example.org/accounts/?page=2") - results: Optional[List[ImageQuery]] = None + results: Optional[List[ImageQuery]] = None \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ac492e15..fdb4d9d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ packages = [ {include = "**/*.py", from = "src"}, ] readme = "README.md" -version = "0.13.0" +version = "0.13.1" [tool.poetry.dependencies] # For certifi, use ">=" instead of "^" since it upgrades its "major version" every year, not really following semver diff --git a/src/groundlight/internalapi.py b/src/groundlight/internalapi.py index 69f93168..2e2f95ef 100644 --- a/src/groundlight/internalapi.py +++ b/src/groundlight/internalapi.py @@ -4,6 +4,7 @@ import random import time import uuid +from enum import Enum from functools import wraps from typing import Callable, Dict, Optional, Union from urllib.parse import urlsplit, urlunsplit @@ -155,6 +156,12 @@ def decorated(*args, **kwargs): # pylint: disable=inconsistent-return-statement return decorated +# ReviewReasons are reasons a label was created. A review reason is a required field when posting a human label +# to the API. The only review reason currently supported on the SDK is CUSTOMER_INITIATED. +class ReviewReason(str, Enum): # noqa: N801 + CUSTOMER_INITIATED = "CUSTOMER_INITIATED" + + class GroundlightApiClient(ApiClient): """Subclassing the OpenAPI-generated ApiClient to add a bit of custom functionality. Not crazy about using polymorphism, but this is simpler than modifying the moustache @@ -199,10 +206,7 @@ def _add_label(self, image_query_id: str, label: str) -> dict: start_time = time.time() url = f"{self.configuration.host}/labels" - data = { - "label": label, - "posicheck_id": image_query_id, - } + data = {"label": label, "posicheck_id": image_query_id, "review_reason": ReviewReason.CUSTOMER_INITIATED} headers = self._headers()