From cb83e7b9fd1db630d9a8c59e9d389995261e8aa4 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Wed, 30 Oct 2024 22:33:44 +0000 Subject: [PATCH 01/18] update spec and add image_query_id param --- spec/public-api.yaml | 17 +++++++++-------- src/groundlight/client.py | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/spec/public-api.yaml b/spec/public-api.yaml index 5b18cf7f..b227293d 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -1,7 +1,7 @@ openapi: 3.0.3 info: title: Groundlight API - version: 0.18.1 + version: 0.18.2 description: Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. @@ -336,18 +336,16 @@ paths: description: '' post: operationId: Submit image query - description: |2+ + description: |2 Submit an image query against a detector. - You must use `"Content-Type: image/jpeg"` for the image data. For example: - + You must use `"Content-Type: image/jpeg"` or similar (image/png, image/webp, etc) for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \ --header "Content-Type: image/jpeg" \ --data-binary @path/to/filename.jpeg ``` - parameters: - in: query name: detector_id @@ -363,6 +361,11 @@ paths: If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. + - in: query + name: image_query_id + schema: + type: string + description: The ID to assign to the created image query. - in: query name: inspection_id schema: @@ -995,6 +998,7 @@ components: - confidence - created_at - detector_id + - source - text LabelValueRequest: type: object @@ -1330,7 +1334,6 @@ components: minimum: 0.0 maximum: 1.0 source: - description: Source is optional to support edge v0.2 type: string enum: - STILL_PROCESSING @@ -1355,7 +1358,6 @@ components: minimum: 0.0 maximum: 1.0 source: - description: Source is optional to support edge v0.2 type: string enum: - STILL_PROCESSING @@ -1380,7 +1382,6 @@ components: minimum: 0.0 maximum: 1.0 source: - description: Source is optional to support edge v0.2 type: string enum: - STILL_PROCESSING diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 8f520e73..43477145 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -441,6 +441,7 @@ def submit_image_query( # noqa: PLR0913 # pylint: disable=too-many-arguments, t want_async: bool = False, inspection_id: Optional[str] = None, metadata: Union[dict, str, None] = None, + image_query_id: Optional[str] = None, ) -> ImageQuery: """ Evaluates an image with Groundlight. @@ -482,6 +483,9 @@ def submit_image_query( # noqa: PLR0913 # pylint: disable=too-many-arguments, t the image query (limited to 1KB). You can retrieve this metadata later by calling `get_image_query()`. + :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended + for general external use. If not set, a random ID will be generated. + :return: ImageQuery """ if wait is None: @@ -516,6 +520,9 @@ def submit_image_query( # noqa: PLR0913 # pylint: disable=too-many-arguments, t # which means we need to put the metadata in the query string. To do that safely, we # url- and base64-encode the metadata. params["metadata"] = url_encode_dict(metadata, name="metadata", size_limit_bytes=1024) + + if image_query_id is not None: + params["image_query_id"] = image_query_id raw_image_query = self.image_queries_api.submit_image_query(**params) image_query = ImageQuery.parse_obj(raw_image_query.to_dict()) @@ -536,6 +543,7 @@ def ask_confident( # noqa: PLR0913 # pylint: disable=too-many-arguments confidence_threshold: Optional[float] = None, wait: Optional[float] = None, metadata: Union[dict, str, None] = None, + image_query_id: Optional[str] = None, inspection_id: Optional[str] = None, ) -> ImageQuery: """ @@ -561,6 +569,9 @@ def ask_confident( # noqa: PLR0913 # pylint: disable=too-many-arguments :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()`. + + :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended + for general external use. If not set, a random ID will be generated. :return: ImageQuery """ @@ -572,6 +583,7 @@ def ask_confident( # noqa: PLR0913 # pylint: disable=too-many-arguments patience_time=wait, human_review=None, metadata=metadata, + image_query_id=image_query_id, inspection_id=inspection_id, ) @@ -581,6 +593,7 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca image: Union[str, bytes, Image.Image, BytesIO, BufferedReader, np.ndarray], wait: Optional[float] = None, metadata: Union[dict, str, None] = None, + image_query_id: Optional[str] = None, inspection_id: Optional[str] = None, ) -> ImageQuery: """ @@ -602,6 +615,9 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca :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()`. + + :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended + for general external use. If not set, a random ID will be generated. :return: ImageQuery """ @@ -610,6 +626,7 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca image, wait=0, metadata=metadata, + image_query_id=image_query_id, inspection_id=inspection_id, ) if iq_is_answered(iq): @@ -625,6 +642,7 @@ def ask_async( # noqa: PLR0913 # pylint: disable=too-many-arguments confidence_threshold: Optional[float] = None, human_review: Optional[str] = None, metadata: Union[dict, str, None] = None, + image_query_id: Optional[str] = None, inspection_id: Optional[str] = None, ) -> ImageQuery: """ @@ -664,6 +682,9 @@ def ask_async( # noqa: PLR0913 # pylint: disable=too-many-arguments :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()`. + + :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended + for general external use. If not set, a random ID will be generated. :return: ImageQuery @@ -708,6 +729,7 @@ def ask_async( # noqa: PLR0913 # pylint: disable=too-many-arguments human_review=human_review, want_async=True, metadata=metadata, + image_query_id=image_query_id, inspection_id=inspection_id, ) From f0e844914baa809eb6395df84b033a7b66af0d35 Mon Sep 17 00:00:00 2001 From: Auto-format Bot Date: Wed, 30 Oct 2024 22:34:35 +0000 Subject: [PATCH 02/18] Automatically reformatting code --- src/groundlight/client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 43477145..9a8f9a2b 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -520,7 +520,7 @@ def submit_image_query( # noqa: PLR0913 # pylint: disable=too-many-arguments, t # which means we need to put the metadata in the query string. To do that safely, we # url- and base64-encode the metadata. params["metadata"] = url_encode_dict(metadata, name="metadata", size_limit_bytes=1024) - + if image_query_id is not None: params["image_query_id"] = image_query_id @@ -569,7 +569,7 @@ def ask_confident( # noqa: PLR0913 # pylint: disable=too-many-arguments :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()`. - + :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended for general external use. If not set, a random ID will be generated. @@ -615,7 +615,7 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca :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()`. - + :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended for general external use. If not set, a random ID will be generated. @@ -682,7 +682,7 @@ def ask_async( # noqa: PLR0913 # pylint: disable=too-many-arguments :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()`. - + :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended for general external use. If not set, a random ID will be generated. From 411a1056f30acb337441da61c825f3acd786a5f7 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Wed, 30 Oct 2024 22:42:48 +0000 Subject: [PATCH 03/18] whitespace --- src/groundlight/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 43477145..f53fb885 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -520,7 +520,7 @@ def submit_image_query( # noqa: PLR0913 # pylint: disable=too-many-arguments, t # which means we need to put the metadata in the query string. To do that safely, we # url- and base64-encode the metadata. params["metadata"] = url_encode_dict(metadata, name="metadata", size_limit_bytes=1024) - + if image_query_id is not None: params["image_query_id"] = image_query_id From 62eb124e343ed7a36e8f9471a689f8fce4f04616 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Wed, 30 Oct 2024 22:58:47 +0000 Subject: [PATCH 04/18] add simple test --- test/integration/test_groundlight.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index 85a472c2..f7d9439f 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -23,6 +23,7 @@ PaginatedDetectorList, PaginatedImageQueryList, ) +from ksuid import KsuidMs DEFAULT_CONFIDENCE_THRESHOLD = 0.9 IQ_IMPROVEMENT_THRESHOLD = 0.75 @@ -320,6 +321,16 @@ def test_submit_image_query_png(gl: Groundlight, detector: Detector): assert is_valid_display_result(_image_query.result) +def test_submit_image_query_with_id(gl: Groundlight, detector: Detector): + id = f"iq_{KsuidMs()}" + _image_query = gl.submit_image_query( + detector=detector.id, image="test/assets/dog.jpeg", wait=10, human_review="NEVER", image_query_id=id + ) + assert str(_image_query) + assert isinstance(_image_query, ImageQuery) + assert is_valid_display_result(_image_query.result) + + def test_submit_image_query_with_human_review_param(gl: Groundlight, detector: Detector): # For now, this just tests that the image query is submitted successfully. # There should probably be a better way to check whether the image query was escalated for human review. From 6efe7eb7f95ae393185069727931790e6fc22b8a Mon Sep 17 00:00:00 2001 From: Auto-format Bot Date: Wed, 30 Oct 2024 22:59:32 +0000 Subject: [PATCH 05/18] Automatically reformatting code --- test/integration/test_groundlight.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index f7d9439f..7a47b3c2 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -15,6 +15,7 @@ from groundlight.internalapi import InternalApiError, NotFoundError from groundlight.optional_imports import * from groundlight.status_codes import is_user_error +from ksuid import KsuidMs from model import ( BinaryClassificationResult, CountingResult, @@ -23,7 +24,6 @@ PaginatedDetectorList, PaginatedImageQueryList, ) -from ksuid import KsuidMs DEFAULT_CONFIDENCE_THRESHOLD = 0.9 IQ_IMPROVEMENT_THRESHOLD = 0.75 From dfc5342b237d5a686ebf4a97e6c6100388c5cd64 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Wed, 30 Oct 2024 23:01:25 +0000 Subject: [PATCH 06/18] move ksuid to dev deps --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index ed154e3c..accefdbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ pytest = "^7.0.1" pytest-cov = "^3.0.0" pytest-markdown-docs = "^0.4.3" pytest-mock = "^3.10.0" +svix-ksuid = "^0.6.2" [tool.poetry.group.lint.dependencies] black = "^23.3.0" From 06c740f62a154a19a7e30761734cf03ab0aee43c Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Thu, 31 Oct 2024 16:50:33 +0000 Subject: [PATCH 07/18] push generated code --- generated/README.md | 2 +- generated/docs/BinaryClassificationResult.md | 2 +- generated/docs/CountingResult.md | 2 +- generated/docs/ImageQueriesApi.md | 6 ++-- generated/docs/LabelValue.md | 2 +- generated/docs/MultiClassificationResult.md | 2 +- .../groundlight_openapi_client/__init__.py | 2 +- .../api/actions_api.py | 2 +- .../api/detector_groups_api.py | 2 +- .../api/detector_reset_api.py | 2 +- .../api/detectors_api.py | 2 +- .../api/image_queries_api.py | 9 ++++-- .../api/labels_api.py | 2 +- .../api/notes_api.py | 2 +- .../api/user_api.py | 2 +- .../groundlight_openapi_client/api_client.py | 2 +- .../configuration.py | 4 +-- .../groundlight_openapi_client/exceptions.py | 2 +- .../model/action.py | 2 +- .../model/action_list.py | 2 +- .../model/all_notes.py | 2 +- .../model/annotations_requested_enum.py | 2 +- .../model/b_box_geometry.py | 2 +- .../model/b_box_geometry_request.py | 2 +- .../model/binary_classification_result.py | 6 ++-- .../model/blank_enum.py | 2 +- .../model/channel_enum.py | 2 +- .../model/condition.py | 2 +- .../model/condition_request.py | 2 +- .../model/count_mode_configuration.py | 2 +- .../model/counting_result.py | 6 ++-- .../model/detector.py | 2 +- .../model/detector_creation_input_request.py | 2 +- .../model/detector_group.py | 2 +- .../model/detector_group_request.py | 2 +- .../model/detector_type_enum.py | 2 +- .../model/escalation_type_enum.py | 2 +- .../model/image_query.py | 2 +- .../model/image_query_type_enum.py | 2 +- .../model/inline_response200.py | 2 +- .../model/label_value.py | 28 +++++++++---------- .../model/label_value_request.py | 2 +- .../model/mode_enum.py | 2 +- .../model/multi_class_mode_configuration.py | 2 +- .../model/multi_classification_result.py | 6 ++-- .../groundlight_openapi_client/model/note.py | 2 +- .../model/note_request.py | 2 +- .../model/paginated_detector_list.py | 2 +- .../model/paginated_image_query_list.py | 2 +- .../model/paginated_rule_list.py | 2 +- .../model/patched_detector_request.py | 2 +- .../model/result_type_enum.py | 2 +- .../groundlight_openapi_client/model/roi.py | 2 +- .../model/roi_request.py | 2 +- .../groundlight_openapi_client/model/rule.py | 2 +- .../model/rule_request.py | 2 +- .../model/snooze_time_unit_enum.py | 2 +- .../model/source_enum.py | 2 +- .../model/status_enum.py | 2 +- .../model/verb_enum.py | 2 +- .../groundlight_openapi_client/model_utils.py | 2 +- generated/groundlight_openapi_client/rest.py | 2 +- generated/model.py | 14 ++++------ generated/setup.py | 2 +- 64 files changed, 97 insertions(+), 94 deletions(-) diff --git a/generated/README.md b/generated/README.md index 22aa3842..bd5fe9eb 100644 --- a/generated/README.md +++ b/generated/README.md @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 0.18.1 +- API version: 0.18.2 - Package version: 1.0.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen diff --git a/generated/docs/BinaryClassificationResult.md b/generated/docs/BinaryClassificationResult.md index 655da3ab..f8dc4656 100644 --- a/generated/docs/BinaryClassificationResult.md +++ b/generated/docs/BinaryClassificationResult.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **label** | **str** | | **confidence** | **float** | | [optional] -**source** | **str** | Source is optional to support edge v0.2 | [optional] +**source** | **str** | | [optional] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/CountingResult.md b/generated/docs/CountingResult.md index dcf8d6da..b5f32515 100644 --- a/generated/docs/CountingResult.md +++ b/generated/docs/CountingResult.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **count** | **int** | | **confidence** | **float** | | [optional] -**source** | **str** | Source is optional to support edge v0.2 | [optional] +**source** | **str** | | [optional] **greater_than_max** | **bool** | | [optional] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] diff --git a/generated/docs/ImageQueriesApi.md b/generated/docs/ImageQueriesApi.md index 39f0eb20..3d6cd5b8 100644 --- a/generated/docs/ImageQueriesApi.md +++ b/generated/docs/ImageQueriesApi.md @@ -248,7 +248,7 @@ Name | Type | Description | Notes - Submit an image query against a detector. You must use `\"Content-Type: image/jpeg\"` for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \\ --header \"Content-Type: image/jpeg\" \\ --data-binary @path/to/filename.jpeg ``` + Submit an image query against a detector. You must use `\"Content-Type: image/jpeg\"` or similar (image/png, image/webp, etc) for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \\ --header \"Content-Type: image/jpeg\" \\ --data-binary @path/to/filename.jpeg ``` ### Example @@ -283,6 +283,7 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: api_instance = image_queries_api.ImageQueriesApi(api_client) detector_id = "detector_id_example" # str | Choose a detector by its ID. human_review = "human_review_example" # str | If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. (optional) + image_query_id = "image_query_id_example" # str | The ID to assign to the created image query. (optional) inspection_id = "inspection_id_example" # str | Associate the image query with an inspection. (optional) metadata = "metadata_example" # str | A dictionary of custom key/value metadata to associate with the image query (limited to 1KB). (optional) patience_time = 3.14 # float | How long to wait for a confident response. (optional) @@ -299,7 +300,7 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: # example passing only required values which don't have defaults set # and optional values try: - api_response = api_instance.submit_image_query(detector_id, human_review=human_review, inspection_id=inspection_id, metadata=metadata, patience_time=patience_time, want_async=want_async, body=body) + api_response = api_instance.submit_image_query(detector_id, human_review=human_review, image_query_id=image_query_id, inspection_id=inspection_id, metadata=metadata, patience_time=patience_time, want_async=want_async, body=body) pprint(api_response) except groundlight_openapi_client.ApiException as e: print("Exception when calling ImageQueriesApi->submit_image_query: %s\n" % e) @@ -312,6 +313,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **detector_id** | **str**| Choose a detector by its ID. | **human_review** | **str**| If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. | [optional] + **image_query_id** | **str**| The ID to assign to the created image query. | [optional] **inspection_id** | **str**| Associate the image query with an inspection. | [optional] **metadata** | **str**| A dictionary of custom key/value metadata to associate with the image query (limited to 1KB). | [optional] **patience_time** | **float**| How long to wait for a confident response. | [optional] diff --git a/generated/docs/LabelValue.md b/generated/docs/LabelValue.md index 4869e48c..acbb0e6f 100644 --- a/generated/docs/LabelValue.md +++ b/generated/docs/LabelValue.md @@ -9,9 +9,9 @@ Name | Type | Description | Notes **annotations_requested** | **[bool, date, datetime, dict, float, int, list, str, none_type]** | | [readonly] **created_at** | **datetime** | | [readonly] **detector_id** | **int, none_type** | | [readonly] +**source** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [readonly] **text** | **str, none_type** | Text annotations | [readonly] **rois** | [**[ROI], none_type**](ROI.md) | | [optional] -**source** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] [readonly] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/MultiClassificationResult.md b/generated/docs/MultiClassificationResult.md index 2ab36f78..4f401a3d 100644 --- a/generated/docs/MultiClassificationResult.md +++ b/generated/docs/MultiClassificationResult.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **label** | **str** | | **confidence** | **float** | | [optional] -**source** | **str** | Source is optional to support edge v0.2 | [optional] +**source** | **str** | | [optional] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/groundlight_openapi_client/__init__.py b/generated/groundlight_openapi_client/__init__.py index 3f67f120..ff1e9a1d 100644 --- a/generated/groundlight_openapi_client/__init__.py +++ b/generated/groundlight_openapi_client/__init__.py @@ -5,7 +5,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/api/actions_api.py b/generated/groundlight_openapi_client/api/actions_api.py index 0670bad0..47ac8d0d 100644 --- a/generated/groundlight_openapi_client/api/actions_api.py +++ b/generated/groundlight_openapi_client/api/actions_api.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/api/detector_groups_api.py b/generated/groundlight_openapi_client/api/detector_groups_api.py index 89e739ff..83a2cb4f 100644 --- a/generated/groundlight_openapi_client/api/detector_groups_api.py +++ b/generated/groundlight_openapi_client/api/detector_groups_api.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/api/detector_reset_api.py b/generated/groundlight_openapi_client/api/detector_reset_api.py index 7662bbf8..c50532f8 100644 --- a/generated/groundlight_openapi_client/api/detector_reset_api.py +++ b/generated/groundlight_openapi_client/api/detector_reset_api.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/api/detectors_api.py b/generated/groundlight_openapi_client/api/detectors_api.py index e054c2c5..a46e110f 100644 --- a/generated/groundlight_openapi_client/api/detectors_api.py +++ b/generated/groundlight_openapi_client/api/detectors_api.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/api/image_queries_api.py b/generated/groundlight_openapi_client/api/image_queries_api.py index ebf133a9..d9925f9d 100644 --- a/generated/groundlight_openapi_client/api/image_queries_api.py +++ b/generated/groundlight_openapi_client/api/image_queries_api.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -171,6 +171,7 @@ def __init__(self, api_client=None): "all": [ "detector_id", "human_review", + "image_query_id", "inspection_id", "metadata", "patience_time", @@ -190,6 +191,7 @@ def __init__(self, api_client=None): "openapi_types": { "detector_id": (str,), "human_review": (str,), + "image_query_id": (str,), "inspection_id": (str,), "metadata": (str,), "patience_time": (float,), @@ -199,6 +201,7 @@ def __init__(self, api_client=None): "attribute_map": { "detector_id": "detector_id", "human_review": "human_review", + "image_query_id": "image_query_id", "inspection_id": "inspection_id", "metadata": "metadata", "patience_time": "patience_time", @@ -207,6 +210,7 @@ def __init__(self, api_client=None): "location_map": { "detector_id": "query", "human_review": "query", + "image_query_id": "query", "inspection_id": "query", "metadata": "query", "patience_time": "query", @@ -406,7 +410,7 @@ def list_image_queries(self, **kwargs): def submit_image_query(self, detector_id, **kwargs): """submit_image_query # noqa: E501 - Submit an image query against a detector. You must use `\"Content-Type: image/jpeg\"` for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \\ --header \"Content-Type: image/jpeg\" \\ --data-binary @path/to/filename.jpeg ``` # noqa: E501 + Submit an image query against a detector. You must use `\"Content-Type: image/jpeg\"` or similar (image/png, image/webp, etc) for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \\ --header \"Content-Type: image/jpeg\" \\ --data-binary @path/to/filename.jpeg ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True @@ -418,6 +422,7 @@ def submit_image_query(self, detector_id, **kwargs): Keyword Args: human_review (str): If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident.. [optional] + image_query_id (str): The ID to assign to the created image query.. [optional] inspection_id (str): Associate the image query with an inspection.. [optional] metadata (str): A dictionary of custom key/value metadata to associate with the image query (limited to 1KB).. [optional] patience_time (float): How long to wait for a confident response.. [optional] diff --git a/generated/groundlight_openapi_client/api/labels_api.py b/generated/groundlight_openapi_client/api/labels_api.py index 884151e4..fd948a9f 100644 --- a/generated/groundlight_openapi_client/api/labels_api.py +++ b/generated/groundlight_openapi_client/api/labels_api.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/api/notes_api.py b/generated/groundlight_openapi_client/api/notes_api.py index 6836fb2e..f6522e04 100644 --- a/generated/groundlight_openapi_client/api/notes_api.py +++ b/generated/groundlight_openapi_client/api/notes_api.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/api/user_api.py b/generated/groundlight_openapi_client/api/user_api.py index 66937738..fa851468 100644 --- a/generated/groundlight_openapi_client/api/user_api.py +++ b/generated/groundlight_openapi_client/api/user_api.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/api_client.py b/generated/groundlight_openapi_client/api_client.py index ac14fb86..da2e348a 100644 --- a/generated/groundlight_openapi_client/api_client.py +++ b/generated/groundlight_openapi_client/api_client.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/configuration.py b/generated/groundlight_openapi_client/configuration.py index 9aab02ac..654b832f 100644 --- a/generated/groundlight_openapi_client/configuration.py +++ b/generated/groundlight_openapi_client/configuration.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -419,7 +419,7 @@ def to_debug_report(self): "Python SDK Debug Report:\n" "OS: {env}\n" "Python Version: {pyversion}\n" - "Version of the API: 0.18.1\n" + "Version of the API: 0.18.2\n" "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version) ) diff --git a/generated/groundlight_openapi_client/exceptions.py b/generated/groundlight_openapi_client/exceptions.py index 5ab58207..393dbba8 100644 --- a/generated/groundlight_openapi_client/exceptions.py +++ b/generated/groundlight_openapi_client/exceptions.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/action.py b/generated/groundlight_openapi_client/model/action.py index 1199e0d8..8308d44b 100644 --- a/generated/groundlight_openapi_client/model/action.py +++ b/generated/groundlight_openapi_client/model/action.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/action_list.py b/generated/groundlight_openapi_client/model/action_list.py index 16954eef..a38fae04 100644 --- a/generated/groundlight_openapi_client/model/action_list.py +++ b/generated/groundlight_openapi_client/model/action_list.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/all_notes.py b/generated/groundlight_openapi_client/model/all_notes.py index aa96ed47..89da5af1 100644 --- a/generated/groundlight_openapi_client/model/all_notes.py +++ b/generated/groundlight_openapi_client/model/all_notes.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/annotations_requested_enum.py b/generated/groundlight_openapi_client/model/annotations_requested_enum.py index 5a4789bd..d951c99e 100644 --- a/generated/groundlight_openapi_client/model/annotations_requested_enum.py +++ b/generated/groundlight_openapi_client/model/annotations_requested_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/b_box_geometry.py b/generated/groundlight_openapi_client/model/b_box_geometry.py index 1bfa3d7a..2282dfd7 100644 --- a/generated/groundlight_openapi_client/model/b_box_geometry.py +++ b/generated/groundlight_openapi_client/model/b_box_geometry.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/b_box_geometry_request.py b/generated/groundlight_openapi_client/model/b_box_geometry_request.py index f23ce8d2..fcac579f 100644 --- a/generated/groundlight_openapi_client/model/b_box_geometry_request.py +++ b/generated/groundlight_openapi_client/model/b_box_geometry_request.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/binary_classification_result.py b/generated/groundlight_openapi_client/model/binary_classification_result.py index 3abe590e..b9cd17eb 100644 --- a/generated/groundlight_openapi_client/model/binary_classification_result.py +++ b/generated/groundlight_openapi_client/model/binary_classification_result.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -165,7 +165,7 @@ def _from_openapi_data(cls, label, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) confidence (float): [optional] # noqa: E501 - source (str): Source is optional to support edge v0.2. [optional] # noqa: E501 + source (str): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -255,7 +255,7 @@ def __init__(self, label, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) confidence (float): [optional] # noqa: E501 - source (str): Source is optional to support edge v0.2. [optional] # noqa: E501 + source (str): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) diff --git a/generated/groundlight_openapi_client/model/blank_enum.py b/generated/groundlight_openapi_client/model/blank_enum.py index d7a16227..aa466bb8 100644 --- a/generated/groundlight_openapi_client/model/blank_enum.py +++ b/generated/groundlight_openapi_client/model/blank_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/channel_enum.py b/generated/groundlight_openapi_client/model/channel_enum.py index 6590b1cc..720dac0d 100644 --- a/generated/groundlight_openapi_client/model/channel_enum.py +++ b/generated/groundlight_openapi_client/model/channel_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/condition.py b/generated/groundlight_openapi_client/model/condition.py index 7d67f28d..6e12ea64 100644 --- a/generated/groundlight_openapi_client/model/condition.py +++ b/generated/groundlight_openapi_client/model/condition.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/condition_request.py b/generated/groundlight_openapi_client/model/condition_request.py index 9ce8cd01..3172892a 100644 --- a/generated/groundlight_openapi_client/model/condition_request.py +++ b/generated/groundlight_openapi_client/model/condition_request.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/count_mode_configuration.py b/generated/groundlight_openapi_client/model/count_mode_configuration.py index e28e500e..25e7539d 100644 --- a/generated/groundlight_openapi_client/model/count_mode_configuration.py +++ b/generated/groundlight_openapi_client/model/count_mode_configuration.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/counting_result.py b/generated/groundlight_openapi_client/model/counting_result.py index 5c8daaa5..1bc61441 100644 --- a/generated/groundlight_openapi_client/model/counting_result.py +++ b/generated/groundlight_openapi_client/model/counting_result.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -162,7 +162,7 @@ def _from_openapi_data(cls, count, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) confidence (float): [optional] # noqa: E501 - source (str): Source is optional to support edge v0.2. [optional] # noqa: E501 + source (str): [optional] # noqa: E501 greater_than_max (bool): [optional] # noqa: E501 """ @@ -253,7 +253,7 @@ def __init__(self, count, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) confidence (float): [optional] # noqa: E501 - source (str): Source is optional to support edge v0.2. [optional] # noqa: E501 + source (str): [optional] # noqa: E501 greater_than_max (bool): [optional] # noqa: E501 """ diff --git a/generated/groundlight_openapi_client/model/detector.py b/generated/groundlight_openapi_client/model/detector.py index b7095d8a..04c6beb8 100644 --- a/generated/groundlight_openapi_client/model/detector.py +++ b/generated/groundlight_openapi_client/model/detector.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/detector_creation_input_request.py b/generated/groundlight_openapi_client/model/detector_creation_input_request.py index db38f022..42ea7e7e 100644 --- a/generated/groundlight_openapi_client/model/detector_creation_input_request.py +++ b/generated/groundlight_openapi_client/model/detector_creation_input_request.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/detector_group.py b/generated/groundlight_openapi_client/model/detector_group.py index 60350686..5620b0c9 100644 --- a/generated/groundlight_openapi_client/model/detector_group.py +++ b/generated/groundlight_openapi_client/model/detector_group.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/detector_group_request.py b/generated/groundlight_openapi_client/model/detector_group_request.py index cb98b8fe..3302860f 100644 --- a/generated/groundlight_openapi_client/model/detector_group_request.py +++ b/generated/groundlight_openapi_client/model/detector_group_request.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/detector_type_enum.py b/generated/groundlight_openapi_client/model/detector_type_enum.py index c20c0f96..94d446da 100644 --- a/generated/groundlight_openapi_client/model/detector_type_enum.py +++ b/generated/groundlight_openapi_client/model/detector_type_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/escalation_type_enum.py b/generated/groundlight_openapi_client/model/escalation_type_enum.py index 99c297d5..d28cb1ed 100644 --- a/generated/groundlight_openapi_client/model/escalation_type_enum.py +++ b/generated/groundlight_openapi_client/model/escalation_type_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/image_query.py b/generated/groundlight_openapi_client/model/image_query.py index 0d844e01..951ee454 100644 --- a/generated/groundlight_openapi_client/model/image_query.py +++ b/generated/groundlight_openapi_client/model/image_query.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/image_query_type_enum.py b/generated/groundlight_openapi_client/model/image_query_type_enum.py index 5c24a7f9..42470730 100644 --- a/generated/groundlight_openapi_client/model/image_query_type_enum.py +++ b/generated/groundlight_openapi_client/model/image_query_type_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/inline_response200.py b/generated/groundlight_openapi_client/model/inline_response200.py index 78d48bf3..7e25ac59 100644 --- a/generated/groundlight_openapi_client/model/inline_response200.py +++ b/generated/groundlight_openapi_client/model/inline_response200.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/label_value.py b/generated/groundlight_openapi_client/model/label_value.py index 9bce25b9..d2981b5d 100644 --- a/generated/groundlight_openapi_client/model/label_value.py +++ b/generated/groundlight_openapi_client/model/label_value.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -114,14 +114,6 @@ def openapi_types(): int, none_type, ), # noqa: E501 - "text": ( - str, - none_type, - ), # noqa: E501 - "rois": ( - [ROI], - none_type, - ), # noqa: E501 "source": ( bool, date, @@ -133,6 +125,14 @@ def openapi_types(): str, none_type, ), # noqa: E501 + "text": ( + str, + none_type, + ), # noqa: E501 + "rois": ( + [ROI], + none_type, + ), # noqa: E501 } @cached_property @@ -145,9 +145,9 @@ def discriminator(): "annotations_requested": "annotations_requested", # noqa: E501 "created_at": "created_at", # noqa: E501 "detector_id": "detector_id", # noqa: E501 + "source": "source", # noqa: E501 "text": "text", # noqa: E501 "rois": "rois", # noqa: E501 - "source": "source", # noqa: E501 } read_only_vars = { @@ -156,8 +156,8 @@ def discriminator(): "annotations_requested", # noqa: E501 "created_at", # noqa: E501 "detector_id", # noqa: E501 - "text", # noqa: E501 "source", # noqa: E501 + "text", # noqa: E501 } _composed_schemas = {} @@ -165,7 +165,7 @@ def discriminator(): @classmethod @convert_js_args_to_python_args def _from_openapi_data( - cls, confidence, class_name, annotations_requested, created_at, detector_id, text, *args, **kwargs + cls, confidence, class_name, annotations_requested, created_at, detector_id, source, text, *args, **kwargs ): # noqa: E501 """LabelValue - a model defined in OpenAPI @@ -175,6 +175,7 @@ def _from_openapi_data( annotations_requested ([bool, date, datetime, dict, float, int, list, str, none_type]): created_at (datetime): detector_id (int, none_type): + source (bool, date, datetime, dict, float, int, list, str, none_type): text (str, none_type): Text annotations Keyword Args: @@ -209,7 +210,6 @@ def _from_openapi_data( through its discriminator because we passed in _visited_composed_classes = (Animal,) rois ([ROI], none_type): [optional] # noqa: E501 - source (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -243,6 +243,7 @@ def _from_openapi_data( self.annotations_requested = annotations_requested self.created_at = created_at self.detector_id = detector_id + self.source = source self.text = text for var_name, var_value in kwargs.items(): if ( @@ -301,7 +302,6 @@ def __init__(self, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) rois ([ROI], none_type): [optional] # noqa: E501 - source (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) diff --git a/generated/groundlight_openapi_client/model/label_value_request.py b/generated/groundlight_openapi_client/model/label_value_request.py index a388191d..362d870c 100644 --- a/generated/groundlight_openapi_client/model/label_value_request.py +++ b/generated/groundlight_openapi_client/model/label_value_request.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/mode_enum.py b/generated/groundlight_openapi_client/model/mode_enum.py index 46bed042..34987371 100644 --- a/generated/groundlight_openapi_client/model/mode_enum.py +++ b/generated/groundlight_openapi_client/model/mode_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/multi_class_mode_configuration.py b/generated/groundlight_openapi_client/model/multi_class_mode_configuration.py index b14f6c71..f08ee27c 100644 --- a/generated/groundlight_openapi_client/model/multi_class_mode_configuration.py +++ b/generated/groundlight_openapi_client/model/multi_class_mode_configuration.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/multi_classification_result.py b/generated/groundlight_openapi_client/model/multi_classification_result.py index 9ee8a63f..e3e99760 100644 --- a/generated/groundlight_openapi_client/model/multi_classification_result.py +++ b/generated/groundlight_openapi_client/model/multi_classification_result.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -160,7 +160,7 @@ def _from_openapi_data(cls, label, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) confidence (float): [optional] # noqa: E501 - source (str): Source is optional to support edge v0.2. [optional] # noqa: E501 + source (str): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -250,7 +250,7 @@ def __init__(self, label, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) confidence (float): [optional] # noqa: E501 - source (str): Source is optional to support edge v0.2. [optional] # noqa: E501 + source (str): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) diff --git a/generated/groundlight_openapi_client/model/note.py b/generated/groundlight_openapi_client/model/note.py index 8799080f..91b565c4 100644 --- a/generated/groundlight_openapi_client/model/note.py +++ b/generated/groundlight_openapi_client/model/note.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/note_request.py b/generated/groundlight_openapi_client/model/note_request.py index 32d6b05a..09e4fe5d 100644 --- a/generated/groundlight_openapi_client/model/note_request.py +++ b/generated/groundlight_openapi_client/model/note_request.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/paginated_detector_list.py b/generated/groundlight_openapi_client/model/paginated_detector_list.py index 51471f0e..5972205e 100644 --- a/generated/groundlight_openapi_client/model/paginated_detector_list.py +++ b/generated/groundlight_openapi_client/model/paginated_detector_list.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/paginated_image_query_list.py b/generated/groundlight_openapi_client/model/paginated_image_query_list.py index 39a70a0e..13dccab7 100644 --- a/generated/groundlight_openapi_client/model/paginated_image_query_list.py +++ b/generated/groundlight_openapi_client/model/paginated_image_query_list.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/paginated_rule_list.py b/generated/groundlight_openapi_client/model/paginated_rule_list.py index bbd1b9bb..6d007e1d 100644 --- a/generated/groundlight_openapi_client/model/paginated_rule_list.py +++ b/generated/groundlight_openapi_client/model/paginated_rule_list.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/patched_detector_request.py b/generated/groundlight_openapi_client/model/patched_detector_request.py index a2fcd579..251cb75d 100644 --- a/generated/groundlight_openapi_client/model/patched_detector_request.py +++ b/generated/groundlight_openapi_client/model/patched_detector_request.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/result_type_enum.py b/generated/groundlight_openapi_client/model/result_type_enum.py index 3220f6a0..187c5861 100644 --- a/generated/groundlight_openapi_client/model/result_type_enum.py +++ b/generated/groundlight_openapi_client/model/result_type_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/roi.py b/generated/groundlight_openapi_client/model/roi.py index 07870cc5..74c4fc66 100644 --- a/generated/groundlight_openapi_client/model/roi.py +++ b/generated/groundlight_openapi_client/model/roi.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/roi_request.py b/generated/groundlight_openapi_client/model/roi_request.py index a1f63aa8..07fb54e2 100644 --- a/generated/groundlight_openapi_client/model/roi_request.py +++ b/generated/groundlight_openapi_client/model/roi_request.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/rule.py b/generated/groundlight_openapi_client/model/rule.py index 5884c996..78760fca 100644 --- a/generated/groundlight_openapi_client/model/rule.py +++ b/generated/groundlight_openapi_client/model/rule.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/rule_request.py b/generated/groundlight_openapi_client/model/rule_request.py index 62234b6f..0cb5934f 100644 --- a/generated/groundlight_openapi_client/model/rule_request.py +++ b/generated/groundlight_openapi_client/model/rule_request.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/snooze_time_unit_enum.py b/generated/groundlight_openapi_client/model/snooze_time_unit_enum.py index 555d4076..f5586bb6 100644 --- a/generated/groundlight_openapi_client/model/snooze_time_unit_enum.py +++ b/generated/groundlight_openapi_client/model/snooze_time_unit_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/source_enum.py b/generated/groundlight_openapi_client/model/source_enum.py index 6248ac27..aee5be85 100644 --- a/generated/groundlight_openapi_client/model/source_enum.py +++ b/generated/groundlight_openapi_client/model/source_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/status_enum.py b/generated/groundlight_openapi_client/model/status_enum.py index ac77a141..b41c2871 100644 --- a/generated/groundlight_openapi_client/model/status_enum.py +++ b/generated/groundlight_openapi_client/model/status_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model/verb_enum.py b/generated/groundlight_openapi_client/model/verb_enum.py index 84d601a3..8d138449 100644 --- a/generated/groundlight_openapi_client/model/verb_enum.py +++ b/generated/groundlight_openapi_client/model/verb_enum.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/model_utils.py b/generated/groundlight_openapi_client/model_utils.py index e5da59e1..cf7bd6d4 100644 --- a/generated/groundlight_openapi_client/model_utils.py +++ b/generated/groundlight_openapi_client/model_utils.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/groundlight_openapi_client/rest.py b/generated/groundlight_openapi_client/rest.py index 01876d57..16d8ca86 100644 --- a/generated/groundlight_openapi_client/rest.py +++ b/generated/groundlight_openapi_client/rest.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/model.py b/generated/model.py index 305eca8e..9c12f113 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2024-10-09T22:17:52+00:00 +# timestamp: 2024-10-30T23:38:30+00:00 from __future__ import annotations @@ -178,10 +178,6 @@ class VerbEnum(str, Enum): class Source(str, Enum): - """ - Source is optional to support edge v0.2 - """ - STILL_PROCESSING = "STILL_PROCESSING" CLOUD = "CLOUD" USER = "USER" @@ -197,20 +193,20 @@ class Label(str, Enum): class BinaryClassificationResult(BaseModel): confidence: Optional[confloat(ge=0.0, le=1.0)] = None - source: Optional[Source] = Field(None, description="Source is optional to support edge v0.2") + source: Optional[Source] = None label: Label class CountingResult(BaseModel): confidence: Optional[confloat(ge=0.0, le=1.0)] = None - source: Optional[Source] = Field(None, description="Source is optional to support edge v0.2") + source: Optional[Source] = None count: int greater_than_max: Optional[bool] = None class MultiClassificationResult(BaseModel): confidence: Optional[confloat(ge=0.0, le=1.0)] = None - source: Optional[Source] = Field(None, description="Source is optional to support edge v0.2") + source: Optional[Source] = None label: str @@ -362,7 +358,7 @@ class LabelValue(BaseModel): annotations_requested: List[AnnotationsRequestedEnum] created_at: datetime detector_id: Optional[int] = Field(...) - source: Optional[SourceEnum] = None + source: SourceEnum text: Optional[str] = Field(..., description="Text annotations") diff --git a/generated/setup.py b/generated/setup.py index 9c4c9456..9c4bb572 100644 --- a/generated/setup.py +++ b/generated/setup.py @@ -3,7 +3,7 @@ Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - The version of the OpenAPI document: 0.18.1 + The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ From 53caf5206363d3bd5b279d31b5dd90e2e0e3e949 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Sat, 9 Nov 2024 00:42:33 +0000 Subject: [PATCH 08/18] invalid id tests and test-dev line --- Makefile | 3 +++ test/integration/test_groundlight.py | 29 ++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ae002dc8..07326d24 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,9 @@ test-local: install ## Run tests against a localhost API (needs GROUNDLIGHT_API test-integ: install ## Run tests against the integ API server (needs GROUNDLIGHT_API_TOKEN) GROUNDLIGHT_ENDPOINT="https://api.integ.groundlight.ai/" ${PYTEST} ${TEST_ARGS} ${CLOUD_FILTERS} test +test-dev: install ## Run tests against a dev API server (needs GROUNDLIGHT_API_TOKEN and properly configured dns-hostmap) + GROUNDLIGHT_ENDPOINT="https://api.dev.groundlight.ai" ${PYTEST} ${TEST_ARGS} ${CLOUD_FILTERS} test + test-docs: install ## Run the example code and tests in our docs against the prod API (needs GROUNDLIGHT_API_TOKEN) ${PYTEST} --markdown-docs ${TEST_ARGS} docs README.md diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index 7a47b3c2..67ccd57f 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -8,11 +8,10 @@ from datetime import datetime from typing import Any, Dict, Optional, Union -import groundlight_openapi_client import pytest from groundlight import Groundlight from groundlight.binary_labels import VALID_DISPLAY_LABELS, DeprecatedLabel, Label, convert_internal_label_to_display -from groundlight.internalapi import InternalApiError, NotFoundError +from groundlight.internalapi import InternalApiError, NotFoundError, ApiException from groundlight.optional_imports import * from groundlight.status_codes import is_user_error from ksuid import KsuidMs @@ -331,6 +330,28 @@ def test_submit_image_query_with_id(gl: Groundlight, detector: Detector): assert is_valid_display_result(_image_query.result) +def test_submit_image_query_with_invalid_id(gl: Groundlight, detector: Detector): + # Invalid ID format + id = f"iqabc_{KsuidMs()}" + with pytest.raises(ApiException): + gl.submit_image_query( + detector=detector.id, image="test/assets/dog.jpeg", wait=10, human_review="NEVER", image_query_id=id + ) + + # Duplicate ID entry + id = f"iq_{KsuidMs()}" + _image_query_1 = gl.submit_image_query( + detector=detector.id, image="test/assets/dog.jpeg", wait=10, human_review="NEVER", image_query_id=id + ) + assert str(_image_query_1) + assert isinstance(_image_query_1, ImageQuery) + assert is_valid_display_result(_image_query_1.result) + with pytest.raises(ApiException): + gl.submit_image_query( + detector=detector.id, image="test/assets/dog.jpeg", wait=10, human_review="NEVER", image_query_id=id + ) + + def test_submit_image_query_with_human_review_param(gl: Groundlight, detector: Detector): # For now, this just tests that the image query is submitted successfully. # There should probably be a better way to check whether the image query was escalated for human review. @@ -436,7 +457,7 @@ def test_submit_image_query_with_metadata_too_large(gl: Groundlight, detector: D @pytest.mark.run_only_for_edge_endpoint def test_submit_image_query_with_metadata_returns_user_error(gl: Groundlight, detector: Detector, image: str): """On the edge-endpoint, we raise an exception if the user passes metadata.""" - with pytest.raises(groundlight_openapi_client.exceptions.ApiException) as exc_info: + with pytest.raises(ApiException) as exc_info: gl.submit_image_query(detector=detector.id, image=image, human_review="NEVER", metadata={"a": 1}) assert is_user_error(exc_info.value.status) @@ -454,7 +475,7 @@ def test_submit_image_query_jpeg_truncated(gl: Groundlight, detector: Detector): jpeg_truncated = jpeg[:-500] # Cut off the last 500 bytes # This is an extra difficult test because the header is valid. # So a casual check of the image will appear valid. - with pytest.raises(groundlight_openapi_client.exceptions.ApiException) as exc_info: + with pytest.raises(ApiException) as exc_info: _image_query = gl.submit_image_query(detector=detector.id, image=jpeg_truncated, human_review="NEVER") exc_value = exc_info.value assert is_user_error(exc_value.status) From 233732c551d275ccfd5b4b76d4d6e64ed49d8412 Mon Sep 17 00:00:00 2001 From: Auto-format Bot Date: Sat, 9 Nov 2024 00:43:27 +0000 Subject: [PATCH 09/18] Automatically reformatting code --- test/integration/test_groundlight.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index 67ccd57f..8bb64fbb 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -11,7 +11,7 @@ import pytest from groundlight import Groundlight from groundlight.binary_labels import VALID_DISPLAY_LABELS, DeprecatedLabel, Label, convert_internal_label_to_display -from groundlight.internalapi import InternalApiError, NotFoundError, ApiException +from groundlight.internalapi import ApiException, InternalApiError, NotFoundError from groundlight.optional_imports import * from groundlight.status_codes import is_user_error from ksuid import KsuidMs From 22c3ac8f9c272d8e1b0c1accf2a9034ef648409a Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Sat, 9 Nov 2024 00:58:50 +0000 Subject: [PATCH 10/18] tests for each submit IQ method, and verify metadata --- test/integration/test_groundlight.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index 67ccd57f..8378136c 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -321,6 +321,7 @@ def test_submit_image_query_png(gl: Groundlight, detector: Detector): def test_submit_image_query_with_id(gl: Groundlight, detector: Detector): + # submit_image_query id = f"iq_{KsuidMs()}" _image_query = gl.submit_image_query( detector=detector.id, image="test/assets/dog.jpeg", wait=10, human_review="NEVER", image_query_id=id @@ -328,6 +329,20 @@ def test_submit_image_query_with_id(gl: Groundlight, detector: Detector): assert str(_image_query) assert isinstance(_image_query, ImageQuery) assert is_valid_display_result(_image_query.result) + assert _image_query.metadata is not None + assert _image_query.metadata.get("is_from_edge") + + # ask_confident + id = f"iq_{KsuidMs()}" + _image_query = gl.ask_confident(detector=detector.id, image="test/assets/dog.jpeg", wait=10, image_query_id=id) + + # ask_ml + id = f"iq_{KsuidMs()}" + _image_query = gl.ask_ml(detector=detector.id, image="test/assets/dog.jpeg", wait=10, image_query_id=id) + + # ask_async + id = f"iq_{KsuidMs()}" + _image_query = gl.ask_async(detector=detector.id, image="test/assets/dog.jpeg", image_query_id=id) def test_submit_image_query_with_invalid_id(gl: Groundlight, detector: Detector): From 176e8dc29e82bb69553ec7fd5725d7eaa86a78ff Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Mon, 11 Nov 2024 18:44:15 +0000 Subject: [PATCH 11/18] verify that id is correct --- test/integration/test_groundlight.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index 590a5379..332fa6d8 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -329,20 +329,27 @@ def test_submit_image_query_with_id(gl: Groundlight, detector: Detector): assert str(_image_query) assert isinstance(_image_query, ImageQuery) assert is_valid_display_result(_image_query.result) + assert _image_query.id == id assert _image_query.metadata is not None assert _image_query.metadata.get("is_from_edge") # ask_confident id = f"iq_{KsuidMs()}" _image_query = gl.ask_confident(detector=detector.id, image="test/assets/dog.jpeg", wait=10, image_query_id=id) + assert isinstance(_image_query, ImageQuery) + assert _image_query.id == id # ask_ml id = f"iq_{KsuidMs()}" _image_query = gl.ask_ml(detector=detector.id, image="test/assets/dog.jpeg", wait=10, image_query_id=id) + assert isinstance(_image_query, ImageQuery) + assert _image_query.id == id # ask_async id = f"iq_{KsuidMs()}" _image_query = gl.ask_async(detector=detector.id, image="test/assets/dog.jpeg", image_query_id=id) + assert isinstance(_image_query, ImageQuery) + assert _image_query.id == id def test_submit_image_query_with_invalid_id(gl: Groundlight, detector: Detector): From f35aebfe9f240db828d89fa471f4d57d1e617e34 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Mon, 11 Nov 2024 19:36:15 +0000 Subject: [PATCH 12/18] remove image_query_id from methods besides submit_image_query --- src/groundlight/client.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 9a8f9a2b..07d64804 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -543,7 +543,6 @@ def ask_confident( # noqa: PLR0913 # pylint: disable=too-many-arguments confidence_threshold: Optional[float] = None, wait: Optional[float] = None, metadata: Union[dict, str, None] = None, - image_query_id: Optional[str] = None, inspection_id: Optional[str] = None, ) -> ImageQuery: """ @@ -570,9 +569,6 @@ def ask_confident( # noqa: PLR0913 # pylint: disable=too-many-arguments the image query (limited to 1KB). You can retrieve this metadata later by calling `get_image_query()`. - :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended - for general external use. If not set, a random ID will be generated. - :return: ImageQuery """ return self.submit_image_query( @@ -583,7 +579,6 @@ def ask_confident( # noqa: PLR0913 # pylint: disable=too-many-arguments patience_time=wait, human_review=None, metadata=metadata, - image_query_id=image_query_id, inspection_id=inspection_id, ) @@ -593,7 +588,6 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca image: Union[str, bytes, Image.Image, BytesIO, BufferedReader, np.ndarray], wait: Optional[float] = None, metadata: Union[dict, str, None] = None, - image_query_id: Optional[str] = None, inspection_id: Optional[str] = None, ) -> ImageQuery: """ @@ -616,9 +610,6 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca the image query (limited to 1KB). You can retrieve this metadata later by calling `get_image_query()`. - :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended - for general external use. If not set, a random ID will be generated. - :return: ImageQuery """ iq = self.submit_image_query( @@ -626,7 +617,6 @@ def ask_ml( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-loca image, wait=0, metadata=metadata, - image_query_id=image_query_id, inspection_id=inspection_id, ) if iq_is_answered(iq): @@ -642,7 +632,6 @@ def ask_async( # noqa: PLR0913 # pylint: disable=too-many-arguments confidence_threshold: Optional[float] = None, human_review: Optional[str] = None, metadata: Union[dict, str, None] = None, - image_query_id: Optional[str] = None, inspection_id: Optional[str] = None, ) -> ImageQuery: """ @@ -683,9 +672,6 @@ def ask_async( # noqa: PLR0913 # pylint: disable=too-many-arguments the image query (limited to 1KB). You can retrieve this metadata later by calling `get_image_query()`. - :param image_query_id: The ID for the image query. This is to enable specific functionality and is not intended - for general external use. If not set, a random ID will be generated. - :return: ImageQuery @@ -729,7 +715,6 @@ def ask_async( # noqa: PLR0913 # pylint: disable=too-many-arguments human_review=human_review, want_async=True, metadata=metadata, - image_query_id=image_query_id, inspection_id=inspection_id, ) From 0359c182b76488eb3535f0550e7611bd5dc9e97e Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Mon, 11 Nov 2024 19:48:06 +0000 Subject: [PATCH 13/18] refactor make file a bit --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 07326d24..6dbb2c3e 100644 --- a/Makefile +++ b/Makefile @@ -49,13 +49,16 @@ test-4edge: install ## Run tests against the prod API via the edge-endpoint (ne ${PYTEST} ${PROFILING_ARGS} ${TEST_ARGS} ${EDGE_FILTERS} test test-local: install ## Run tests against a localhost API (needs GROUNDLIGHT_API_TOKEN and a local API server) - GROUNDLIGHT_ENDPOINT="http://localhost:8000/" ${PYTEST} ${TEST_ARGS} ${CLOUD_FILTERS} test + $(eval GROUNDLIGHT_ENDPOINT="http://localhost:8000/") + $(MAKE) test test-integ: install ## Run tests against the integ API server (needs GROUNDLIGHT_API_TOKEN) - GROUNDLIGHT_ENDPOINT="https://api.integ.groundlight.ai/" ${PYTEST} ${TEST_ARGS} ${CLOUD_FILTERS} test + $(eval GROUNDLIGHT_ENDPOINT="https://api.integ.groundlight.ai/") + $(MAKE) test test-dev: install ## Run tests against a dev API server (needs GROUNDLIGHT_API_TOKEN and properly configured dns-hostmap) - GROUNDLIGHT_ENDPOINT="https://api.dev.groundlight.ai" ${PYTEST} ${TEST_ARGS} ${CLOUD_FILTERS} test + $(eval GROUNDLIGHT_ENDPOINT="https://api.dev.groundlight.ai/") + $(MAKE) test test-docs: install ## Run the example code and tests in our docs against the prod API (needs GROUNDLIGHT_API_TOKEN) ${PYTEST} --markdown-docs ${TEST_ARGS} docs README.md From 3ec1077aa8be8f39a08f4c8b23fb56dcff2f3eb8 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Mon, 11 Nov 2024 19:50:25 +0000 Subject: [PATCH 14/18] fix make formatting --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6dbb2c3e..d9bf1fe3 100644 --- a/Makefile +++ b/Makefile @@ -50,15 +50,15 @@ test-4edge: install ## Run tests against the prod API via the edge-endpoint (ne test-local: install ## Run tests against a localhost API (needs GROUNDLIGHT_API_TOKEN and a local API server) $(eval GROUNDLIGHT_ENDPOINT="http://localhost:8000/") - $(MAKE) test + $(MAKE) test test-integ: install ## Run tests against the integ API server (needs GROUNDLIGHT_API_TOKEN) $(eval GROUNDLIGHT_ENDPOINT="https://api.integ.groundlight.ai/") - $(MAKE) test + $(MAKE) test test-dev: install ## Run tests against a dev API server (needs GROUNDLIGHT_API_TOKEN and properly configured dns-hostmap) $(eval GROUNDLIGHT_ENDPOINT="https://api.dev.groundlight.ai/") - $(MAKE) test + $(MAKE) test test-docs: install ## Run the example code and tests in our docs against the prod API (needs GROUNDLIGHT_API_TOKEN) ${PYTEST} --markdown-docs ${TEST_ARGS} docs README.md From 76a9d0ad01e6d6c93a3ed2356bee0984f0bdedf2 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Mon, 11 Nov 2024 19:56:18 +0000 Subject: [PATCH 15/18] now it works --- Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d9bf1fe3..84dcf563 100644 --- a/Makefile +++ b/Makefile @@ -49,16 +49,13 @@ test-4edge: install ## Run tests against the prod API via the edge-endpoint (ne ${PYTEST} ${PROFILING_ARGS} ${TEST_ARGS} ${EDGE_FILTERS} test test-local: install ## Run tests against a localhost API (needs GROUNDLIGHT_API_TOKEN and a local API server) - $(eval GROUNDLIGHT_ENDPOINT="http://localhost:8000/") - $(MAKE) test + GROUNDLIGHT_ENDPOINT="http://localhost:8000/" $(MAKE) test test-integ: install ## Run tests against the integ API server (needs GROUNDLIGHT_API_TOKEN) - $(eval GROUNDLIGHT_ENDPOINT="https://api.integ.groundlight.ai/") - $(MAKE) test + GROUNDLIGHT_ENDPOINT="https://api.integ.groundlight.ai/" $(MAKE) test test-dev: install ## Run tests against a dev API server (needs GROUNDLIGHT_API_TOKEN and properly configured dns-hostmap) - $(eval GROUNDLIGHT_ENDPOINT="https://api.dev.groundlight.ai/") - $(MAKE) test + GROUNDLIGHT_ENDPOINT="https://api.dev.groundlight.ai/" $(MAKE) test test-docs: install ## Run the example code and tests in our docs against the prod API (needs GROUNDLIGHT_API_TOKEN) ${PYTEST} --markdown-docs ${TEST_ARGS} docs README.md From 8a4e534fb7a9b6524469946d24b7772f157e9ef3 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Mon, 11 Nov 2024 19:57:39 +0000 Subject: [PATCH 16/18] remove tests for other methods --- test/integration/test_groundlight.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index 332fa6d8..d4c772c4 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -333,24 +333,6 @@ def test_submit_image_query_with_id(gl: Groundlight, detector: Detector): assert _image_query.metadata is not None assert _image_query.metadata.get("is_from_edge") - # ask_confident - id = f"iq_{KsuidMs()}" - _image_query = gl.ask_confident(detector=detector.id, image="test/assets/dog.jpeg", wait=10, image_query_id=id) - assert isinstance(_image_query, ImageQuery) - assert _image_query.id == id - - # ask_ml - id = f"iq_{KsuidMs()}" - _image_query = gl.ask_ml(detector=detector.id, image="test/assets/dog.jpeg", wait=10, image_query_id=id) - assert isinstance(_image_query, ImageQuery) - assert _image_query.id == id - - # ask_async - id = f"iq_{KsuidMs()}" - _image_query = gl.ask_async(detector=detector.id, image="test/assets/dog.jpeg", image_query_id=id) - assert isinstance(_image_query, ImageQuery) - assert _image_query.id == id - def test_submit_image_query_with_invalid_id(gl: Groundlight, detector: Detector): # Invalid ID format From 1a694424f8eee2863ee536f1dc6fecae5b147473 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Tue, 12 Nov 2024 22:47:08 +0000 Subject: [PATCH 17/18] update docs slightly to remove reference to 'iqe' --- docs/docs/building-applications/7-edge.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/building-applications/7-edge.md b/docs/docs/building-applications/7-edge.md index 873b81d3..78329ed5 100644 --- a/docs/docs/building-applications/7-edge.md +++ b/docs/docs/building-applications/7-edge.md @@ -14,8 +14,8 @@ and for communicating with the Groundlight cloud service. To use the edge endpoint, simply configure the Groundlight SDK to use the edge endpoint's URL instead of the cloud endpoint. All application logic will work seamlessly and unchanged with the Groundlight Edge Endpoint, except some ML answers will -return much faster locally. The only visible difference is that image queries answered at the edge endpoint will have the prefix `iqe_` instead of `iq_` for image queries answered in the cloud. `iqe_` stands for "image query edge". Edge-originated -image queries will not appear in the cloud dashboard. +return much faster locally. Image queries answered at the edge endpoint will not appear in the cloud dashboard unless +specifically configured to do so, in which case the edge prediction will not be reflected on the image query in the cloud. ## Configuring the Edge Endpoint From 0b42f9aedf1607121e76b597df4efe9f32b11f37 Mon Sep 17 00:00:00 2001 From: CoreyEWood Date: Wed, 13 Nov 2024 20:07:39 +0000 Subject: [PATCH 18/18] remove invalid iq id tests --- test/integration/test_groundlight.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index d4c772c4..a0dc44ba 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -334,28 +334,6 @@ def test_submit_image_query_with_id(gl: Groundlight, detector: Detector): assert _image_query.metadata.get("is_from_edge") -def test_submit_image_query_with_invalid_id(gl: Groundlight, detector: Detector): - # Invalid ID format - id = f"iqabc_{KsuidMs()}" - with pytest.raises(ApiException): - gl.submit_image_query( - detector=detector.id, image="test/assets/dog.jpeg", wait=10, human_review="NEVER", image_query_id=id - ) - - # Duplicate ID entry - id = f"iq_{KsuidMs()}" - _image_query_1 = gl.submit_image_query( - detector=detector.id, image="test/assets/dog.jpeg", wait=10, human_review="NEVER", image_query_id=id - ) - assert str(_image_query_1) - assert isinstance(_image_query_1, ImageQuery) - assert is_valid_display_result(_image_query_1.result) - with pytest.raises(ApiException): - gl.submit_image_query( - detector=detector.id, image="test/assets/dog.jpeg", wait=10, human_review="NEVER", image_query_id=id - ) - - def test_submit_image_query_with_human_review_param(gl: Groundlight, detector: Detector): # For now, this just tests that the image query is submitted successfully. # There should probably be a better way to check whether the image query was escalated for human review.