From f5f2b41fdf9357ed55ef546923722d8d8bfa6b4a Mon Sep 17 00:00:00 2001 From: brandon Date: Mon, 26 Aug 2024 11:03:26 -0700 Subject: [PATCH] Make human_review available in ask_ml. Such a counterintuitive statement tells us we may need to re-review the intended mental model of using the sdk --- src/groundlight/client.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 35eca62b..5e26bae1 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -540,6 +540,7 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca detector: Union[Detector, str], image: Union[str, bytes, Image.Image, BytesIO, BufferedReader, np.ndarray], wait: Optional[float] = None, + human_review: Optional[str] = None, metadata: Union[dict, str, None] = None, inspection_id: Optional[str] = None, ) -> ImageQuery: @@ -559,6 +560,14 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca :param wait: How long to wait (in seconds) for any answer. + :param human_review: While ask_ml will return the first answer Groundlight can provide, + human_review will control whether the image is sent for human review later to improve + the model going forward. + If `None` or `DEFAULT`, send the image query for human review + only if the ML prediction is not confident. + If set to `ALWAYS`, always send the image query for human review. + If set to `NEVER`, never send the image query for human review. + :param metadata: A dictionary or JSON string of custom key/value metadata to associate with the image query (limited to 1KB). You can retrieve this metadata later by calling `get_image_query()`. @@ -569,6 +578,7 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca detector, image, wait=0, + human_review=human_review, metadata=metadata, inspection_id=inspection_id, )