From 2b464be76f236ac8f823a82620e8e30b4a180481 Mon Sep 17 00:00:00 2001 From: brandon Date: Tue, 30 Jul 2024 15:12:29 -0700 Subject: [PATCH 01/15] generating based on new api spec --- generated/.openapi-generator/FILES | 36 ++ generated/README.md | 14 + generated/docs/AnnotationsRequestedEnum.md | 12 + generated/docs/BBoxGeometry.md | 17 + generated/docs/BlankEnum.md | 11 + .../docs/DetectorCreationInputRequest.md | 2 +- generated/docs/DetectorGroup.md | 13 + generated/docs/DetectorGroupRequest.md | 12 + generated/docs/DetectorsApi.md | 155 +++++++ generated/docs/ImageQuery.md | 1 + generated/docs/LabelValue.md | 23 ++ generated/docs/LabelValueRequest.md | 18 + generated/docs/LabelsApi.md | 95 +++++ generated/docs/ModeEnum.md | 4 +- generated/docs/NullEnum.md | 11 + generated/docs/ROI.md | 14 + generated/docs/ReviewReasonEnum.md | 12 + generated/docs/SourceEnum.md | 12 + .../api/detectors_api.py | 177 ++++++++ .../api/labels_api.py | 134 ++++++ .../apis/__init__.py | 1 + .../model/annotations_requested_enum.py | 283 +++++++++++++ .../model/b_box_geometry.py | 302 ++++++++++++++ .../model/blank_enum.py | 274 ++++++++++++ .../model/detector_creation_input_request.py | 4 +- .../model/detector_group.py | 283 +++++++++++++ .../model/detector_group_request.py | 279 +++++++++++++ .../model/image_query.py | 11 + .../model/label_value.py | 391 ++++++++++++++++++ .../model/label_value_request.py | 348 ++++++++++++++++ .../model/mode_enum.py | 9 +- .../model/null_enum.py | 282 +++++++++++++ .../model/review_reason_enum.py | 290 +++++++++++++ .../groundlight_openapi_client/model/roi.py | 294 +++++++++++++ .../model/source_enum.py | 288 +++++++++++++ .../models/__init__.py | 11 + generated/model.py | 122 +++++- .../test/test_annotations_requested_enum.py | 35 ++ generated/test/test_b_box_geometry.py | 35 ++ generated/test/test_blank_enum.py | 35 ++ generated/test/test_detector_group.py | 35 ++ generated/test/test_detector_group_request.py | 35 ++ generated/test/test_label_value.py | 46 +++ generated/test/test_label_value_request.py | 42 ++ generated/test/test_labels_api.py | 32 ++ generated/test/test_null_enum.py | 35 ++ generated/test/test_review_reason_enum.py | 35 ++ generated/test/test_roi.py | 38 ++ generated/test/test_source_enum.py | 35 ++ spec/public-api.yaml | 310 ++++++++++++++ 50 files changed, 4982 insertions(+), 11 deletions(-) create mode 100644 generated/docs/AnnotationsRequestedEnum.md create mode 100644 generated/docs/BBoxGeometry.md create mode 100644 generated/docs/BlankEnum.md create mode 100644 generated/docs/DetectorGroup.md create mode 100644 generated/docs/DetectorGroupRequest.md create mode 100644 generated/docs/LabelValue.md create mode 100644 generated/docs/LabelValueRequest.md create mode 100644 generated/docs/LabelsApi.md create mode 100644 generated/docs/NullEnum.md create mode 100644 generated/docs/ROI.md create mode 100644 generated/docs/ReviewReasonEnum.md create mode 100644 generated/docs/SourceEnum.md create mode 100644 generated/groundlight_openapi_client/api/labels_api.py create mode 100644 generated/groundlight_openapi_client/model/annotations_requested_enum.py create mode 100644 generated/groundlight_openapi_client/model/b_box_geometry.py create mode 100644 generated/groundlight_openapi_client/model/blank_enum.py create mode 100644 generated/groundlight_openapi_client/model/detector_group.py create mode 100644 generated/groundlight_openapi_client/model/detector_group_request.py create mode 100644 generated/groundlight_openapi_client/model/label_value.py create mode 100644 generated/groundlight_openapi_client/model/label_value_request.py create mode 100644 generated/groundlight_openapi_client/model/null_enum.py create mode 100644 generated/groundlight_openapi_client/model/review_reason_enum.py create mode 100644 generated/groundlight_openapi_client/model/roi.py create mode 100644 generated/groundlight_openapi_client/model/source_enum.py create mode 100644 generated/test/test_annotations_requested_enum.py create mode 100644 generated/test/test_b_box_geometry.py create mode 100644 generated/test/test_blank_enum.py create mode 100644 generated/test/test_detector_group.py create mode 100644 generated/test/test_detector_group_request.py create mode 100644 generated/test/test_label_value.py create mode 100644 generated/test/test_label_value_request.py create mode 100644 generated/test/test_labels_api.py create mode 100644 generated/test/test_null_enum.py create mode 100644 generated/test/test_review_reason_enum.py create mode 100644 generated/test/test_roi.py create mode 100644 generated/test/test_source_enum.py diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index ac70605c..65a27342 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -6,30 +6,42 @@ docs/Action.md docs/ActionRequest.md docs/ActionsApi.md docs/AllNotes.md +docs/AnnotationsRequestedEnum.md +docs/BBoxGeometry.md docs/BinaryClassificationResult.md +docs/BlankEnum.md docs/ChannelEnum.md docs/Condition.md docs/ConditionRequest.md docs/CountingResult.md docs/Detector.md docs/DetectorCreationInputRequest.md +docs/DetectorGroup.md +docs/DetectorGroupRequest.md docs/DetectorTypeEnum.md docs/DetectorsApi.md docs/ImageQueriesApi.md docs/ImageQuery.md docs/ImageQueryTypeEnum.md docs/InlineResponse200.md +docs/LabelValue.md +docs/LabelValueRequest.md +docs/LabelsApi.md docs/ModeEnum.md docs/Note.md docs/NoteRequest.md docs/NotesApi.md +docs/NullEnum.md docs/PaginatedDetectorList.md docs/PaginatedImageQueryList.md docs/PaginatedRuleList.md +docs/ROI.md docs/ResultTypeEnum.md +docs/ReviewReasonEnum.md docs/Rule.md docs/RuleRequest.md docs/SnoozeTimeUnitEnum.md +docs/SourceEnum.md docs/UserApi.md docs/VerbEnum.md git_push.sh @@ -38,6 +50,7 @@ groundlight_openapi_client/api/__init__.py groundlight_openapi_client/api/actions_api.py groundlight_openapi_client/api/detectors_api.py groundlight_openapi_client/api/image_queries_api.py +groundlight_openapi_client/api/labels_api.py groundlight_openapi_client/api/notes_api.py groundlight_openapi_client/api/user_api.py groundlight_openapi_client/api_client.py @@ -48,27 +61,38 @@ groundlight_openapi_client/model/__init__.py groundlight_openapi_client/model/action.py groundlight_openapi_client/model/action_request.py groundlight_openapi_client/model/all_notes.py +groundlight_openapi_client/model/annotations_requested_enum.py +groundlight_openapi_client/model/b_box_geometry.py groundlight_openapi_client/model/binary_classification_result.py +groundlight_openapi_client/model/blank_enum.py groundlight_openapi_client/model/channel_enum.py groundlight_openapi_client/model/condition.py groundlight_openapi_client/model/condition_request.py groundlight_openapi_client/model/counting_result.py groundlight_openapi_client/model/detector.py groundlight_openapi_client/model/detector_creation_input_request.py +groundlight_openapi_client/model/detector_group.py +groundlight_openapi_client/model/detector_group_request.py groundlight_openapi_client/model/detector_type_enum.py groundlight_openapi_client/model/image_query.py groundlight_openapi_client/model/image_query_type_enum.py groundlight_openapi_client/model/inline_response200.py +groundlight_openapi_client/model/label_value.py +groundlight_openapi_client/model/label_value_request.py groundlight_openapi_client/model/mode_enum.py groundlight_openapi_client/model/note.py groundlight_openapi_client/model/note_request.py +groundlight_openapi_client/model/null_enum.py groundlight_openapi_client/model/paginated_detector_list.py groundlight_openapi_client/model/paginated_image_query_list.py groundlight_openapi_client/model/paginated_rule_list.py groundlight_openapi_client/model/result_type_enum.py +groundlight_openapi_client/model/review_reason_enum.py +groundlight_openapi_client/model/roi.py groundlight_openapi_client/model/rule.py groundlight_openapi_client/model/rule_request.py groundlight_openapi_client/model/snooze_time_unit_enum.py +groundlight_openapi_client/model/source_enum.py groundlight_openapi_client/model/verb_enum.py groundlight_openapi_client/model_utils.py groundlight_openapi_client/models/__init__.py @@ -78,4 +102,16 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_annotations_requested_enum.py +test/test_b_box_geometry.py +test/test_blank_enum.py +test/test_detector_group.py +test/test_detector_group_request.py +test/test_label_value.py +test/test_label_value_request.py +test/test_labels_api.py +test/test_null_enum.py +test/test_review_reason_enum.py +test/test_roi.py +test/test_source_enum.py tox.ini diff --git a/generated/README.md b/generated/README.md index d5a3c167..1014d963 100644 --- a/generated/README.md +++ b/generated/README.md @@ -115,13 +115,16 @@ Class | Method | HTTP request | Description *ActionsApi* | [**list_detector_rules**](docs/ActionsApi.md#list_detector_rules) | **GET** /v1/actions/detector/{detector_id}/rules | *ActionsApi* | [**list_rules**](docs/ActionsApi.md#list_rules) | **GET** /v1/actions/rules | *DetectorsApi* | [**create_detector**](docs/DetectorsApi.md#create_detector) | **POST** /v1/detectors | +*DetectorsApi* | [**create_detector_group**](docs/DetectorsApi.md#create_detector_group) | **POST** /v1/detectors/detector-groups | *DetectorsApi* | [**delete_detector**](docs/DetectorsApi.md#delete_detector) | **DELETE** /v1/detectors/{id} | *DetectorsApi* | [**get_detector**](docs/DetectorsApi.md#get_detector) | **GET** /v1/detectors/{id} | +*DetectorsApi* | [**get_detector_groups**](docs/DetectorsApi.md#get_detector_groups) | **GET** /v1/detectors/detector-groups | *DetectorsApi* | [**list_detectors**](docs/DetectorsApi.md#list_detectors) | **GET** /v1/detectors | *ImageQueriesApi* | [**get_image**](docs/ImageQueriesApi.md#get_image) | **GET** /v1/image-queries/{id}/image | *ImageQueriesApi* | [**get_image_query**](docs/ImageQueriesApi.md#get_image_query) | **GET** /v1/image-queries/{id} | *ImageQueriesApi* | [**list_image_queries**](docs/ImageQueriesApi.md#list_image_queries) | **GET** /v1/image-queries | *ImageQueriesApi* | [**submit_image_query**](docs/ImageQueriesApi.md#submit_image_query) | **POST** /v1/image-queries | +*LabelsApi* | [**labels_create**](docs/LabelsApi.md#labels_create) | **POST** /v1/labels | *NotesApi* | [**create_note**](docs/NotesApi.md#create_note) | **POST** /v1/notes | *NotesApi* | [**get_notes**](docs/NotesApi.md#get_notes) | **GET** /v1/notes | *UserApi* | [**who_am_i**](docs/UserApi.md#who_am_i) | **GET** /v1/me | @@ -132,27 +135,38 @@ Class | Method | HTTP request | Description - [Action](docs/Action.md) - [ActionRequest](docs/ActionRequest.md) - [AllNotes](docs/AllNotes.md) + - [AnnotationsRequestedEnum](docs/AnnotationsRequestedEnum.md) + - [BBoxGeometry](docs/BBoxGeometry.md) - [BinaryClassificationResult](docs/BinaryClassificationResult.md) + - [BlankEnum](docs/BlankEnum.md) - [ChannelEnum](docs/ChannelEnum.md) - [Condition](docs/Condition.md) - [ConditionRequest](docs/ConditionRequest.md) - [CountingResult](docs/CountingResult.md) - [Detector](docs/Detector.md) - [DetectorCreationInputRequest](docs/DetectorCreationInputRequest.md) + - [DetectorGroup](docs/DetectorGroup.md) + - [DetectorGroupRequest](docs/DetectorGroupRequest.md) - [DetectorTypeEnum](docs/DetectorTypeEnum.md) - [ImageQuery](docs/ImageQuery.md) - [ImageQueryTypeEnum](docs/ImageQueryTypeEnum.md) - [InlineResponse200](docs/InlineResponse200.md) + - [LabelValue](docs/LabelValue.md) + - [LabelValueRequest](docs/LabelValueRequest.md) - [ModeEnum](docs/ModeEnum.md) - [Note](docs/Note.md) - [NoteRequest](docs/NoteRequest.md) + - [NullEnum](docs/NullEnum.md) - [PaginatedDetectorList](docs/PaginatedDetectorList.md) - [PaginatedImageQueryList](docs/PaginatedImageQueryList.md) - [PaginatedRuleList](docs/PaginatedRuleList.md) + - [ROI](docs/ROI.md) - [ResultTypeEnum](docs/ResultTypeEnum.md) + - [ReviewReasonEnum](docs/ReviewReasonEnum.md) - [Rule](docs/Rule.md) - [RuleRequest](docs/RuleRequest.md) - [SnoozeTimeUnitEnum](docs/SnoozeTimeUnitEnum.md) + - [SourceEnum](docs/SourceEnum.md) - [VerbEnum](docs/VerbEnum.md) diff --git a/generated/docs/AnnotationsRequestedEnum.md b/generated/docs/AnnotationsRequestedEnum.md new file mode 100644 index 00000000..fd366f01 --- /dev/null +++ b/generated/docs/AnnotationsRequestedEnum.md @@ -0,0 +1,12 @@ +# AnnotationsRequestedEnum + +* `BINARY_CLASSIFICATION` - Binary Classification * `BOUNDING_BOXES` - Bounding Boxes + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **str** | * `BINARY_CLASSIFICATION` - Binary Classification * `BOUNDING_BOXES` - Bounding Boxes | must be one of ["BINARY_CLASSIFICATION", "BOUNDING_BOXES", ] + +[[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/BBoxGeometry.md b/generated/docs/BBoxGeometry.md new file mode 100644 index 00000000..e062ed84 --- /dev/null +++ b/generated/docs/BBoxGeometry.md @@ -0,0 +1,17 @@ +# BBoxGeometry + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**left** | **float** | | +**top** | **float** | | +**right** | **float** | | +**bottom** | **float** | | +**x** | **float** | | [readonly] +**y** | **float** | | [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/BlankEnum.md b/generated/docs/BlankEnum.md new file mode 100644 index 00000000..1531f56d --- /dev/null +++ b/generated/docs/BlankEnum.md @@ -0,0 +1,11 @@ +# BlankEnum + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **str** | | defaults to "", must be one of ["", ] + +[[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/DetectorCreationInputRequest.md b/generated/docs/DetectorCreationInputRequest.md index 0dd6e3ab..d3d77acb 100644 --- a/generated/docs/DetectorCreationInputRequest.md +++ b/generated/docs/DetectorCreationInputRequest.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **patience_time** | **float** | How long Groundlight will attempt to generate a confident prediction | [optional] if omitted the server will use the default value of 30.0 **pipeline_config** | **str, none_type** | (Advanced usage) Configuration needed to instantiate a prediction pipeline. | [optional] **metadata** | **str** | Base64-encoded metadata for the detector. This should be a JSON object with string keys. The size after encoding should not exceed 1362 bytes, corresponding to 1KiB before encoding. | [optional] -**mode** | **bool, date, datetime, dict, float, int, list, str, none_type** | Mode in which this detector will work. * `BINARY` - BINARY * `COUNT` - COUNT | [optional] +**mode** | **bool, date, datetime, dict, float, int, list, str, none_type** | Mode in which this detector will work. * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS | [optional] **mode_configuration** | **bool, date, datetime, dict, float, int, list, str, none_type** | Configuration for each detector mode. | [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/DetectorGroup.md b/generated/docs/DetectorGroup.md new file mode 100644 index 00000000..c1f764be --- /dev/null +++ b/generated/docs/DetectorGroup.md @@ -0,0 +1,13 @@ +# DetectorGroup + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [readonly] +**name** | **str** | | +**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/DetectorGroupRequest.md b/generated/docs/DetectorGroupRequest.md new file mode 100644 index 00000000..8de4ad8a --- /dev/null +++ b/generated/docs/DetectorGroupRequest.md @@ -0,0 +1,12 @@ +# DetectorGroupRequest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**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/DetectorsApi.md b/generated/docs/DetectorsApi.md index 6a748263..950be281 100644 --- a/generated/docs/DetectorsApi.md +++ b/generated/docs/DetectorsApi.md @@ -5,8 +5,10 @@ All URIs are relative to *https://api.groundlight.ai/device-api* Method | HTTP request | Description ------------- | ------------- | ------------- [**create_detector**](DetectorsApi.md#create_detector) | **POST** /v1/detectors | +[**create_detector_group**](DetectorsApi.md#create_detector_group) | **POST** /v1/detectors/detector-groups | [**delete_detector**](DetectorsApi.md#delete_detector) | **DELETE** /v1/detectors/{id} | [**get_detector**](DetectorsApi.md#get_detector) | **GET** /v1/detectors/{id} | +[**get_detector_groups**](DetectorsApi.md#get_detector_groups) | **GET** /v1/detectors/detector-groups | [**list_detectors**](DetectorsApi.md#list_detectors) | **GET** /v1/detectors | @@ -90,6 +92,86 @@ Name | Type | Description | Notes - **Accept**: application/json +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_detector_group** +> DetectorGroup create_detector_group(detector_group_request) + + + +Create a new detector group POST data: Required: - name (str) - name of the predictor set + +### Example + +* Api Key Authentication (ApiToken): + +```python +import time +import groundlight_openapi_client +from groundlight_openapi_client.api import detectors_api +from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest +from groundlight_openapi_client.model.detector_group import DetectorGroup +from pprint import pprint +# Defining the host is optional and defaults to https://api.groundlight.ai/device-api +# See configuration.py for a list of all supported configuration parameters. +configuration = groundlight_openapi_client.Configuration( + host = "https://api.groundlight.ai/device-api" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: ApiToken +configuration.api_key['ApiToken'] = 'YOUR_API_KEY' + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['ApiToken'] = 'Bearer' + +# Enter a context with an instance of the API client +with groundlight_openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = detectors_api.DetectorsApi(api_client) + detector_group_request = DetectorGroupRequest( + name="name_example", + ) # DetectorGroupRequest | + + # example passing only required values which don't have defaults set + try: + api_response = api_instance.create_detector_group(detector_group_request) + pprint(api_response) + except groundlight_openapi_client.ApiException as e: + print("Exception when calling DetectorsApi->create_detector_group: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **detector_group_request** | [**DetectorGroupRequest**](DetectorGroupRequest.md)| | + +### Return type + +[**DetectorGroup**](DetectorGroup.md) + +### Authorization + +[ApiToken](../README.md#ApiToken) + +### HTTP request headers + + - **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data + - **Accept**: application/json + + ### HTTP response details | Status code | Description | Response headers | @@ -242,6 +324,79 @@ Name | Type | Description | Notes - **Accept**: application/json +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_detector_groups** +> [DetectorGroup] get_detector_groups() + + + +List all detector groups + +### Example + +* Api Key Authentication (ApiToken): + +```python +import time +import groundlight_openapi_client +from groundlight_openapi_client.api import detectors_api +from groundlight_openapi_client.model.detector_group import DetectorGroup +from pprint import pprint +# Defining the host is optional and defaults to https://api.groundlight.ai/device-api +# See configuration.py for a list of all supported configuration parameters. +configuration = groundlight_openapi_client.Configuration( + host = "https://api.groundlight.ai/device-api" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: ApiToken +configuration.api_key['ApiToken'] = 'YOUR_API_KEY' + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['ApiToken'] = 'Bearer' + +# Enter a context with an instance of the API client +with groundlight_openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = detectors_api.DetectorsApi(api_client) + + # example, this endpoint has no required or optional parameters + try: + api_response = api_instance.get_detector_groups() + pprint(api_response) + except groundlight_openapi_client.ApiException as e: + print("Exception when calling DetectorsApi->get_detector_groups: %s\n" % e) +``` + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**[DetectorGroup]**](DetectorGroup.md) + +### Authorization + +[ApiToken](../README.md#ApiToken) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/ImageQuery.md b/generated/docs/ImageQuery.md index 92078b73..9589ee7d 100644 --- a/generated/docs/ImageQuery.md +++ b/generated/docs/ImageQuery.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **result** | **bool, date, datetime, dict, float, int, list, str, none_type** | The result of the image query. | [readonly] **patience_time** | **float** | How long to wait for a confident response. | [readonly] **confidence_threshold** | **float** | Min confidence needed to accept the response of the image query. | [readonly] +**bounding_boxes** | [**[ROI], none_type**](ROI.md) | An array of bounding boxes collected on image | [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/LabelValue.md b/generated/docs/LabelValue.md new file mode 100644 index 00000000..0e87465f --- /dev/null +++ b/generated/docs/LabelValue.md @@ -0,0 +1,23 @@ +# LabelValue + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**confidence** | **float, none_type** | | [readonly] +**class_name** | **str, none_type** | A human-readable class name for this label | [readonly] +**annotations_requested** | **[bool, date, datetime, dict, float, int, list, str, none_type]** | | [readonly] +**created_at** | **datetime** | | [readonly] +**detector_id** | **int, none_type** | | [readonly] +**deleted_at** | **datetime, none_type** | | [readonly] +**source** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [readonly] +**value** | **float, none_type** | | [optional] +**feedback_text** | **str, none_type** | | [optional] +**rois** | **bool, date, datetime, dict, float, int, list, str, none_type** | List of region-of-interest (ROI) annotations | [optional] +**flag_archived** | **bool, none_type** | | [optional] +**review_reason** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [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/LabelValueRequest.md b/generated/docs/LabelValueRequest.md new file mode 100644 index 00000000..431958dd --- /dev/null +++ b/generated/docs/LabelValueRequest.md @@ -0,0 +1,18 @@ +# LabelValueRequest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**label** | **str** | | +**posicheck_id** | **str** | | +**value** | **float, none_type** | | [optional] +**feedback_text** | **str, none_type** | | [optional] +**rois** | **bool, date, datetime, dict, float, int, list, str, none_type** | List of region-of-interest (ROI) annotations | [optional] +**flag_archived** | **bool, none_type** | | [optional] +**review_reason** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [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/LabelsApi.md b/generated/docs/LabelsApi.md new file mode 100644 index 00000000..91c66b38 --- /dev/null +++ b/generated/docs/LabelsApi.md @@ -0,0 +1,95 @@ +# groundlight_openapi_client.LabelsApi + +All URIs are relative to *https://api.groundlight.ai/device-api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**labels_create**](LabelsApi.md#labels_create) | **POST** /v1/labels | + + +# **labels_create** +> LabelValue labels_create(label_value_request) + + + +Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. + +### Example + +* Api Key Authentication (ApiToken): + +```python +import time +import groundlight_openapi_client +from groundlight_openapi_client.api import labels_api +from groundlight_openapi_client.model.label_value import LabelValue +from groundlight_openapi_client.model.label_value_request import LabelValueRequest +from pprint import pprint +# Defining the host is optional and defaults to https://api.groundlight.ai/device-api +# See configuration.py for a list of all supported configuration parameters. +configuration = groundlight_openapi_client.Configuration( + host = "https://api.groundlight.ai/device-api" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: ApiToken +configuration.api_key['ApiToken'] = 'YOUR_API_KEY' + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['ApiToken'] = 'Bearer' + +# Enter a context with an instance of the API client +with groundlight_openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = labels_api.LabelsApi(api_client) + label_value_request = LabelValueRequest( + label="label_example", + posicheck_id="posicheck_id_example", + value=3.14, + feedback_text="feedback_text_example", + rois=None, + flag_archived=True, + review_reason=None, + ) # LabelValueRequest | + + # example passing only required values which don't have defaults set + try: + api_response = api_instance.labels_create(label_value_request) + pprint(api_response) + except groundlight_openapi_client.ApiException as e: + print("Exception when calling LabelsApi->labels_create: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **label_value_request** | [**LabelValueRequest**](LabelValueRequest.md)| | + +### Return type + +[**LabelValue**](LabelValue.md) + +### Authorization + +[ApiToken](../README.md#ApiToken) + +### HTTP request headers + + - **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data + - **Accept**: application/json + + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/generated/docs/ModeEnum.md b/generated/docs/ModeEnum.md index 82b90c28..670fef49 100644 --- a/generated/docs/ModeEnum.md +++ b/generated/docs/ModeEnum.md @@ -1,11 +1,11 @@ # ModeEnum -* `BINARY` - BINARY * `COUNT` - COUNT +* `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**value** | **str** | * `BINARY` - BINARY * `COUNT` - COUNT | must be one of ["BINARY", "COUNT", ] +**value** | **str** | * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS | must be one of ["BINARY", "COUNT", "MULTI_CLASS", ] [[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/NullEnum.md b/generated/docs/NullEnum.md new file mode 100644 index 00000000..7cccbef2 --- /dev/null +++ b/generated/docs/NullEnum.md @@ -0,0 +1,11 @@ +# NullEnum + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **str** | | must be one of ["null", ] + +[[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/ROI.md b/generated/docs/ROI.md new file mode 100644 index 00000000..6172ec8f --- /dev/null +++ b/generated/docs/ROI.md @@ -0,0 +1,14 @@ +# ROI + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**label** | **str** | The label of the bounding box. | +**score** | **float** | The confidence of the bounding box. | +**geometry** | [**BBoxGeometry**](BBoxGeometry.md) | | +**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/ReviewReasonEnum.md b/generated/docs/ReviewReasonEnum.md new file mode 100644 index 00000000..6c042a26 --- /dev/null +++ b/generated/docs/ReviewReasonEnum.md @@ -0,0 +1,12 @@ +# ReviewReasonEnum + +* `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **str** | * `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER | must be one of ["ESCALATION", "AUDIT", "ASSESSMENT", "CUSTOMER_INITIATED", "CONFIDENT_UNCLEAR", "CONFIDENT_UNCLEAR_AUDIT", "DISAGREEMENT", "DISAGREEMENT_ON_ASSESSMENT", "CONFIRM_ACTION_TRIGGER", ] + +[[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/SourceEnum.md b/generated/docs/SourceEnum.md new file mode 100644 index 00000000..d2b0b9af --- /dev/null +++ b/generated/docs/SourceEnum.md @@ -0,0 +1,12 @@ +# SourceEnum + +* `INITIAL_PLACEHOLDER` - InitialPlaceholder * `CLOUD` - HumanCloud * `CUST` - HumanCustomer * `HUMAN_CLOUD_ENSEMBLE` - HumanCloudEnsemble * `ALG` - Algorithm * `ALG_REC` - AlgorithmReconciled * `ALG_UNCLEAR` - AlgorithmUnclear + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **str** | * `INITIAL_PLACEHOLDER` - InitialPlaceholder * `CLOUD` - HumanCloud * `CUST` - HumanCustomer * `HUMAN_CLOUD_ENSEMBLE` - HumanCloudEnsemble * `ALG` - Algorithm * `ALG_REC` - AlgorithmReconciled * `ALG_UNCLEAR` - AlgorithmUnclear | must be one of ["INITIAL_PLACEHOLDER", "CLOUD", "CUST", "HUMAN_CLOUD_ENSEMBLE", "ALG", "ALG_REC", "ALG_UNCLEAR", ] + +[[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/api/detectors_api.py b/generated/groundlight_openapi_client/api/detectors_api.py index 2d945476..48dd4912 100644 --- a/generated/groundlight_openapi_client/api/detectors_api.py +++ b/generated/groundlight_openapi_client/api/detectors_api.py @@ -23,6 +23,8 @@ ) from groundlight_openapi_client.model.detector import Detector from groundlight_openapi_client.model.detector_creation_input_request import DetectorCreationInputRequest +from groundlight_openapi_client.model.detector_group import DetectorGroup +from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest from groundlight_openapi_client.model.paginated_detector_list import PaginatedDetectorList @@ -72,6 +74,44 @@ def __init__(self, api_client=None): headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, api_client=api_client, ) + self.create_detector_group_endpoint = _Endpoint( + settings={ + "response_type": (DetectorGroup,), + "auth": ["ApiToken"], + "endpoint_path": "/v1/detectors/detector-groups", + "operation_id": "create_detector_group", + "http_method": "POST", + "servers": None, + }, + params_map={ + "all": [ + "detector_group_request", + ], + "required": [ + "detector_group_request", + ], + "nullable": [], + "enum": [], + "validation": [], + }, + root_map={ + "validations": {}, + "allowed_values": {}, + "openapi_types": { + "detector_group_request": (DetectorGroupRequest,), + }, + "attribute_map": {}, + "location_map": { + "detector_group_request": "body", + }, + "collection_format_map": {}, + }, + headers_map={ + "accept": ["application/json"], + "content_type": ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"], + }, + api_client=api_client, + ) self.delete_detector_endpoint = _Endpoint( settings={ "response_type": None, @@ -152,6 +192,30 @@ def __init__(self, api_client=None): }, api_client=api_client, ) + self.get_detector_groups_endpoint = _Endpoint( + settings={ + "response_type": ([DetectorGroup],), + "auth": ["ApiToken"], + "endpoint_path": "/v1/detectors/detector-groups", + "operation_id": "get_detector_groups", + "http_method": "GET", + "servers": None, + }, + params_map={"all": [], "required": [], "nullable": [], "enum": [], "validation": []}, + root_map={ + "validations": {}, + "allowed_values": {}, + "openapi_types": {}, + "attribute_map": {}, + "location_map": {}, + "collection_format_map": {}, + }, + headers_map={ + "accept": ["application/json"], + "content_type": [], + }, + api_client=api_client, + ) self.list_detectors_endpoint = _Endpoint( settings={ "response_type": (PaginatedDetectorList,), @@ -253,6 +317,64 @@ def create_detector(self, detector_creation_input_request, **kwargs): kwargs["detector_creation_input_request"] = detector_creation_input_request return self.create_detector_endpoint.call_with_http_info(**kwargs) + def create_detector_group(self, detector_group_request, **kwargs): + """create_detector_group # noqa: E501 + + Create a new detector group POST data: Required: - name (str) - name of the predictor set # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_detector_group(detector_group_request, async_req=True) + >>> result = thread.get() + + Args: + detector_group_request (DetectorGroupRequest): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + DetectorGroup + If the method is called asynchronously, returns the request + thread. + """ + kwargs["async_req"] = kwargs.get("async_req", False) + kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) + kwargs["_preload_content"] = kwargs.get("_preload_content", True) + kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) + kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) + kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) + kwargs["_content_type"] = kwargs.get("_content_type") + kwargs["_host_index"] = kwargs.get("_host_index") + kwargs["detector_group_request"] = detector_group_request + return self.create_detector_group_endpoint.call_with_http_info(**kwargs) + def delete_detector(self, id, **kwargs): """delete_detector # noqa: E501 @@ -369,6 +491,61 @@ def get_detector(self, id, **kwargs): kwargs["id"] = id return self.get_detector_endpoint.call_with_http_info(**kwargs) + def get_detector_groups(self, **kwargs): + """get_detector_groups # noqa: E501 + + List all detector groups # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_detector_groups(async_req=True) + >>> result = thread.get() + + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + [DetectorGroup] + If the method is called asynchronously, returns the request + thread. + """ + kwargs["async_req"] = kwargs.get("async_req", False) + kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) + kwargs["_preload_content"] = kwargs.get("_preload_content", True) + kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) + kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) + kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) + kwargs["_content_type"] = kwargs.get("_content_type") + kwargs["_host_index"] = kwargs.get("_host_index") + return self.get_detector_groups_endpoint.call_with_http_info(**kwargs) + def list_detectors(self, **kwargs): """list_detectors # noqa: E501 diff --git a/generated/groundlight_openapi_client/api/labels_api.py b/generated/groundlight_openapi_client/api/labels_api.py new file mode 100644 index 00000000..a0f1cb69 --- /dev/null +++ b/generated/groundlight_openapi_client/api/labels_api.py @@ -0,0 +1,134 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint +from groundlight_openapi_client.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types, +) +from groundlight_openapi_client.model.label_value import LabelValue +from groundlight_openapi_client.model.label_value_request import LabelValueRequest + + +class LabelsApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + self.labels_create_endpoint = _Endpoint( + settings={ + "response_type": (LabelValue,), + "auth": ["ApiToken"], + "endpoint_path": "/v1/labels", + "operation_id": "labels_create", + "http_method": "POST", + "servers": None, + }, + params_map={ + "all": [ + "label_value_request", + ], + "required": [ + "label_value_request", + ], + "nullable": [], + "enum": [], + "validation": [], + }, + root_map={ + "validations": {}, + "allowed_values": {}, + "openapi_types": { + "label_value_request": (LabelValueRequest,), + }, + "attribute_map": {}, + "location_map": { + "label_value_request": "body", + }, + "collection_format_map": {}, + }, + headers_map={ + "accept": ["application/json"], + "content_type": ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"], + }, + api_client=api_client, + ) + + def labels_create(self, label_value_request, **kwargs): + """labels_create # noqa: E501 + + Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.labels_create(label_value_request, async_req=True) + >>> result = thread.get() + + Args: + label_value_request (LabelValueRequest): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + LabelValue + If the method is called asynchronously, returns the request + thread. + """ + kwargs["async_req"] = kwargs.get("async_req", False) + kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) + kwargs["_preload_content"] = kwargs.get("_preload_content", True) + kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) + kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) + kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) + kwargs["_content_type"] = kwargs.get("_content_type") + kwargs["_host_index"] = kwargs.get("_host_index") + kwargs["label_value_request"] = label_value_request + return self.labels_create_endpoint.call_with_http_info(**kwargs) diff --git a/generated/groundlight_openapi_client/apis/__init__.py b/generated/groundlight_openapi_client/apis/__init__.py index 708c08e8..cfe291bf 100644 --- a/generated/groundlight_openapi_client/apis/__init__.py +++ b/generated/groundlight_openapi_client/apis/__init__.py @@ -16,5 +16,6 @@ from groundlight_openapi_client.api.actions_api import ActionsApi from groundlight_openapi_client.api.detectors_api import DetectorsApi from groundlight_openapi_client.api.image_queries_api import ImageQueriesApi +from groundlight_openapi_client.api.labels_api import LabelsApi from groundlight_openapi_client.api.notes_api import NotesApi from groundlight_openapi_client.api.user_api import UserApi diff --git a/generated/groundlight_openapi_client/model/annotations_requested_enum.py b/generated/groundlight_openapi_client/model/annotations_requested_enum.py new file mode 100644 index 00000000..dc037938 --- /dev/null +++ b/generated/groundlight_openapi_client/model/annotations_requested_enum.py @@ -0,0 +1,283 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +class AnnotationsRequestedEnum(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ("value",): { + "BINARY_CLASSIFICATION": "BINARY_CLASSIFICATION", + "BOUNDING_BOXES": "BOUNDING_BOXES", + }, + } + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "value": (str,), + } + + @cached_property + def discriminator(): + return None + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """AnnotationsRequestedEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): * `BINARY_CLASSIFICATION` - Binary Classification * `BOUNDING_BOXES` - Bounding Boxes., must be one of ["BINARY_CLASSIFICATION", "BOUNDING_BOXES", ] # noqa: E501 + + Keyword Args: + value (str): * `BINARY_CLASSIFICATION` - Binary Classification * `BOUNDING_BOXES` - Bounding Boxes., must be one of ["BINARY_CLASSIFICATION", "BOUNDING_BOXES", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """AnnotationsRequestedEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): * `BINARY_CLASSIFICATION` - Binary Classification * `BOUNDING_BOXES` - Bounding Boxes., must be one of ["BINARY_CLASSIFICATION", "BOUNDING_BOXES", ] # noqa: E501 + + Keyword Args: + value (str): * `BINARY_CLASSIFICATION` - Binary Classification * `BOUNDING_BOXES` - Bounding Boxes., must be one of ["BINARY_CLASSIFICATION", "BOUNDING_BOXES", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/generated/groundlight_openapi_client/model/b_box_geometry.py b/generated/groundlight_openapi_client/model/b_box_geometry.py new file mode 100644 index 00000000..b1c352d9 --- /dev/null +++ b/generated/groundlight_openapi_client/model/b_box_geometry.py @@ -0,0 +1,302 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +class BBoxGeometry(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = {} + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "left": (float,), # noqa: E501 + "top": (float,), # noqa: E501 + "right": (float,), # noqa: E501 + "bottom": (float,), # noqa: E501 + "x": (float,), # noqa: E501 + "y": (float,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "left": "left", # noqa: E501 + "top": "top", # noqa: E501 + "right": "right", # noqa: E501 + "bottom": "bottom", # noqa: E501 + "x": "x", # noqa: E501 + "y": "y", # noqa: E501 + } + + read_only_vars = { + "x", # noqa: E501 + "y", # noqa: E501 + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, left, top, right, bottom, x, y, *args, **kwargs): # noqa: E501 + """BBoxGeometry - a model defined in OpenAPI + + Args: + left (float): + top (float): + right (float): + bottom (float): + x (float): + y (float): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.left = left + self.top = top + self.right = right + self.bottom = bottom + self.x = x + self.y = y + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, left, top, right, bottom, *args, **kwargs): # noqa: E501 + """BBoxGeometry - a model defined in OpenAPI + + Args: + left (float): + top (float): + right (float): + bottom (float): + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.left = left + self.top = top + self.right = right + self.bottom = bottom + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError( + f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + "class with read only attributes." + ) diff --git a/generated/groundlight_openapi_client/model/blank_enum.py b/generated/groundlight_openapi_client/model/blank_enum.py new file mode 100644 index 00000000..8f634d5b --- /dev/null +++ b/generated/groundlight_openapi_client/model/blank_enum.py @@ -0,0 +1,274 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +class BlankEnum(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ("value",): { + "EMPTY": "", + }, + } + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "value": (str,), + } + + @cached_property + def discriminator(): + return None + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """BlankEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): if omitted defaults to "", must be one of ["", ] # noqa: E501 + + Keyword Args: + value (str): if omitted defaults to "", must be one of ["", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + value = "" + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """BlankEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): if omitted defaults to "", must be one of ["", ] # noqa: E501 + + Keyword Args: + value (str): if omitted defaults to "", must be one of ["", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + value = "" + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self 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 ae9681b1..4012e075 100644 --- a/generated/groundlight_openapi_client/model/detector_creation_input_request.py +++ b/generated/groundlight_openapi_client/model/detector_creation_input_request.py @@ -223,7 +223,7 @@ def _from_openapi_data(cls, name, query, *args, **kwargs): # noqa: E501 patience_time (float): How long Groundlight will attempt to generate a confident prediction. [optional] if omitted the server will use the default value of 30.0 # noqa: E501 pipeline_config (str, none_type): (Advanced usage) Configuration needed to instantiate a prediction pipeline.. [optional] # noqa: E501 metadata (str): Base64-encoded metadata for the detector. This should be a JSON object with string keys. The size after encoding should not exceed 1362 bytes, corresponding to 1KiB before encoding.. [optional] # noqa: E501 - mode (bool, date, datetime, dict, float, int, list, str, none_type): Mode in which this detector will work. * `BINARY` - BINARY * `COUNT` - COUNT. [optional] # noqa: E501 + mode (bool, date, datetime, dict, float, int, list, str, none_type): Mode in which this detector will work. * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS. [optional] # noqa: E501 mode_configuration (bool, date, datetime, dict, float, int, list, str, none_type): Configuration for each detector mode.. [optional] # noqa: E501 """ @@ -320,7 +320,7 @@ def __init__(self, name, query, *args, **kwargs): # noqa: E501 patience_time (float): How long Groundlight will attempt to generate a confident prediction. [optional] if omitted the server will use the default value of 30.0 # noqa: E501 pipeline_config (str, none_type): (Advanced usage) Configuration needed to instantiate a prediction pipeline.. [optional] # noqa: E501 metadata (str): Base64-encoded metadata for the detector. This should be a JSON object with string keys. The size after encoding should not exceed 1362 bytes, corresponding to 1KiB before encoding.. [optional] # noqa: E501 - mode (bool, date, datetime, dict, float, int, list, str, none_type): Mode in which this detector will work. * `BINARY` - BINARY * `COUNT` - COUNT. [optional] # noqa: E501 + mode (bool, date, datetime, dict, float, int, list, str, none_type): Mode in which this detector will work. * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS. [optional] # noqa: E501 mode_configuration (bool, date, datetime, dict, float, int, list, str, none_type): Configuration for each detector mode.. [optional] # noqa: E501 """ diff --git a/generated/groundlight_openapi_client/model/detector_group.py b/generated/groundlight_openapi_client/model/detector_group.py new file mode 100644 index 00000000..bed76807 --- /dev/null +++ b/generated/groundlight_openapi_client/model/detector_group.py @@ -0,0 +1,283 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +class DetectorGroup(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = { + ("name",): { + "max_length": 100, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "id": (str,), # noqa: E501 + "name": (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "id": "id", # noqa: E501 + "name": "name", # noqa: E501 + } + + read_only_vars = { + "id", # noqa: E501 + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, id, name, *args, **kwargs): # noqa: E501 + """DetectorGroup - a model defined in OpenAPI + + Args: + id (str): + name (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.id = id + self.name = name + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, name, *args, **kwargs): # noqa: E501 + """DetectorGroup - a model defined in OpenAPI + + name (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.name = name + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError( + f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + "class with read only attributes." + ) diff --git a/generated/groundlight_openapi_client/model/detector_group_request.py b/generated/groundlight_openapi_client/model/detector_group_request.py new file mode 100644 index 00000000..0730767f --- /dev/null +++ b/generated/groundlight_openapi_client/model/detector_group_request.py @@ -0,0 +1,279 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +class DetectorGroupRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = { + ("name",): { + "max_length": 100, + "min_length": 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "name": (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "name": "name", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, name, *args, **kwargs): # noqa: E501 + """DetectorGroupRequest - a model defined in OpenAPI + + Args: + name (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.name = name + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, name, *args, **kwargs): # noqa: E501 + """DetectorGroupRequest - a model defined in OpenAPI + + Args: + name (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.name = name + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError( + f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + "class with read only attributes." + ) diff --git a/generated/groundlight_openapi_client/model/image_query.py b/generated/groundlight_openapi_client/model/image_query.py index cb570040..e5b18667 100644 --- a/generated/groundlight_openapi_client/model/image_query.py +++ b/generated/groundlight_openapi_client/model/image_query.py @@ -34,10 +34,12 @@ def lazy_import(): from groundlight_openapi_client.model.counting_result import CountingResult from groundlight_openapi_client.model.image_query_type_enum import ImageQueryTypeEnum from groundlight_openapi_client.model.result_type_enum import ResultTypeEnum + from groundlight_openapi_client.model.roi import ROI globals()["BinaryClassificationResult"] = BinaryClassificationResult globals()["CountingResult"] = CountingResult globals()["ImageQueryTypeEnum"] = ImageQueryTypeEnum + globals()["ROI"] = ROI globals()["ResultTypeEnum"] = ResultTypeEnum @@ -145,6 +147,10 @@ def openapi_types(): ), # noqa: E501 "patience_time": (float,), # noqa: E501 "confidence_threshold": (float,), # noqa: E501 + "bounding_boxes": ( + [ROI], + none_type, + ), # noqa: E501 } @cached_property @@ -162,6 +168,7 @@ def discriminator(): "result": "result", # noqa: E501 "patience_time": "patience_time", # noqa: E501 "confidence_threshold": "confidence_threshold", # noqa: E501 + "bounding_boxes": "bounding_boxes", # noqa: E501 } read_only_vars = { @@ -175,6 +182,7 @@ def discriminator(): "result", # noqa: E501 "patience_time", # noqa: E501 "confidence_threshold", # noqa: E501 + "bounding_boxes", # noqa: E501 } _composed_schemas = {} @@ -193,6 +201,7 @@ def _from_openapi_data( result, patience_time, confidence_threshold, + bounding_boxes, *args, **kwargs, ): # noqa: E501 @@ -209,6 +218,7 @@ def _from_openapi_data( result (bool, date, datetime, dict, float, int, list, str, none_type): The result of the image query. patience_time (float): How long to wait for a confident response. confidence_threshold (float): Min confidence needed to accept the response of the image query. + bounding_boxes ([ROI], none_type): An array of bounding boxes collected on image Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -279,6 +289,7 @@ def _from_openapi_data( self.result = result self.patience_time = patience_time self.confidence_threshold = confidence_threshold + self.bounding_boxes = bounding_boxes for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map diff --git a/generated/groundlight_openapi_client/model/label_value.py b/generated/groundlight_openapi_client/model/label_value.py new file mode 100644 index 00000000..4722a693 --- /dev/null +++ b/generated/groundlight_openapi_client/model/label_value.py @@ -0,0 +1,391 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +def lazy_import(): + from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum + from groundlight_openapi_client.model.blank_enum import BlankEnum + from groundlight_openapi_client.model.null_enum import NullEnum + from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum + from groundlight_openapi_client.model.source_enum import SourceEnum + + globals()["AnnotationsRequestedEnum"] = AnnotationsRequestedEnum + globals()["BlankEnum"] = BlankEnum + globals()["NullEnum"] = NullEnum + globals()["ReviewReasonEnum"] = ReviewReasonEnum + globals()["SourceEnum"] = SourceEnum + + +class LabelValue(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = {} + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + "confidence": ( + float, + none_type, + ), # noqa: E501 + "class_name": ( + str, + none_type, + ), # noqa: E501 + "annotations_requested": ([bool, date, datetime, dict, float, int, list, str, none_type],), # noqa: E501 + "created_at": (datetime,), # noqa: E501 + "detector_id": ( + int, + none_type, + ), # noqa: E501 + "deleted_at": ( + datetime, + none_type, + ), # noqa: E501 + "source": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ), # noqa: E501 + "value": ( + float, + none_type, + ), # noqa: E501 + "feedback_text": ( + str, + none_type, + ), # noqa: E501 + "rois": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ), # noqa: E501 + "flag_archived": ( + bool, + none_type, + ), # noqa: E501 + "review_reason": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "confidence": "confidence", # noqa: E501 + "class_name": "class_name", # noqa: E501 + "annotations_requested": "annotations_requested", # noqa: E501 + "created_at": "created_at", # noqa: E501 + "detector_id": "detector_id", # noqa: E501 + "deleted_at": "deleted_at", # noqa: E501 + "source": "source", # noqa: E501 + "value": "value", # noqa: E501 + "feedback_text": "feedback_text", # noqa: E501 + "rois": "rois", # noqa: E501 + "flag_archived": "flag_archived", # noqa: E501 + "review_reason": "review_reason", # noqa: E501 + } + + read_only_vars = { + "confidence", # noqa: E501 + "class_name", # noqa: E501 + "annotations_requested", # noqa: E501 + "created_at", # noqa: E501 + "detector_id", # noqa: E501 + "deleted_at", # noqa: E501 + "source", # noqa: E501 + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data( + cls, confidence, class_name, annotations_requested, created_at, detector_id, deleted_at, source, *args, **kwargs + ): # noqa: E501 + """LabelValue - a model defined in OpenAPI + + Args: + confidence (float, none_type): + class_name (str, none_type): A human-readable class name for this label + annotations_requested ([bool, date, datetime, dict, float, int, list, str, none_type]): + created_at (datetime): + detector_id (int, none_type): + deleted_at (datetime, none_type): + source (bool, date, datetime, dict, float, int, list, str, none_type): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + value (float, none_type): [optional] # noqa: E501 + feedback_text (str, none_type): [optional] # noqa: E501 + rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 + flag_archived (bool, none_type): [optional] # noqa: E501 + review_reason (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.confidence = confidence + self.class_name = class_name + self.annotations_requested = annotations_requested + self.created_at = created_at + self.detector_id = detector_id + self.deleted_at = deleted_at + self.source = source + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """LabelValue - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + value (float, none_type): [optional] # noqa: E501 + feedback_text (str, none_type): [optional] # noqa: E501 + rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 + flag_archived (bool, none_type): [optional] # noqa: E501 + review_reason (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError( + f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + "class with read only attributes." + ) diff --git a/generated/groundlight_openapi_client/model/label_value_request.py b/generated/groundlight_openapi_client/model/label_value_request.py new file mode 100644 index 00000000..7f5d56b8 --- /dev/null +++ b/generated/groundlight_openapi_client/model/label_value_request.py @@ -0,0 +1,348 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +def lazy_import(): + from groundlight_openapi_client.model.blank_enum import BlankEnum + from groundlight_openapi_client.model.null_enum import NullEnum + from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum + + globals()["BlankEnum"] = BlankEnum + globals()["NullEnum"] = NullEnum + globals()["ReviewReasonEnum"] = ReviewReasonEnum + + +class LabelValueRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = { + ("label",): { + "min_length": 1, + }, + ("posicheck_id",): { + "min_length": 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + "label": (str,), # noqa: E501 + "posicheck_id": (str,), # noqa: E501 + "value": ( + float, + none_type, + ), # noqa: E501 + "feedback_text": ( + str, + none_type, + ), # noqa: E501 + "rois": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ), # noqa: E501 + "flag_archived": ( + bool, + none_type, + ), # noqa: E501 + "review_reason": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "label": "label", # noqa: E501 + "posicheck_id": "posicheck_id", # noqa: E501 + "value": "value", # noqa: E501 + "feedback_text": "feedback_text", # noqa: E501 + "rois": "rois", # noqa: E501 + "flag_archived": "flag_archived", # noqa: E501 + "review_reason": "review_reason", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, label, posicheck_id, *args, **kwargs): # noqa: E501 + """LabelValueRequest - a model defined in OpenAPI + + Args: + label (str): + posicheck_id (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + value (float, none_type): [optional] # noqa: E501 + feedback_text (str, none_type): [optional] # noqa: E501 + rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 + flag_archived (bool, none_type): [optional] # noqa: E501 + review_reason (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.label = label + self.posicheck_id = posicheck_id + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, label, posicheck_id, *args, **kwargs): # noqa: E501 + """LabelValueRequest - a model defined in OpenAPI + + Args: + label (str): + posicheck_id (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + value (float, none_type): [optional] # noqa: E501 + feedback_text (str, none_type): [optional] # noqa: E501 + rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 + flag_archived (bool, none_type): [optional] # noqa: E501 + review_reason (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.label = label + self.posicheck_id = posicheck_id + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError( + f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + "class with read only attributes." + ) diff --git a/generated/groundlight_openapi_client/model/mode_enum.py b/generated/groundlight_openapi_client/model/mode_enum.py index 2c5e8c97..41f460b2 100644 --- a/generated/groundlight_openapi_client/model/mode_enum.py +++ b/generated/groundlight_openapi_client/model/mode_enum.py @@ -53,6 +53,7 @@ class ModeEnum(ModelSimple): ("value",): { "BINARY": "BINARY", "COUNT": "COUNT", + "MULTI_CLASS": "MULTI_CLASS", }, } @@ -102,10 +103,10 @@ def __init__(self, *args, **kwargs): Note that value can be passed either in args or in kwargs, but not in both. Args: - args[0] (str): * `BINARY` - BINARY * `COUNT` - COUNT., must be one of ["BINARY", "COUNT", ] # noqa: E501 + args[0] (str): * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS., must be one of ["BINARY", "COUNT", "MULTI_CLASS", ] # noqa: E501 Keyword Args: - value (str): * `BINARY` - BINARY * `COUNT` - COUNT., must be one of ["BINARY", "COUNT", ] # noqa: E501 + value (str): * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS., must be one of ["BINARY", "COUNT", "MULTI_CLASS", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. @@ -194,10 +195,10 @@ def _from_openapi_data(cls, *args, **kwargs): Note that value can be passed either in args or in kwargs, but not in both. Args: - args[0] (str): * `BINARY` - BINARY * `COUNT` - COUNT., must be one of ["BINARY", "COUNT", ] # noqa: E501 + args[0] (str): * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS., must be one of ["BINARY", "COUNT", "MULTI_CLASS", ] # noqa: E501 Keyword Args: - value (str): * `BINARY` - BINARY * `COUNT` - COUNT., must be one of ["BINARY", "COUNT", ] # noqa: E501 + value (str): * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS., must be one of ["BINARY", "COUNT", "MULTI_CLASS", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. diff --git a/generated/groundlight_openapi_client/model/null_enum.py b/generated/groundlight_openapi_client/model/null_enum.py new file mode 100644 index 00000000..e1e8c4f5 --- /dev/null +++ b/generated/groundlight_openapi_client/model/null_enum.py @@ -0,0 +1,282 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +class NullEnum(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ("value",): { + "NULL": "null", + }, + } + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "value": (str,), + } + + @cached_property + def discriminator(): + return None + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """NullEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str):, must be one of ["null", ] # noqa: E501 + + Keyword Args: + value (str):, must be one of ["null", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """NullEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str):, must be one of ["null", ] # noqa: E501 + + Keyword Args: + value (str):, must be one of ["null", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/generated/groundlight_openapi_client/model/review_reason_enum.py b/generated/groundlight_openapi_client/model/review_reason_enum.py new file mode 100644 index 00000000..ac2cdabf --- /dev/null +++ b/generated/groundlight_openapi_client/model/review_reason_enum.py @@ -0,0 +1,290 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +class ReviewReasonEnum(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ("value",): { + "ESCALATION": "ESCALATION", + "AUDIT": "AUDIT", + "ASSESSMENT": "ASSESSMENT", + "CUSTOMER_INITIATED": "CUSTOMER_INITIATED", + "CONFIDENT_UNCLEAR": "CONFIDENT_UNCLEAR", + "CONFIDENT_UNCLEAR_AUDIT": "CONFIDENT_UNCLEAR_AUDIT", + "DISAGREEMENT": "DISAGREEMENT", + "DISAGREEMENT_ON_ASSESSMENT": "DISAGREEMENT_ON_ASSESSMENT", + "CONFIRM_ACTION_TRIGGER": "CONFIRM_ACTION_TRIGGER", + }, + } + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "value": (str,), + } + + @cached_property + def discriminator(): + return None + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """ReviewReasonEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): * `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER., must be one of ["ESCALATION", "AUDIT", "ASSESSMENT", "CUSTOMER_INITIATED", "CONFIDENT_UNCLEAR", "CONFIDENT_UNCLEAR_AUDIT", "DISAGREEMENT", "DISAGREEMENT_ON_ASSESSMENT", "CONFIRM_ACTION_TRIGGER", ] # noqa: E501 + + Keyword Args: + value (str): * `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER., must be one of ["ESCALATION", "AUDIT", "ASSESSMENT", "CUSTOMER_INITIATED", "CONFIDENT_UNCLEAR", "CONFIDENT_UNCLEAR_AUDIT", "DISAGREEMENT", "DISAGREEMENT_ON_ASSESSMENT", "CONFIRM_ACTION_TRIGGER", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """ReviewReasonEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): * `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER., must be one of ["ESCALATION", "AUDIT", "ASSESSMENT", "CUSTOMER_INITIATED", "CONFIDENT_UNCLEAR", "CONFIDENT_UNCLEAR_AUDIT", "DISAGREEMENT", "DISAGREEMENT_ON_ASSESSMENT", "CONFIRM_ACTION_TRIGGER", ] # noqa: E501 + + Keyword Args: + value (str): * `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER., must be one of ["ESCALATION", "AUDIT", "ASSESSMENT", "CUSTOMER_INITIATED", "CONFIDENT_UNCLEAR", "CONFIDENT_UNCLEAR_AUDIT", "DISAGREEMENT", "DISAGREEMENT_ON_ASSESSMENT", "CONFIRM_ACTION_TRIGGER", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/generated/groundlight_openapi_client/model/roi.py b/generated/groundlight_openapi_client/model/roi.py new file mode 100644 index 00000000..af2d2077 --- /dev/null +++ b/generated/groundlight_openapi_client/model/roi.py @@ -0,0 +1,294 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +def lazy_import(): + from groundlight_openapi_client.model.b_box_geometry import BBoxGeometry + + globals()["BBoxGeometry"] = BBoxGeometry + + +class ROI(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = {} + + validations = {} + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + "label": (str,), # noqa: E501 + "score": (float,), # noqa: E501 + "geometry": (BBoxGeometry,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "label": "label", # noqa: E501 + "score": "score", # noqa: E501 + "geometry": "geometry", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, label, score, geometry, *args, **kwargs): # noqa: E501 + """ROI - a model defined in OpenAPI + + Args: + label (str): The label of the bounding box. + score (float): The confidence of the bounding box. + geometry (BBoxGeometry): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.label = label + self.score = score + self.geometry = geometry + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, label, score, geometry, *args, **kwargs): # noqa: E501 + """ROI - a model defined in OpenAPI + + Args: + label (str): The label of the bounding box. + score (float): The confidence of the bounding box. + geometry (BBoxGeometry): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _path_to_item = kwargs.pop("_path_to_item", ()) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.label = label + self.score = score + self.geometry = geometry + for var_name, var_value in kwargs.items(): + if ( + var_name not in self.attribute_map + and self._configuration is not None + and self._configuration.discard_unknown_keys + and self.additional_properties_type is None + ): + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError( + f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + "class with read only attributes." + ) diff --git a/generated/groundlight_openapi_client/model/source_enum.py b/generated/groundlight_openapi_client/model/source_enum.py new file mode 100644 index 00000000..cb24e36a --- /dev/null +++ b/generated/groundlight_openapi_client/model/source_enum.py @@ -0,0 +1,288 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 + +from groundlight_openapi_client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel, +) +from groundlight_openapi_client.exceptions import ApiAttributeError + + +class SourceEnum(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ("value",): { + "INITIAL_PLACEHOLDER": "INITIAL_PLACEHOLDER", + "CLOUD": "CLOUD", + "CUST": "CUST", + "HUMAN_CLOUD_ENSEMBLE": "HUMAN_CLOUD_ENSEMBLE", + "ALG": "ALG", + "ALG_REC": "ALG_REC", + "ALG_UNCLEAR": "ALG_UNCLEAR", + }, + } + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "value": (str,), + } + + @cached_property + def discriminator(): + return None + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """SourceEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): * `INITIAL_PLACEHOLDER` - InitialPlaceholder * `CLOUD` - HumanCloud * `CUST` - HumanCustomer * `HUMAN_CLOUD_ENSEMBLE` - HumanCloudEnsemble * `ALG` - Algorithm * `ALG_REC` - AlgorithmReconciled * `ALG_UNCLEAR` - AlgorithmUnclear., must be one of ["INITIAL_PLACEHOLDER", "CLOUD", "CUST", "HUMAN_CLOUD_ENSEMBLE", "ALG", "ALG_REC", "ALG_UNCLEAR", ] # noqa: E501 + + Keyword Args: + value (str): * `INITIAL_PLACEHOLDER` - InitialPlaceholder * `CLOUD` - HumanCloud * `CUST` - HumanCustomer * `HUMAN_CLOUD_ENSEMBLE` - HumanCloudEnsemble * `ALG` - Algorithm * `ALG_REC` - AlgorithmReconciled * `ALG_UNCLEAR` - AlgorithmUnclear., must be one of ["INITIAL_PLACEHOLDER", "CLOUD", "CUST", "HUMAN_CLOUD_ENSEMBLE", "ALG", "ALG_REC", "ALG_UNCLEAR", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """SourceEnum - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): * `INITIAL_PLACEHOLDER` - InitialPlaceholder * `CLOUD` - HumanCloud * `CUST` - HumanCustomer * `HUMAN_CLOUD_ENSEMBLE` - HumanCloudEnsemble * `ALG` - Algorithm * `ALG_REC` - AlgorithmReconciled * `ALG_UNCLEAR` - AlgorithmUnclear., must be one of ["INITIAL_PLACEHOLDER", "CLOUD", "CUST", "HUMAN_CLOUD_ENSEMBLE", "ALG", "ALG_REC", "ALG_UNCLEAR", ] # noqa: E501 + + Keyword Args: + value (str): * `INITIAL_PLACEHOLDER` - InitialPlaceholder * `CLOUD` - HumanCloud * `CUST` - HumanCustomer * `HUMAN_CLOUD_ENSEMBLE` - HumanCloudEnsemble * `ALG` - Algorithm * `ALG_REC` - AlgorithmReconciled * `ALG_UNCLEAR` - AlgorithmUnclear., must be one of ["INITIAL_PLACEHOLDER", "CLOUD", "CUST", "HUMAN_CLOUD_ENSEMBLE", "ALG", "ALG_REC", "ALG_UNCLEAR", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/generated/groundlight_openapi_client/models/__init__.py b/generated/groundlight_openapi_client/models/__init__.py index cb0c2ca1..88c5fa3c 100644 --- a/generated/groundlight_openapi_client/models/__init__.py +++ b/generated/groundlight_openapi_client/models/__init__.py @@ -12,25 +12,36 @@ from groundlight_openapi_client.model.action import Action from groundlight_openapi_client.model.action_request import ActionRequest from groundlight_openapi_client.model.all_notes import AllNotes +from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum +from groundlight_openapi_client.model.b_box_geometry import BBoxGeometry from groundlight_openapi_client.model.binary_classification_result import BinaryClassificationResult +from groundlight_openapi_client.model.blank_enum import BlankEnum from groundlight_openapi_client.model.channel_enum import ChannelEnum from groundlight_openapi_client.model.condition import Condition from groundlight_openapi_client.model.condition_request import ConditionRequest from groundlight_openapi_client.model.counting_result import CountingResult from groundlight_openapi_client.model.detector import Detector from groundlight_openapi_client.model.detector_creation_input_request import DetectorCreationInputRequest +from groundlight_openapi_client.model.detector_group import DetectorGroup +from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest from groundlight_openapi_client.model.detector_type_enum import DetectorTypeEnum from groundlight_openapi_client.model.image_query import ImageQuery from groundlight_openapi_client.model.image_query_type_enum import ImageQueryTypeEnum from groundlight_openapi_client.model.inline_response200 import InlineResponse200 +from groundlight_openapi_client.model.label_value import LabelValue +from groundlight_openapi_client.model.label_value_request import LabelValueRequest from groundlight_openapi_client.model.mode_enum import ModeEnum from groundlight_openapi_client.model.note import Note from groundlight_openapi_client.model.note_request import NoteRequest +from groundlight_openapi_client.model.null_enum import NullEnum from groundlight_openapi_client.model.paginated_detector_list import PaginatedDetectorList from groundlight_openapi_client.model.paginated_image_query_list import PaginatedImageQueryList from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList +from groundlight_openapi_client.model.roi import ROI from groundlight_openapi_client.model.result_type_enum import ResultTypeEnum +from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum from groundlight_openapi_client.model.rule import Rule from groundlight_openapi_client.model.rule_request import RuleRequest from groundlight_openapi_client.model.snooze_time_unit_enum import SnoozeTimeUnitEnum +from groundlight_openapi_client.model.source_enum import SourceEnum from groundlight_openapi_client.model.verb_enum import VerbEnum diff --git a/generated/model.py b/generated/model.py index 237e66a8..0f717f15 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2024-07-19T21:02:15+00:00 +# timestamp: 2024-07-30T22:02:00+00:00 from __future__ import annotations @@ -11,6 +11,29 @@ from pydantic import AnyUrl, BaseModel, Field, confloat, conint, constr +class AnnotationsRequestedEnum(Enum): + """ + * `BINARY_CLASSIFICATION` - Binary Classification + * `BOUNDING_BOXES` - Bounding Boxes + """ + + BINARY_CLASSIFICATION = "BINARY_CLASSIFICATION" + BOUNDING_BOXES = "BOUNDING_BOXES" + + +class BBoxGeometry(BaseModel): + left: float + top: float + right: float + bottom: float + x: float + y: float + + +class BlankEnum(Enum): + field_ = "" + + class ChannelEnum(Enum): """ * `EMAIL` - EMAIL @@ -21,6 +44,15 @@ class ChannelEnum(Enum): TEXT = "TEXT" +class DetectorGroup(BaseModel): + id: str + name: constr(max_length=100) + + +class DetectorGroupRequest(BaseModel): + name: constr(min_length=1, max_length=100) + + class DetectorTypeEnum(Enum): detector = "detector" @@ -33,10 +65,12 @@ class ModeEnum(Enum): """ * `BINARY` - BINARY * `COUNT` - COUNT + * `MULTI_CLASS` - MULTI_CLASS """ BINARY = "BINARY" COUNT = "COUNT" + MULTI_CLASS = "MULTI_CLASS" class Note(BaseModel): @@ -48,11 +82,45 @@ class NoteRequest(BaseModel): content: constr(min_length=1) = Field(..., description="Text content of the note.") +class NullEnum(Enum): + NoneType_None = None + + +class ROI(BaseModel): + label: str = Field(..., description="The label of the bounding box.") + score: float = Field(..., description="The confidence of the bounding box.") + geometry: BBoxGeometry + + class ResultTypeEnum(Enum): binary_classification = "binary_classification" counting = "counting" +class ReviewReasonEnum(Enum): + """ + * `ESCALATION` - ESCALATION + * `AUDIT` - AUDIT + * `ASSESSMENT` - ASSESSMENT + * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED + * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR + * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT + * `DISAGREEMENT` - DISAGREEMENT + * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT + * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER + """ + + ESCALATION = "ESCALATION" + AUDIT = "AUDIT" + ASSESSMENT = "ASSESSMENT" + CUSTOMER_INITIATED = "CUSTOMER_INITIATED" + CONFIDENT_UNCLEAR = "CONFIDENT_UNCLEAR" + CONFIDENT_UNCLEAR_AUDIT = "CONFIDENT_UNCLEAR_AUDIT" + DISAGREEMENT = "DISAGREEMENT" + DISAGREEMENT_ON_ASSESSMENT = "DISAGREEMENT_ON_ASSESSMENT" + CONFIRM_ACTION_TRIGGER = "CONFIRM_ACTION_TRIGGER" + + class SnoozeTimeUnitEnum(Enum): """ * `DAYS` - DAYS @@ -67,6 +135,26 @@ class SnoozeTimeUnitEnum(Enum): SECONDS = "SECONDS" +class SourceEnum(Enum): + """ + * `INITIAL_PLACEHOLDER` - InitialPlaceholder + * `CLOUD` - HumanCloud + * `CUST` - HumanCustomer + * `HUMAN_CLOUD_ENSEMBLE` - HumanCloudEnsemble + * `ALG` - Algorithm + * `ALG_REC` - AlgorithmReconciled + * `ALG_UNCLEAR` - AlgorithmUnclear + """ + + INITIAL_PLACEHOLDER = "INITIAL_PLACEHOLDER" + CLOUD = "CLOUD" + CUST = "CUST" + HUMAN_CLOUD_ENSEMBLE = "HUMAN_CLOUD_ENSEMBLE" + ALG = "ALG" + ALG_REC = "ALG_REC" + ALG_UNCLEAR = "ALG_UNCLEAR" + + class VerbEnum(Enum): """ * `ANSWERED_CONSECUTIVELY` - ANSWERED_CONSECUTIVELY @@ -180,7 +268,11 @@ class DetectorCreationInputRequest(BaseModel): ), ) mode: ModeEnum = Field( - "BINARY", description="Mode in which this detector will work.\n\n* `BINARY` - BINARY\n* `COUNT` - COUNT" + "BINARY", + description=( + "Mode in which this detector will work.\n\n* `BINARY` - BINARY\n* `COUNT` - COUNT\n* `MULTI_CLASS` -" + " MULTI_CLASS" + ), ) mode_configuration: Optional[Any] = Field(None, description="Configuration for each detector mode.") @@ -204,6 +296,32 @@ class ImageQuery(BaseModel): confidence_threshold: float = Field( ..., description="Min confidence needed to accept the response of the image query." ) + bounding_boxes: Optional[List[ROI]] = Field(..., description="An array of bounding boxes collected on image") + + +class LabelValue(BaseModel): + value: Optional[float] = None + confidence: Optional[float] = Field(...) + class_name: Optional[str] = Field(..., description="A human-readable class name for this label") + feedback_text: Optional[str] = None + rois: Optional[Any] = Field(None, description="List of region-of-interest (ROI) annotations") + flag_archived: Optional[bool] = None + annotations_requested: List[AnnotationsRequestedEnum] + review_reason: Optional[Union[ReviewReasonEnum, BlankEnum, NullEnum]] = None + created_at: datetime + detector_id: Optional[int] = Field(...) + deleted_at: Optional[datetime] = Field(...) + source: SourceEnum + + +class LabelValueRequest(BaseModel): + label: constr(min_length=1) + posicheck_id: constr(min_length=1) + value: Optional[float] = None + feedback_text: Optional[str] = None + rois: Optional[Any] = Field(None, description="List of region-of-interest (ROI) annotations") + flag_archived: Optional[bool] = None + review_reason: Optional[Union[ReviewReasonEnum, BlankEnum, NullEnum]] = None class PaginatedDetectorList(BaseModel): diff --git a/generated/test/test_annotations_requested_enum.py b/generated/test/test_annotations_requested_enum.py new file mode 100644 index 00000000..e140ffff --- /dev/null +++ b/generated/test/test_annotations_requested_enum.py @@ -0,0 +1,35 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum + + +class TestAnnotationsRequestedEnum(unittest.TestCase): + """AnnotationsRequestedEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAnnotationsRequestedEnum(self): + """Test AnnotationsRequestedEnum""" + # FIXME: construct object with mandatory attributes with example values + # model = AnnotationsRequestedEnum() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_b_box_geometry.py b/generated/test/test_b_box_geometry.py new file mode 100644 index 00000000..b3236b8d --- /dev/null +++ b/generated/test/test_b_box_geometry.py @@ -0,0 +1,35 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.b_box_geometry import BBoxGeometry + + +class TestBBoxGeometry(unittest.TestCase): + """BBoxGeometry unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testBBoxGeometry(self): + """Test BBoxGeometry""" + # FIXME: construct object with mandatory attributes with example values + # model = BBoxGeometry() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_blank_enum.py b/generated/test/test_blank_enum.py new file mode 100644 index 00000000..14707bf4 --- /dev/null +++ b/generated/test/test_blank_enum.py @@ -0,0 +1,35 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.blank_enum import BlankEnum + + +class TestBlankEnum(unittest.TestCase): + """BlankEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testBlankEnum(self): + """Test BlankEnum""" + # FIXME: construct object with mandatory attributes with example values + # model = BlankEnum() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_detector_group.py b/generated/test/test_detector_group.py new file mode 100644 index 00000000..5bc99858 --- /dev/null +++ b/generated/test/test_detector_group.py @@ -0,0 +1,35 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.detector_group import DetectorGroup + + +class TestDetectorGroup(unittest.TestCase): + """DetectorGroup unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDetectorGroup(self): + """Test DetectorGroup""" + # FIXME: construct object with mandatory attributes with example values + # model = DetectorGroup() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_detector_group_request.py b/generated/test/test_detector_group_request.py new file mode 100644 index 00000000..68cd611f --- /dev/null +++ b/generated/test/test_detector_group_request.py @@ -0,0 +1,35 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest + + +class TestDetectorGroupRequest(unittest.TestCase): + """DetectorGroupRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDetectorGroupRequest(self): + """Test DetectorGroupRequest""" + # FIXME: construct object with mandatory attributes with example values + # model = DetectorGroupRequest() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_label_value.py b/generated/test/test_label_value.py new file mode 100644 index 00000000..23d239cc --- /dev/null +++ b/generated/test/test_label_value.py @@ -0,0 +1,46 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum +from groundlight_openapi_client.model.blank_enum import BlankEnum +from groundlight_openapi_client.model.null_enum import NullEnum +from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum +from groundlight_openapi_client.model.source_enum import SourceEnum + +globals()["AnnotationsRequestedEnum"] = AnnotationsRequestedEnum +globals()["BlankEnum"] = BlankEnum +globals()["NullEnum"] = NullEnum +globals()["ReviewReasonEnum"] = ReviewReasonEnum +globals()["SourceEnum"] = SourceEnum +from groundlight_openapi_client.model.label_value import LabelValue + + +class TestLabelValue(unittest.TestCase): + """LabelValue unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testLabelValue(self): + """Test LabelValue""" + # FIXME: construct object with mandatory attributes with example values + # model = LabelValue() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_label_value_request.py b/generated/test/test_label_value_request.py new file mode 100644 index 00000000..d8b9e6cc --- /dev/null +++ b/generated/test/test_label_value_request.py @@ -0,0 +1,42 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.blank_enum import BlankEnum +from groundlight_openapi_client.model.null_enum import NullEnum +from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum + +globals()["BlankEnum"] = BlankEnum +globals()["NullEnum"] = NullEnum +globals()["ReviewReasonEnum"] = ReviewReasonEnum +from groundlight_openapi_client.model.label_value_request import LabelValueRequest + + +class TestLabelValueRequest(unittest.TestCase): + """LabelValueRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testLabelValueRequest(self): + """Test LabelValueRequest""" + # FIXME: construct object with mandatory attributes with example values + # model = LabelValueRequest() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_labels_api.py b/generated/test/test_labels_api.py new file mode 100644 index 00000000..1fd03968 --- /dev/null +++ b/generated/test/test_labels_api.py @@ -0,0 +1,32 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.api.labels_api import LabelsApi # noqa: E501 + + +class TestLabelsApi(unittest.TestCase): + """LabelsApi unit test stubs""" + + def setUp(self): + self.api = LabelsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_labels_create(self): + """Test case for labels_create""" + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_null_enum.py b/generated/test/test_null_enum.py new file mode 100644 index 00000000..893cd0c7 --- /dev/null +++ b/generated/test/test_null_enum.py @@ -0,0 +1,35 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.null_enum import NullEnum + + +class TestNullEnum(unittest.TestCase): + """NullEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testNullEnum(self): + """Test NullEnum""" + # FIXME: construct object with mandatory attributes with example values + # model = NullEnum() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_review_reason_enum.py b/generated/test/test_review_reason_enum.py new file mode 100644 index 00000000..10a728de --- /dev/null +++ b/generated/test/test_review_reason_enum.py @@ -0,0 +1,35 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum + + +class TestReviewReasonEnum(unittest.TestCase): + """ReviewReasonEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testReviewReasonEnum(self): + """Test ReviewReasonEnum""" + # FIXME: construct object with mandatory attributes with example values + # model = ReviewReasonEnum() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_roi.py b/generated/test/test_roi.py new file mode 100644 index 00000000..05deb982 --- /dev/null +++ b/generated/test/test_roi.py @@ -0,0 +1,38 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.b_box_geometry import BBoxGeometry + +globals()["BBoxGeometry"] = BBoxGeometry +from groundlight_openapi_client.model.roi import ROI + + +class TestROI(unittest.TestCase): + """ROI unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testROI(self): + """Test ROI""" + # FIXME: construct object with mandatory attributes with example values + # model = ROI() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_source_enum.py b/generated/test/test_source_enum.py new file mode 100644 index 00000000..d2643e97 --- /dev/null +++ b/generated/test/test_source_enum.py @@ -0,0 +1,35 @@ +""" + Groundlight API + + 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.15.3 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.source_enum import SourceEnum + + +class TestSourceEnum(unittest.TestCase): + """SourceEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSourceEnum(self): + """Test SourceEnum""" + # FIXME: construct object with mandatory attributes with example values + # model = SourceEnum() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/spec/public-api.yaml b/spec/public-api.yaml index bfcd21cf..47231a9f 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -212,6 +212,54 @@ paths: responses: '204': description: No response body + /v1/detectors/detector-groups: + get: + operationId: Get Detector Groups + description: List all detector groups + tags: + - detectors + security: + - ApiToken: [] + responses: + '200': + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/DetectorGroup' + description: '' + post: + operationId: Create Detector Group + description: |- + Create a new detector group + + POST data: + Required: + - name (str) - name of the predictor set + tags: + - detectors + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DetectorGroupRequest' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/DetectorGroupRequest' + multipart/form-data: + schema: + $ref: '#/components/schemas/DetectorGroupRequest' + required: true + security: + - ApiToken: [] + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/DetectorGroup' + description: '' /v1/image-queries: get: operationId: List image queries @@ -353,6 +401,35 @@ paths: type: string format: binary description: '' + /v1/labels: + post: + operationId: labels_create + description: |- + Create a new LabelValue and attach it to an image query. This will trigger + asynchronous fine-tuner model training. + tags: + - labels + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/LabelValueRequest' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/LabelValueRequest' + multipart/form-data: + schema: + $ref: '#/components/schemas/LabelValueRequest' + required: true + security: + - ApiToken: [] + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/LabelValue' + description: '' /v1/me: get: operationId: Who am I @@ -470,6 +547,47 @@ components: required: - CUSTOMER - GL + AnnotationsRequestedEnum: + enum: + - BINARY_CLASSIFICATION + - BOUNDING_BOXES + type: string + description: |- + * `BINARY_CLASSIFICATION` - Binary Classification + * `BOUNDING_BOXES` - Bounding Boxes + BBoxGeometry: + type: object + properties: + left: + type: number + format: double + top: + type: number + format: double + right: + type: number + format: double + bottom: + type: number + format: double + x: + type: number + format: double + readOnly: true + y: + type: number + format: double + readOnly: true + required: + - bottom + - left + - right + - top + - x + - y + BlankEnum: + enum: + - '' ChannelEnum: enum: - EMAIL @@ -626,6 +744,7 @@ components: * `BINARY` - BINARY * `COUNT` - COUNT + * `MULTI_CLASS` - MULTI_CLASS mode_configuration: nullable: true description: Configuration for each detector mode. @@ -633,6 +752,27 @@ components: - name - query x-internal: true + DetectorGroup: + type: object + properties: + id: + type: string + readOnly: true + name: + type: string + maxLength: 100 + required: + - id + - name + DetectorGroupRequest: + type: object + properties: + name: + type: string + minLength: 1 + maxLength: 100 + required: + - name DetectorTypeEnum: enum: - detector @@ -692,7 +832,15 @@ components: format: double readOnly: true description: Min confidence needed to accept the response of the image query. + bounding_boxes: + type: array + items: + $ref: '#/components/schemas/ROI' + readOnly: true + nullable: true + description: An array of bounding boxes collected on image required: + - bounding_boxes - confidence_threshold - created_at - detector_id @@ -708,14 +856,117 @@ components: enum: - image_query type: string + LabelValue: + type: object + properties: + value: + type: number + format: double + nullable: true + confidence: + type: number + format: double + nullable: true + readOnly: true + class_name: + type: string + nullable: true + description: A human-readable class name for this label + readOnly: true + feedback_text: + type: string + nullable: true + rois: + nullable: true + description: List of region-of-interest (ROI) annotations + flag_archived: + type: boolean + nullable: true + annotations_requested: + type: array + items: + allOf: + - $ref: '#/components/schemas/AnnotationsRequestedEnum' + description: |- + The type of annotation requested + + * `BINARY_CLASSIFICATION` - Binary Classification + * `BOUNDING_BOXES` - Bounding Boxes + readOnly: true + review_reason: + nullable: true + oneOf: + - $ref: '#/components/schemas/ReviewReasonEnum' + - $ref: '#/components/schemas/BlankEnum' + - $ref: '#/components/schemas/NullEnum' + created_at: + type: string + format: date-time + readOnly: true + detector_id: + type: integer + nullable: true + readOnly: true + deleted_at: + type: string + format: date-time + readOnly: true + nullable: true + source: + allOf: + - $ref: '#/components/schemas/SourceEnum' + readOnly: true + required: + - annotations_requested + - class_name + - confidence + - created_at + - deleted_at + - detector_id + - source + LabelValueRequest: + type: object + properties: + label: + type: string + writeOnly: true + minLength: 1 + posicheck_id: + type: string + writeOnly: true + minLength: 1 + value: + type: number + format: double + nullable: true + feedback_text: + type: string + nullable: true + rois: + nullable: true + description: List of region-of-interest (ROI) annotations + flag_archived: + type: boolean + nullable: true + review_reason: + nullable: true + oneOf: + - $ref: '#/components/schemas/ReviewReasonEnum' + - $ref: '#/components/schemas/BlankEnum' + - $ref: '#/components/schemas/NullEnum' + required: + - label + - posicheck_id ModeEnum: enum: - BINARY - COUNT + - MULTI_CLASS type: string description: |- * `BINARY` - BINARY * `COUNT` - COUNT + * `MULTI_CLASS` - MULTI_CLASS Note: type: object properties: @@ -737,6 +988,9 @@ components: description: Text content of the note. required: - content + NullEnum: + enum: + - null PaginatedDetectorList: type: object required: @@ -806,11 +1060,49 @@ components: type: array items: $ref: '#/components/schemas/Rule' + ROI: + type: object + properties: + label: + type: string + description: The label of the bounding box. + score: + type: number + format: double + description: The confidence of the bounding box. + geometry: + $ref: '#/components/schemas/BBoxGeometry' + required: + - geometry + - label + - score ResultTypeEnum: enum: - binary_classification - counting type: string + ReviewReasonEnum: + enum: + - ESCALATION + - AUDIT + - ASSESSMENT + - CUSTOMER_INITIATED + - CONFIDENT_UNCLEAR + - CONFIDENT_UNCLEAR_AUDIT + - DISAGREEMENT + - DISAGREEMENT_ON_ASSESSMENT + - CONFIRM_ACTION_TRIGGER + type: string + description: |- + * `ESCALATION` - ESCALATION + * `AUDIT` - AUDIT + * `ASSESSMENT` - ASSESSMENT + * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED + * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR + * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT + * `DISAGREEMENT` - DISAGREEMENT + * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT + * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER Rule: type: object properties: @@ -898,6 +1190,24 @@ components: * `HOURS` - HOURS * `MINUTES` - MINUTES * `SECONDS` - SECONDS + SourceEnum: + enum: + - INITIAL_PLACEHOLDER + - CLOUD + - CUST + - HUMAN_CLOUD_ENSEMBLE + - ALG + - ALG_REC + - ALG_UNCLEAR + type: string + description: |- + * `INITIAL_PLACEHOLDER` - InitialPlaceholder + * `CLOUD` - HumanCloud + * `CUST` - HumanCustomer + * `HUMAN_CLOUD_ENSEMBLE` - HumanCloudEnsemble + * `ALG` - Algorithm + * `ALG_REC` - AlgorithmReconciled + * `ALG_UNCLEAR` - AlgorithmUnclear VerbEnum: enum: - ANSWERED_CONSECUTIVELY From 550fef0ea8cb7851777ddaf849e47f0ffe4053dd Mon Sep 17 00:00:00 2001 From: brandon Date: Tue, 30 Jul 2024 15:21:11 -0700 Subject: [PATCH 02/15] spec correction --- generated/.openapi-generator/FILES | 12 ------------ generated/README.md | 2 +- generated/docs/LabelsApi.md | 10 +++++----- .../groundlight_openapi_client/api/labels_api.py | 12 ++++++------ generated/model.py | 2 +- spec/public-api.yaml | 2 +- 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index 65a27342..25eaeebf 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -102,16 +102,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_annotations_requested_enum.py -test/test_b_box_geometry.py -test/test_blank_enum.py -test/test_detector_group.py -test/test_detector_group_request.py -test/test_label_value.py -test/test_label_value_request.py -test/test_labels_api.py -test/test_null_enum.py -test/test_review_reason_enum.py -test/test_roi.py -test/test_source_enum.py tox.ini diff --git a/generated/README.md b/generated/README.md index 1014d963..547bd8c7 100644 --- a/generated/README.md +++ b/generated/README.md @@ -124,7 +124,7 @@ Class | Method | HTTP request | Description *ImageQueriesApi* | [**get_image_query**](docs/ImageQueriesApi.md#get_image_query) | **GET** /v1/image-queries/{id} | *ImageQueriesApi* | [**list_image_queries**](docs/ImageQueriesApi.md#list_image_queries) | **GET** /v1/image-queries | *ImageQueriesApi* | [**submit_image_query**](docs/ImageQueriesApi.md#submit_image_query) | **POST** /v1/image-queries | -*LabelsApi* | [**labels_create**](docs/LabelsApi.md#labels_create) | **POST** /v1/labels | +*LabelsApi* | [**create_label**](docs/LabelsApi.md#create_label) | **POST** /v1/labels | *NotesApi* | [**create_note**](docs/NotesApi.md#create_note) | **POST** /v1/notes | *NotesApi* | [**get_notes**](docs/NotesApi.md#get_notes) | **GET** /v1/notes | *UserApi* | [**who_am_i**](docs/UserApi.md#who_am_i) | **GET** /v1/me | diff --git a/generated/docs/LabelsApi.md b/generated/docs/LabelsApi.md index 91c66b38..b95e6cd2 100644 --- a/generated/docs/LabelsApi.md +++ b/generated/docs/LabelsApi.md @@ -4,11 +4,11 @@ All URIs are relative to *https://api.groundlight.ai/device-api* Method | HTTP request | Description ------------- | ------------- | ------------- -[**labels_create**](LabelsApi.md#labels_create) | **POST** /v1/labels | +[**create_label**](LabelsApi.md#create_label) | **POST** /v1/labels | -# **labels_create** -> LabelValue labels_create(label_value_request) +# **create_label** +> LabelValue create_label(label_value_request) @@ -58,10 +58,10 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: # example passing only required values which don't have defaults set try: - api_response = api_instance.labels_create(label_value_request) + api_response = api_instance.create_label(label_value_request) pprint(api_response) except groundlight_openapi_client.ApiException as e: - print("Exception when calling LabelsApi->labels_create: %s\n" % e) + print("Exception when calling LabelsApi->create_label: %s\n" % e) ``` diff --git a/generated/groundlight_openapi_client/api/labels_api.py b/generated/groundlight_openapi_client/api/labels_api.py index a0f1cb69..80593cf2 100644 --- a/generated/groundlight_openapi_client/api/labels_api.py +++ b/generated/groundlight_openapi_client/api/labels_api.py @@ -36,12 +36,12 @@ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client - self.labels_create_endpoint = _Endpoint( + self.create_label_endpoint = _Endpoint( settings={ "response_type": (LabelValue,), "auth": ["ApiToken"], "endpoint_path": "/v1/labels", - "operation_id": "labels_create", + "operation_id": "create_label", "http_method": "POST", "servers": None, }, @@ -75,14 +75,14 @@ def __init__(self, api_client=None): api_client=api_client, ) - def labels_create(self, label_value_request, **kwargs): - """labels_create # noqa: E501 + def create_label(self, label_value_request, **kwargs): + """create_label # noqa: E501 Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.labels_create(label_value_request, async_req=True) + >>> thread = api.create_label(label_value_request, async_req=True) >>> result = thread.get() Args: @@ -131,4 +131,4 @@ def labels_create(self, label_value_request, **kwargs): kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") kwargs["label_value_request"] = label_value_request - return self.labels_create_endpoint.call_with_http_info(**kwargs) + return self.create_label_endpoint.call_with_http_info(**kwargs) diff --git a/generated/model.py b/generated/model.py index 0f717f15..9c1a9f57 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2024-07-30T22:02:00+00:00 +# timestamp: 2024-07-30T22:21:00+00:00 from __future__ import annotations diff --git a/spec/public-api.yaml b/spec/public-api.yaml index 47231a9f..60430d6f 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -403,7 +403,7 @@ paths: description: '' /v1/labels: post: - operationId: labels_create + operationId: create label description: |- Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. From 4554024ecfc2b2b0eeb30c9ba332e3b18ceefd2a Mon Sep 17 00:00:00 2001 From: brandon Date: Tue, 30 Jul 2024 16:01:16 -0700 Subject: [PATCH 03/15] wip, reworking label api --- src/groundlight/client.py | 6 +++++- src/groundlight/internalapi.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 23060ea5..6639e132 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -10,8 +10,10 @@ from groundlight_openapi_client.api.detectors_api import DetectorsApi from groundlight_openapi_client.api.image_queries_api import ImageQueriesApi from groundlight_openapi_client.api.user_api import UserApi +from groundlight_openapi_client.api.labels_api import LabelsApi from groundlight_openapi_client.exceptions import NotFoundException, UnauthorizedException from groundlight_openapi_client.model.detector_creation_input_request import DetectorCreationInputRequest +from groundlight_openapi_client.model.label_value_request import LabelValueRequest from model import ( Detector, ImageQuery, @@ -149,6 +151,7 @@ def __init__( self.detectors_api = DetectorsApi(self.api_client) self.image_queries_api = ImageQueriesApi(self.api_client) self.user_api = UserApi(self.api_client) + self.labels_api = LabelsApi(self.api_client) self._verify_connectivity() def __repr__(self) -> str: @@ -740,7 +743,8 @@ def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str if not image_query_id.startswith(("chk_", "iq_")): raise ValueError(f"Invalid image query id {image_query_id}") api_label = convert_display_label_to_internal(image_query_id, label) - + LabelValueRequest() + return self.labels_api.create_label() return self.api_client._add_label(image_query_id, api_label) # pylint: disable=protected-access def start_inspection(self) -> str: diff --git a/src/groundlight/internalapi.py b/src/groundlight/internalapi.py index 739f412a..769e641c 100644 --- a/src/groundlight/internalapi.py +++ b/src/groundlight/internalapi.py @@ -203,6 +203,7 @@ def _headers(self) -> dict: @RequestsRetryDecorator() def _add_label(self, image_query_id: str, label: str) -> dict: """Temporary internal call to add a label to an image query. Not supported.""" + logger.warning("This method is slated for removal") # TODO: Properly model this with OpenApi spec. start_time = time.time() url = f"{self.configuration.host}/labels" From f55d744a9dd5856704e7072f2101ee0d418b4332 Mon Sep 17 00:00:00 2001 From: brandon Date: Tue, 30 Jul 2024 16:37:57 -0700 Subject: [PATCH 04/15] v1 version, need tests --- generated/.openapi-generator/FILES | 2 - generated/README.md | 1 - generated/docs/LabelValue.md | 8 +- generated/docs/LabelValueRequest.md | 6 +- generated/docs/LabelsApi.md | 6 +- generated/docs/ROI.md | 2 +- .../model/label_value.py | 77 +++++++++---------- .../model/label_value_request.py | 65 +++------------- .../groundlight_openapi_client/model/roi.py | 8 +- .../models/__init__.py | 1 - generated/model.py | 30 +++----- spec/public-api.yaml | 40 +++------- src/groundlight/client.py | 9 ++- src/groundlight/experimental_api.py | 23 +++++- 14 files changed, 101 insertions(+), 177 deletions(-) diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index 25eaeebf..9ab96952 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -9,7 +9,6 @@ docs/AllNotes.md docs/AnnotationsRequestedEnum.md docs/BBoxGeometry.md docs/BinaryClassificationResult.md -docs/BlankEnum.md docs/ChannelEnum.md docs/Condition.md docs/ConditionRequest.md @@ -64,7 +63,6 @@ groundlight_openapi_client/model/all_notes.py groundlight_openapi_client/model/annotations_requested_enum.py groundlight_openapi_client/model/b_box_geometry.py groundlight_openapi_client/model/binary_classification_result.py -groundlight_openapi_client/model/blank_enum.py groundlight_openapi_client/model/channel_enum.py groundlight_openapi_client/model/condition.py groundlight_openapi_client/model/condition_request.py diff --git a/generated/README.md b/generated/README.md index 547bd8c7..4feb22c5 100644 --- a/generated/README.md +++ b/generated/README.md @@ -138,7 +138,6 @@ Class | Method | HTTP request | Description - [AnnotationsRequestedEnum](docs/AnnotationsRequestedEnum.md) - [BBoxGeometry](docs/BBoxGeometry.md) - [BinaryClassificationResult](docs/BinaryClassificationResult.md) - - [BlankEnum](docs/BlankEnum.md) - [ChannelEnum](docs/ChannelEnum.md) - [Condition](docs/Condition.md) - [ConditionRequest](docs/ConditionRequest.md) diff --git a/generated/docs/LabelValue.md b/generated/docs/LabelValue.md index 0e87465f..02404352 100644 --- a/generated/docs/LabelValue.md +++ b/generated/docs/LabelValue.md @@ -4,18 +4,16 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**value** | **float, none_type** | | [readonly] **confidence** | **float, none_type** | | [readonly] **class_name** | **str, none_type** | A human-readable class name for this label | [readonly] +**feedback_text** | **str, none_type** | | [readonly] **annotations_requested** | **[bool, date, datetime, dict, float, int, list, str, none_type]** | | [readonly] +**review_reason** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [readonly] **created_at** | **datetime** | | [readonly] **detector_id** | **int, none_type** | | [readonly] -**deleted_at** | **datetime, none_type** | | [readonly] **source** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [readonly] -**value** | **float, none_type** | | [optional] -**feedback_text** | **str, none_type** | | [optional] **rois** | **bool, date, datetime, dict, float, int, list, str, none_type** | List of region-of-interest (ROI) annotations | [optional] -**flag_archived** | **bool, none_type** | | [optional] -**review_reason** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [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/LabelValueRequest.md b/generated/docs/LabelValueRequest.md index 431958dd..1789d7d7 100644 --- a/generated/docs/LabelValueRequest.md +++ b/generated/docs/LabelValueRequest.md @@ -5,12 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **label** | **str** | | -**posicheck_id** | **str** | | -**value** | **float, none_type** | | [optional] -**feedback_text** | **str, none_type** | | [optional] +**image_query_id** | **str** | | **rois** | **bool, date, datetime, dict, float, int, list, str, none_type** | List of region-of-interest (ROI) annotations | [optional] -**flag_archived** | **bool, none_type** | | [optional] -**review_reason** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [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/LabelsApi.md b/generated/docs/LabelsApi.md index b95e6cd2..e7845a27 100644 --- a/generated/docs/LabelsApi.md +++ b/generated/docs/LabelsApi.md @@ -48,12 +48,8 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: api_instance = labels_api.LabelsApi(api_client) label_value_request = LabelValueRequest( label="label_example", - posicheck_id="posicheck_id_example", - value=3.14, - feedback_text="feedback_text_example", + image_query_id="image_query_id_example", rois=None, - flag_archived=True, - review_reason=None, ) # LabelValueRequest | # example passing only required values which don't have defaults set diff --git a/generated/docs/ROI.md b/generated/docs/ROI.md index 6172ec8f..84e5d7ad 100644 --- a/generated/docs/ROI.md +++ b/generated/docs/ROI.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **label** | **str** | The label of the bounding box. | -**score** | **float** | The confidence of the bounding box. | +**score** | **float** | The confidence of the bounding box. | [readonly] **geometry** | [**BBoxGeometry**](BBoxGeometry.md) | | **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/groundlight_openapi_client/model/label_value.py b/generated/groundlight_openapi_client/model/label_value.py index 4722a693..38a55f68 100644 --- a/generated/groundlight_openapi_client/model/label_value.py +++ b/generated/groundlight_openapi_client/model/label_value.py @@ -31,13 +31,11 @@ def lazy_import(): from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum - from groundlight_openapi_client.model.blank_enum import BlankEnum from groundlight_openapi_client.model.null_enum import NullEnum from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum from groundlight_openapi_client.model.source_enum import SourceEnum globals()["AnnotationsRequestedEnum"] = AnnotationsRequestedEnum - globals()["BlankEnum"] = BlankEnum globals()["NullEnum"] = NullEnum globals()["ReviewReasonEnum"] = ReviewReasonEnum globals()["SourceEnum"] = SourceEnum @@ -104,6 +102,10 @@ def openapi_types(): """ lazy_import() return { + "value": ( + float, + none_type, + ), # noqa: E501 "confidence": ( float, none_type, @@ -112,17 +114,12 @@ def openapi_types(): str, none_type, ), # noqa: E501 - "annotations_requested": ([bool, date, datetime, dict, float, int, list, str, none_type],), # noqa: E501 - "created_at": (datetime,), # noqa: E501 - "detector_id": ( - int, - none_type, - ), # noqa: E501 - "deleted_at": ( - datetime, + "feedback_text": ( + str, none_type, ), # noqa: E501 - "source": ( + "annotations_requested": ([bool, date, datetime, dict, float, int, list, str, none_type],), # noqa: E501 + "review_reason": ( bool, date, datetime, @@ -133,15 +130,12 @@ def openapi_types(): str, none_type, ), # noqa: E501 - "value": ( - float, - none_type, - ), # noqa: E501 - "feedback_text": ( - str, + "created_at": (datetime,), # noqa: E501 + "detector_id": ( + int, none_type, ), # noqa: E501 - "rois": ( + "source": ( bool, date, datetime, @@ -152,11 +146,7 @@ def openapi_types(): str, none_type, ), # noqa: E501 - "flag_archived": ( - bool, - none_type, - ), # noqa: E501 - "review_reason": ( + "rois": ( bool, date, datetime, @@ -174,27 +164,27 @@ def discriminator(): return None attribute_map = { + "value": "value", # noqa: E501 "confidence": "confidence", # noqa: E501 "class_name": "class_name", # noqa: E501 + "feedback_text": "feedback_text", # noqa: E501 "annotations_requested": "annotations_requested", # noqa: E501 + "review_reason": "review_reason", # noqa: E501 "created_at": "created_at", # noqa: E501 "detector_id": "detector_id", # noqa: E501 - "deleted_at": "deleted_at", # noqa: E501 "source": "source", # noqa: E501 - "value": "value", # noqa: E501 - "feedback_text": "feedback_text", # noqa: E501 "rois": "rois", # noqa: E501 - "flag_archived": "flag_archived", # noqa: E501 - "review_reason": "review_reason", # noqa: E501 } read_only_vars = { + "value", # noqa: E501 "confidence", # noqa: E501 "class_name", # noqa: E501 + "feedback_text", # noqa: E501 "annotations_requested", # noqa: E501 + "review_reason", # noqa: E501 "created_at", # noqa: E501 "detector_id", # noqa: E501 - "deleted_at", # noqa: E501 "source", # noqa: E501 } @@ -203,17 +193,30 @@ def discriminator(): @classmethod @convert_js_args_to_python_args def _from_openapi_data( - cls, confidence, class_name, annotations_requested, created_at, detector_id, deleted_at, source, *args, **kwargs + cls, + value, + confidence, + class_name, + feedback_text, + annotations_requested, + review_reason, + created_at, + detector_id, + source, + *args, + **kwargs, ): # noqa: E501 """LabelValue - a model defined in OpenAPI Args: + value (float, none_type): confidence (float, none_type): class_name (str, none_type): A human-readable class name for this label + feedback_text (str, none_type): annotations_requested ([bool, date, datetime, dict, float, int, list, str, none_type]): + review_reason (bool, date, datetime, dict, float, int, list, str, none_type): created_at (datetime): detector_id (int, none_type): - deleted_at (datetime, none_type): source (bool, date, datetime, dict, float, int, list, str, none_type): Keyword Args: @@ -247,11 +250,7 @@ def _from_openapi_data( Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - value (float, none_type): [optional] # noqa: E501 - feedback_text (str, none_type): [optional] # noqa: E501 rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 - flag_archived (bool, none_type): [optional] # noqa: E501 - review_reason (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -280,12 +279,14 @@ def _from_openapi_data( self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value self.confidence = confidence self.class_name = class_name + self.feedback_text = feedback_text self.annotations_requested = annotations_requested + self.review_reason = review_reason self.created_at = created_at self.detector_id = detector_id - self.deleted_at = deleted_at self.source = source for var_name, var_value in kwargs.items(): if ( @@ -343,11 +344,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - value (float, none_type): [optional] # noqa: E501 - feedback_text (str, none_type): [optional] # noqa: E501 rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 - flag_archived (bool, none_type): [optional] # noqa: E501 - review_reason (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 7f5d56b8..d563099b 100644 --- a/generated/groundlight_openapi_client/model/label_value_request.py +++ b/generated/groundlight_openapi_client/model/label_value_request.py @@ -29,16 +29,6 @@ from groundlight_openapi_client.exceptions import ApiAttributeError -def lazy_import(): - from groundlight_openapi_client.model.blank_enum import BlankEnum - from groundlight_openapi_client.model.null_enum import NullEnum - from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum - - globals()["BlankEnum"] = BlankEnum - globals()["NullEnum"] = NullEnum - globals()["ReviewReasonEnum"] = ReviewReasonEnum - - class LabelValueRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -69,7 +59,7 @@ class LabelValueRequest(ModelNormal): ("label",): { "min_length": 1, }, - ("posicheck_id",): { + ("image_query_id",): { "min_length": 1, }, } @@ -80,7 +70,6 @@ def additional_properties_type(): This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ - lazy_import() return ( bool, date, @@ -105,18 +94,9 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ - lazy_import() return { "label": (str,), # noqa: E501 - "posicheck_id": (str,), # noqa: E501 - "value": ( - float, - none_type, - ), # noqa: E501 - "feedback_text": ( - str, - none_type, - ), # noqa: E501 + "image_query_id": (str,), # noqa: E501 "rois": ( bool, date, @@ -128,21 +108,6 @@ def openapi_types(): str, none_type, ), # noqa: E501 - "flag_archived": ( - bool, - none_type, - ), # noqa: E501 - "review_reason": ( - bool, - date, - datetime, - dict, - float, - int, - list, - str, - none_type, - ), # noqa: E501 } @cached_property @@ -151,12 +116,8 @@ def discriminator(): attribute_map = { "label": "label", # noqa: E501 - "posicheck_id": "posicheck_id", # noqa: E501 - "value": "value", # noqa: E501 - "feedback_text": "feedback_text", # noqa: E501 + "image_query_id": "image_query_id", # noqa: E501 "rois": "rois", # noqa: E501 - "flag_archived": "flag_archived", # noqa: E501 - "review_reason": "review_reason", # noqa: E501 } read_only_vars = {} @@ -165,12 +126,12 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, label, posicheck_id, *args, **kwargs): # noqa: E501 + def _from_openapi_data(cls, label, image_query_id, *args, **kwargs): # noqa: E501 """LabelValueRequest - a model defined in OpenAPI Args: label (str): - posicheck_id (str): + image_query_id (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -203,11 +164,7 @@ def _from_openapi_data(cls, label, posicheck_id, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - value (float, none_type): [optional] # noqa: E501 - feedback_text (str, none_type): [optional] # noqa: E501 rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 - flag_archived (bool, none_type): [optional] # noqa: E501 - review_reason (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -237,7 +194,7 @@ def _from_openapi_data(cls, label, posicheck_id, *args, **kwargs): # noqa: E501 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.label = label - self.posicheck_id = posicheck_id + self.image_query_id = image_query_id for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map @@ -260,12 +217,12 @@ def _from_openapi_data(cls, label, posicheck_id, *args, **kwargs): # noqa: E501 ]) @convert_js_args_to_python_args - def __init__(self, label, posicheck_id, *args, **kwargs): # noqa: E501 + def __init__(self, label, image_query_id, *args, **kwargs): # noqa: E501 """LabelValueRequest - a model defined in OpenAPI Args: label (str): - posicheck_id (str): + image_query_id (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -298,11 +255,7 @@ def __init__(self, label, posicheck_id, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - value (float, none_type): [optional] # noqa: E501 - feedback_text (str, none_type): [optional] # noqa: E501 rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 - flag_archived (bool, none_type): [optional] # noqa: E501 - review_reason (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -330,7 +283,7 @@ def __init__(self, label, posicheck_id, *args, **kwargs): # noqa: E501 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.label = label - self.posicheck_id = posicheck_id + self.image_query_id = image_query_id for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map diff --git a/generated/groundlight_openapi_client/model/roi.py b/generated/groundlight_openapi_client/model/roi.py index af2d2077..65db005f 100644 --- a/generated/groundlight_openapi_client/model/roi.py +++ b/generated/groundlight_openapi_client/model/roi.py @@ -111,7 +111,9 @@ def discriminator(): "geometry": "geometry", # noqa: E501 } - read_only_vars = {} + read_only_vars = { + "score", # noqa: E501 + } _composed_schemas = {} @@ -209,12 +211,11 @@ def _from_openapi_data(cls, label, score, geometry, *args, **kwargs): # noqa: E ]) @convert_js_args_to_python_args - def __init__(self, label, score, geometry, *args, **kwargs): # noqa: E501 + def __init__(self, label, geometry, *args, **kwargs): # noqa: E501 """ROI - a model defined in OpenAPI Args: label (str): The label of the bounding box. - score (float): The confidence of the bounding box. geometry (BBoxGeometry): Keyword Args: @@ -275,7 +276,6 @@ def __init__(self, label, score, geometry, *args, **kwargs): # noqa: E501 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.label = label - self.score = score self.geometry = geometry for var_name, var_value in kwargs.items(): if ( diff --git a/generated/groundlight_openapi_client/models/__init__.py b/generated/groundlight_openapi_client/models/__init__.py index 88c5fa3c..4a31acce 100644 --- a/generated/groundlight_openapi_client/models/__init__.py +++ b/generated/groundlight_openapi_client/models/__init__.py @@ -15,7 +15,6 @@ from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum from groundlight_openapi_client.model.b_box_geometry import BBoxGeometry from groundlight_openapi_client.model.binary_classification_result import BinaryClassificationResult -from groundlight_openapi_client.model.blank_enum import BlankEnum from groundlight_openapi_client.model.channel_enum import ChannelEnum from groundlight_openapi_client.model.condition import Condition from groundlight_openapi_client.model.condition_request import ConditionRequest diff --git a/generated/model.py b/generated/model.py index 9c1a9f57..92b829e4 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2024-07-30T22:21:00+00:00 +# timestamp: 2024-07-30T23:28:20+00:00 from __future__ import annotations @@ -30,10 +30,6 @@ class BBoxGeometry(BaseModel): y: float -class BlankEnum(Enum): - field_ = "" - - class ChannelEnum(Enum): """ * `EMAIL` - EMAIL @@ -61,6 +57,12 @@ class ImageQueryTypeEnum(Enum): image_query = "image_query" +class LabelValueRequest(BaseModel): + label: constr(min_length=1) + image_query_id: constr(min_length=1) + rois: Optional[Any] = Field(None, description="List of region-of-interest (ROI) annotations") + + class ModeEnum(Enum): """ * `BINARY` - BINARY @@ -300,30 +302,18 @@ class ImageQuery(BaseModel): class LabelValue(BaseModel): - value: Optional[float] = None + value: Optional[float] = Field(...) confidence: Optional[float] = Field(...) class_name: Optional[str] = Field(..., description="A human-readable class name for this label") - feedback_text: Optional[str] = None + feedback_text: Optional[str] = Field(...) rois: Optional[Any] = Field(None, description="List of region-of-interest (ROI) annotations") - flag_archived: Optional[bool] = None annotations_requested: List[AnnotationsRequestedEnum] - review_reason: Optional[Union[ReviewReasonEnum, BlankEnum, NullEnum]] = None + review_reason: Optional[Union[ReviewReasonEnum, NullEnum]] = Field(...) created_at: datetime detector_id: Optional[int] = Field(...) - deleted_at: Optional[datetime] = Field(...) source: SourceEnum -class LabelValueRequest(BaseModel): - label: constr(min_length=1) - posicheck_id: constr(min_length=1) - value: Optional[float] = None - feedback_text: Optional[str] = None - rois: Optional[Any] = Field(None, description="List of region-of-interest (ROI) annotations") - flag_archived: Optional[bool] = None - review_reason: Optional[Union[ReviewReasonEnum, BlankEnum, NullEnum]] = None - - class PaginatedDetectorList(BaseModel): count: int = Field(..., example=123) next: Optional[AnyUrl] = Field(None, example="http://api.example.org/accounts/?page=4") diff --git a/spec/public-api.yaml b/spec/public-api.yaml index 60430d6f..cdf0952d 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -585,9 +585,6 @@ components: - top - x - y - BlankEnum: - enum: - - '' ChannelEnum: enum: - EMAIL @@ -862,6 +859,7 @@ components: value: type: number format: double + readOnly: true nullable: true confidence: type: number @@ -875,13 +873,11 @@ components: readOnly: true feedback_text: type: string + readOnly: true nullable: true rois: nullable: true description: List of region-of-interest (ROI) annotations - flag_archived: - type: boolean - nullable: true annotations_requested: type: array items: @@ -894,10 +890,10 @@ components: * `BOUNDING_BOXES` - Bounding Boxes readOnly: true review_reason: + readOnly: true nullable: true oneOf: - $ref: '#/components/schemas/ReviewReasonEnum' - - $ref: '#/components/schemas/BlankEnum' - $ref: '#/components/schemas/NullEnum' created_at: type: string @@ -907,11 +903,6 @@ components: type: integer nullable: true readOnly: true - deleted_at: - type: string - format: date-time - readOnly: true - nullable: true source: allOf: - $ref: '#/components/schemas/SourceEnum' @@ -921,9 +912,11 @@ components: - class_name - confidence - created_at - - deleted_at - detector_id + - feedback_text + - review_reason - source + - value LabelValueRequest: type: object properties: @@ -931,32 +924,16 @@ components: type: string writeOnly: true minLength: 1 - posicheck_id: + image_query_id: type: string writeOnly: true minLength: 1 - value: - type: number - format: double - nullable: true - feedback_text: - type: string - nullable: true rois: nullable: true description: List of region-of-interest (ROI) annotations - flag_archived: - type: boolean - nullable: true - review_reason: - nullable: true - oneOf: - - $ref: '#/components/schemas/ReviewReasonEnum' - - $ref: '#/components/schemas/BlankEnum' - - $ref: '#/components/schemas/NullEnum' required: + - image_query_id - label - - posicheck_id ModeEnum: enum: - BINARY @@ -1069,6 +1046,7 @@ components: score: type: number format: double + readOnly: true description: The confidence of the bounding box. geometry: $ref: '#/components/schemas/BBoxGeometry' diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 6639e132..66a5981b 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -723,7 +723,7 @@ def _wait_for_result( image_query = self._fixup_image_query(image_query) return image_query - def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str]): + def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Optional[list] = None): """ Add a new label to an image query. This answers the detector's question. @@ -731,6 +731,7 @@ def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str or an image_query id as a string. :param label: The string "YES" or the string "NO" in answer to the query. + :param rois: An option list of regions of interest (ROIs) to associate with the label. (This feature experimental) :return: None """ @@ -743,9 +744,9 @@ def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str if not image_query_id.startswith(("chk_", "iq_")): raise ValueError(f"Invalid image query id {image_query_id}") api_label = convert_display_label_to_internal(image_query_id, label) - LabelValueRequest() - return self.labels_api.create_label() - return self.api_client._add_label(image_query_id, api_label) # pylint: disable=protected-access + json_rois = [roi.json() for roi in rois] if rois else None + request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=json_rois) + self.labels_api.create_label(request_params) def start_inspection(self) -> str: """ diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 28e133ea..5b72f3c8 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -7,7 +7,7 @@ """ import json -from typing import Any, Dict, Union +from typing import Any, Dict, Tuple, Union from groundlight_openapi_client.api.actions_api import ActionsApi from groundlight_openapi_client.api.image_queries_api import ImageQueriesApi @@ -19,7 +19,7 @@ from groundlight_openapi_client.model.note_request import NoteRequest from groundlight_openapi_client.model.rule_request import RuleRequest from groundlight_openapi_client.model.verb_enum import VerbEnum -from model import Detector, PaginatedRuleList, Rule +from model import Detector, PaginatedRuleList, Rule, ROI from .client import Groundlight @@ -180,3 +180,22 @@ def create_note(self, detector: Union[str, Detector], note: Union[str, NoteReque if isinstance(note, str): note = NoteRequest(content=note) self.notes_api.create_note(det_id, note) + + def create_roi(self, label: str, top_left: Tuple[int, int], bottom_right: Tuple[int, int]) -> ROI: + """ + Adds a region of interest to the given detector + NOTE: This feature is only available to Pro tier and higher + If you would like to learn more, reach out to us at https://groundlight.ai + + :param label: the label of the item in the roi + :param top_left: the top left corner of the roi + :param bottom_right: the bottom right corner of the roi + """ + + return ROI( + label=label, + left = top_left[0], + top = top_left[1], + right = bottom_right[0], + bottom = bottom_right[1] + ) \ No newline at end of file From 7c2b2daecea7329bd94b3f8bb8d2de0ef688aabb Mon Sep 17 00:00:00 2001 From: brandon Date: Wed, 31 Jul 2024 09:20:44 -0700 Subject: [PATCH 05/15] Debugging over the wire step --- src/groundlight/client.py | 7 ++++--- src/groundlight/experimental_api.py | 26 ++++++++++++++++++++++++- test/integration/test_groundlight.py | 29 ---------------------------- test/unit/conftest.py | 28 ++++++++++++++++++++++++++- test/unit/test_experimental.py | 25 +++++++++++++++++++----- 5 files changed, 76 insertions(+), 39 deletions(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index a656c631..fbc63aaa 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -19,6 +19,7 @@ ImageQuery, PaginatedDetectorList, PaginatedImageQueryList, + ROI, ) from urllib3.exceptions import InsecureRequestWarning @@ -726,7 +727,7 @@ def _wait_for_result( image_query = self._fixup_image_query(image_query) return image_query - def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Optional[list] = None): + def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Optional[list[ROI]] = None): """ Add a new label to an image query. This answers the detector's question. @@ -747,8 +748,8 @@ def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str if not image_query_id.startswith(("chk_", "iq_")): raise ValueError(f"Invalid image query id {image_query_id}") api_label = convert_display_label_to_internal(image_query_id, label) - json_rois = [roi.json() for roi in rois] if rois else None - request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=json_rois) + request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=rois) + import IPython; IPython.embed() self.labels_api.create_label(request_params) def start_inspection(self) -> str: diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 4f77c059..3c15cfb7 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -20,7 +20,7 @@ from groundlight_openapi_client.model.note_request import NoteRequest from groundlight_openapi_client.model.rule_request import RuleRequest from groundlight_openapi_client.model.verb_enum import VerbEnum -from model import Detector, DetectorGroup, PaginatedRuleList, Rule, ROI +from model import Detector, DetectorGroup, PaginatedRuleList, Rule, ROI, BBoxGeometry from .client import Groundlight @@ -201,3 +201,27 @@ def list_detector_groups(self) -> List[DetectorGroup]: :return: a list of all detector groups """ return [DetectorGroup(**det.to_dict()) for det in self.detector_group_api.get_detector_groups()] + + def create_roi(self, label: str, top_left: Tuple[int, int], bottom_right: Tuple[int, int]) -> ROI: + """ + Adds a region of interest to the given detector + NOTE: This feature is only available to Pro tier and higher + If you would like to learn more, reach out to us at https://groundlight.ai + + :param label: the label of the item in the roi + :param top_left: the top left corner of the roi + :param bottom_right: the bottom right corner of the roi + """ + + return ROI( + label=label, + score=1.0, + geometry=BBoxGeometry( + left = top_left[0], + top = top_left[1], + right = bottom_right[0], + bottom = bottom_right[1], + x = (top_left[0] + bottom_right[0]) / 2, + y = (top_left[1] + bottom_right[1]) / 2, + ) + ) \ No newline at end of file diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index 4f515253..4dc10219 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -64,35 +64,6 @@ def is_valid_display_label(label: str) -> bool: return label in VALID_DISPLAY_LABELS -@pytest.fixture(name="gl") -def fixture_gl() -> Groundlight: - """Creates a Groundlight client object for testing.""" - _gl = Groundlight() - _gl.DEFAULT_WAIT = 10 - return _gl - - -@pytest.fixture(name="detector") -def fixture_detector(gl: Groundlight) -> Detector: - """Creates a new Test detector.""" - name = f"Test {datetime.utcnow()}" # Need a unique name - query = "Is there a dog?" - pipeline_config = "never-review" - return gl.create_detector(name=name, query=query, pipeline_config=pipeline_config) - - -@pytest.fixture(name="image_query_yes") -def fixture_image_query_yes(gl: Groundlight, detector: Detector) -> ImageQuery: - iq = gl.submit_image_query(detector=detector.id, image="test/assets/dog.jpeg", human_review="NEVER") - return iq - - -@pytest.fixture(name="image_query_no") -def fixture_image_query_no(gl: Groundlight, detector: Detector) -> ImageQuery: - iq = gl.submit_image_query(detector=detector.id, image="test/assets/cat.jpeg", human_review="NEVER") - return iq - - @pytest.fixture(name="image") def fixture_image() -> str: return "test/assets/dog.jpeg" diff --git a/test/unit/conftest.py b/test/unit/conftest.py index 9c0d1ca0..d523b9d2 100644 --- a/test/unit/conftest.py +++ b/test/unit/conftest.py @@ -1,7 +1,33 @@ import pytest -from groundlight import ExperimentalApi +from datetime import datetime +from groundlight import ExperimentalApi, Groundlight, Detector, ImageQuery @pytest.fixture(name="gl") +def fixture_gl() -> Groundlight: + """Creates a Groundlight client object for testing.""" + _gl = Groundlight() + _gl.DEFAULT_WAIT = 10 + return _gl + +@pytest.fixture(name="detector") +def fixture_detector(gl: Groundlight) -> Detector: + """Creates a new Test detector.""" + name = f"Test {datetime.utcnow()}" # Need a unique name + query = "Is there a dog?" + pipeline_config = "never-review" + return gl.create_detector(name=name, query=query, pipeline_config=pipeline_config) + +@pytest.fixture(name="image_query_yes") +def fixture_image_query_yes(gl: Groundlight, detector: Detector) -> ImageQuery: + iq = gl.submit_image_query(detector=detector.id, image="test/assets/dog.jpeg", human_review="NEVER") + return iq + +@pytest.fixture(name="image_query_no") +def fixture_image_query_no(gl: Groundlight, detector: Detector) -> ImageQuery: + iq = gl.submit_image_query(detector=detector.id, image="test/assets/cat.jpeg", human_review="NEVER") + return iq + +@pytest.fixture(name="gl_experimental") def _gl() -> ExperimentalApi: return ExperimentalApi() diff --git a/test/unit/test_experimental.py b/test/unit/test_experimental.py index af6d1baa..9acfada2 100644 --- a/test/unit/test_experimental.py +++ b/test/unit/test_experimental.py @@ -1,13 +1,28 @@ from datetime import datetime -from groundlight import ExperimentalApi +from groundlight import ExperimentalApi, Detector, ImageQuery, ROI - -def test_detector_groups(gl: ExperimentalApi): +def test_detector_groups(gl_experimental: ExperimentalApi): """ verify that we can create a detector group and retrieve it """ name = f"Test {datetime.utcnow()}" - created_group = gl.create_detector_group(name) - all_groups = gl.list_detector_groups() + created_group = gl_experimental.create_detector_group(name) + all_groups = gl_experimental.list_detector_groups() assert created_group in all_groups + +def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuery): + """ + verify that we can submit an ROI + """ + label_name = "dog" + roi = gl_experimental.create_roi(label_name, (0, 0), (0.5, 0.5)) + gl_experimental.add_label(image_query_yes.id, "YES", [roi]) + +def test_submit_rois(gl_experimental: ExperimentalApi, image_query_no: ImageQuery): + """ + verify that we can submit multiple ROIs + """ + label_name = "dog" + roi = gl_experimental.create_roi(label_name, (0, 0), (0.5, 0.5)) + gl_experimental.add_label(image_query_no, "YES", [roi]*3) \ No newline at end of file From 2491c30801bced35aece9a9d1fbfae4ebd767f9b Mon Sep 17 00:00:00 2001 From: Auto-format Bot Date: Wed, 31 Jul 2024 20:09:44 +0000 Subject: [PATCH 06/15] Automatically reformatting code --- src/groundlight/client.py | 12 ++++++++---- src/groundlight/experimental_api.py | 20 ++++++++++---------- test/unit/conftest.py | 9 +++++++-- test/unit/test_experimental.py | 7 +++++-- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index fbc63aaa..c2043945 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -9,17 +9,17 @@ from groundlight_openapi_client import Configuration from groundlight_openapi_client.api.detectors_api import DetectorsApi from groundlight_openapi_client.api.image_queries_api import ImageQueriesApi -from groundlight_openapi_client.api.user_api import UserApi from groundlight_openapi_client.api.labels_api import LabelsApi +from groundlight_openapi_client.api.user_api import UserApi from groundlight_openapi_client.exceptions import NotFoundException, UnauthorizedException from groundlight_openapi_client.model.detector_creation_input_request import DetectorCreationInputRequest from groundlight_openapi_client.model.label_value_request import LabelValueRequest from model import ( + ROI, Detector, ImageQuery, PaginatedDetectorList, PaginatedImageQueryList, - ROI, ) from urllib3.exceptions import InsecureRequestWarning @@ -727,7 +727,9 @@ def _wait_for_result( image_query = self._fixup_image_query(image_query) return image_query - def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Optional[list[ROI]] = None): + def add_label( + self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Optional[list[ROI]] = None + ): """ Add a new label to an image query. This answers the detector's question. @@ -749,7 +751,9 @@ def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str raise ValueError(f"Invalid image query id {image_query_id}") api_label = convert_display_label_to_internal(image_query_id, label) request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=rois) - import IPython; IPython.embed() + import IPython + + IPython.embed() self.labels_api.create_label(request_params) def start_inspection(self) -> str: diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 3c15cfb7..2db4d547 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -7,7 +7,7 @@ """ import json -from typing import Any, Dict, Tuple, List, Union +from typing import Any, Dict, List, Tuple, Union from groundlight_openapi_client.api.actions_api import ActionsApi from groundlight_openapi_client.api.detector_groups_api import DetectorGroupsApi @@ -20,7 +20,7 @@ from groundlight_openapi_client.model.note_request import NoteRequest from groundlight_openapi_client.model.rule_request import RuleRequest from groundlight_openapi_client.model.verb_enum import VerbEnum -from model import Detector, DetectorGroup, PaginatedRuleList, Rule, ROI, BBoxGeometry +from model import ROI, BBoxGeometry, Detector, DetectorGroup, PaginatedRuleList, Rule from .client import Groundlight @@ -217,11 +217,11 @@ def create_roi(self, label: str, top_left: Tuple[int, int], bottom_right: Tuple[ label=label, score=1.0, geometry=BBoxGeometry( - left = top_left[0], - top = top_left[1], - right = bottom_right[0], - bottom = bottom_right[1], - x = (top_left[0] + bottom_right[0]) / 2, - y = (top_left[1] + bottom_right[1]) / 2, - ) - ) \ No newline at end of file + left=top_left[0], + top=top_left[1], + right=bottom_right[0], + bottom=bottom_right[1], + x=(top_left[0] + bottom_right[0]) / 2, + y=(top_left[1] + bottom_right[1]) / 2, + ), + ) diff --git a/test/unit/conftest.py b/test/unit/conftest.py index d523b9d2..9a4ff64d 100644 --- a/test/unit/conftest.py +++ b/test/unit/conftest.py @@ -1,7 +1,8 @@ -import pytest from datetime import datetime -from groundlight import ExperimentalApi, Groundlight, Detector, ImageQuery +import pytest +from groundlight import Detector, ExperimentalApi, Groundlight, ImageQuery + @pytest.fixture(name="gl") def fixture_gl() -> Groundlight: @@ -10,6 +11,7 @@ def fixture_gl() -> Groundlight: _gl.DEFAULT_WAIT = 10 return _gl + @pytest.fixture(name="detector") def fixture_detector(gl: Groundlight) -> Detector: """Creates a new Test detector.""" @@ -18,16 +20,19 @@ def fixture_detector(gl: Groundlight) -> Detector: pipeline_config = "never-review" return gl.create_detector(name=name, query=query, pipeline_config=pipeline_config) + @pytest.fixture(name="image_query_yes") def fixture_image_query_yes(gl: Groundlight, detector: Detector) -> ImageQuery: iq = gl.submit_image_query(detector=detector.id, image="test/assets/dog.jpeg", human_review="NEVER") return iq + @pytest.fixture(name="image_query_no") def fixture_image_query_no(gl: Groundlight, detector: Detector) -> ImageQuery: iq = gl.submit_image_query(detector=detector.id, image="test/assets/cat.jpeg", human_review="NEVER") return iq + @pytest.fixture(name="gl_experimental") def _gl() -> ExperimentalApi: return ExperimentalApi() diff --git a/test/unit/test_experimental.py b/test/unit/test_experimental.py index 9acfada2..48fa277a 100644 --- a/test/unit/test_experimental.py +++ b/test/unit/test_experimental.py @@ -1,6 +1,7 @@ from datetime import datetime -from groundlight import ExperimentalApi, Detector, ImageQuery, ROI +from groundlight import ExperimentalApi, ImageQuery + def test_detector_groups(gl_experimental: ExperimentalApi): """ @@ -11,6 +12,7 @@ def test_detector_groups(gl_experimental: ExperimentalApi): all_groups = gl_experimental.list_detector_groups() assert created_group in all_groups + def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuery): """ verify that we can submit an ROI @@ -19,10 +21,11 @@ def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuer roi = gl_experimental.create_roi(label_name, (0, 0), (0.5, 0.5)) gl_experimental.add_label(image_query_yes.id, "YES", [roi]) + def test_submit_rois(gl_experimental: ExperimentalApi, image_query_no: ImageQuery): """ verify that we can submit multiple ROIs """ label_name = "dog" roi = gl_experimental.create_roi(label_name, (0, 0), (0.5, 0.5)) - gl_experimental.add_label(image_query_no, "YES", [roi]*3) \ No newline at end of file + gl_experimental.add_label(image_query_no, "YES", [roi] * 3) From 956da7fe5e2386d0bf34c10c581f89caae3e79e6 Mon Sep 17 00:00:00 2001 From: brandon Date: Thu, 1 Aug 2024 11:05:07 -0700 Subject: [PATCH 07/15] Removed part of the public-api spec while debugging --- feature_schedule.txt | 1 + generated/docs/ImageQuery.md | 1 - .../model/image_query.py | 11 ---- generated/model.py | 3 +- spec/public-api.yaml | 8 --- src/groundlight/cli.py | 27 +++++++++- src/groundlight/client.py | 10 ++-- src/groundlight/experimental_api.py | 52 +++++++++++++++---- src/groundlight/internalapi.py | 1 + test/integration/test_groundlight.py | 29 +++++++++++ test/unit/conftest.py | 9 +++- test/unit/test_experimental.py | 7 ++- 12 files changed, 119 insertions(+), 40 deletions(-) create mode 100644 feature_schedule.txt diff --git a/feature_schedule.txt b/feature_schedule.txt new file mode 100644 index 00000000..85391a0a --- /dev/null +++ b/feature_schedule.txt @@ -0,0 +1 @@ +0.17.3 : ImageQuery returns image_query_id instead of posicheck_id \ No newline at end of file diff --git a/generated/docs/ImageQuery.md b/generated/docs/ImageQuery.md index 9589ee7d..92078b73 100644 --- a/generated/docs/ImageQuery.md +++ b/generated/docs/ImageQuery.md @@ -15,7 +15,6 @@ Name | Type | Description | Notes **result** | **bool, date, datetime, dict, float, int, list, str, none_type** | The result of the image query. | [readonly] **patience_time** | **float** | How long to wait for a confident response. | [readonly] **confidence_threshold** | **float** | Min confidence needed to accept the response of the image query. | [readonly] -**bounding_boxes** | [**[ROI], none_type**](ROI.md) | An array of bounding boxes collected on image | [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/groundlight_openapi_client/model/image_query.py b/generated/groundlight_openapi_client/model/image_query.py index e5b18667..cb570040 100644 --- a/generated/groundlight_openapi_client/model/image_query.py +++ b/generated/groundlight_openapi_client/model/image_query.py @@ -34,12 +34,10 @@ def lazy_import(): from groundlight_openapi_client.model.counting_result import CountingResult from groundlight_openapi_client.model.image_query_type_enum import ImageQueryTypeEnum from groundlight_openapi_client.model.result_type_enum import ResultTypeEnum - from groundlight_openapi_client.model.roi import ROI globals()["BinaryClassificationResult"] = BinaryClassificationResult globals()["CountingResult"] = CountingResult globals()["ImageQueryTypeEnum"] = ImageQueryTypeEnum - globals()["ROI"] = ROI globals()["ResultTypeEnum"] = ResultTypeEnum @@ -147,10 +145,6 @@ def openapi_types(): ), # noqa: E501 "patience_time": (float,), # noqa: E501 "confidence_threshold": (float,), # noqa: E501 - "bounding_boxes": ( - [ROI], - none_type, - ), # noqa: E501 } @cached_property @@ -168,7 +162,6 @@ def discriminator(): "result": "result", # noqa: E501 "patience_time": "patience_time", # noqa: E501 "confidence_threshold": "confidence_threshold", # noqa: E501 - "bounding_boxes": "bounding_boxes", # noqa: E501 } read_only_vars = { @@ -182,7 +175,6 @@ def discriminator(): "result", # noqa: E501 "patience_time", # noqa: E501 "confidence_threshold", # noqa: E501 - "bounding_boxes", # noqa: E501 } _composed_schemas = {} @@ -201,7 +193,6 @@ def _from_openapi_data( result, patience_time, confidence_threshold, - bounding_boxes, *args, **kwargs, ): # noqa: E501 @@ -218,7 +209,6 @@ def _from_openapi_data( result (bool, date, datetime, dict, float, int, list, str, none_type): The result of the image query. patience_time (float): How long to wait for a confident response. confidence_threshold (float): Min confidence needed to accept the response of the image query. - bounding_boxes ([ROI], none_type): An array of bounding boxes collected on image Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -289,7 +279,6 @@ def _from_openapi_data( self.result = result self.patience_time = patience_time self.confidence_threshold = confidence_threshold - self.bounding_boxes = bounding_boxes for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map diff --git a/generated/model.py b/generated/model.py index 1f801524..7637d7e3 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2024-07-30T23:43:39+00:00 +# timestamp: 2024-07-31T22:47:13+00:00 from __future__ import annotations @@ -298,7 +298,6 @@ class ImageQuery(BaseModel): confidence_threshold: float = Field( ..., description="Min confidence needed to accept the response of the image query." ) - bounding_boxes: Optional[List[ROI]] = Field(..., description="An array of bounding boxes collected on image") class LabelValue(BaseModel): diff --git a/spec/public-api.yaml b/spec/public-api.yaml index f87f9232..7b2cf563 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -877,15 +877,7 @@ components: format: double readOnly: true description: Min confidence needed to accept the response of the image query. - bounding_boxes: - type: array - items: - $ref: '#/components/schemas/ROI' - readOnly: true - nullable: true - description: An array of bounding boxes collected on image required: - - bounding_boxes - confidence_threshold - created_at - detector_id diff --git a/src/groundlight/cli.py b/src/groundlight/cli.py index 36a7c3cc..de33e741 100644 --- a/src/groundlight/cli.py +++ b/src/groundlight/cli.py @@ -13,6 +13,14 @@ ) +def is_cli_supported_type(annotation): + """ + Check if the annotation is a type that can be supported by the CLI + str is a supported type, but is given precedence over other types + """ + return annotation in (int, float, bool) + + def class_func_to_cli(method): """ Given the class method, create a method with the identical signature to provide the help documentation and @@ -36,12 +44,29 @@ def wrapper(*args, **kwargs): print(gl_bound_method(*args, **kwargs)) # this is where we output to the console # not recommended practice to directly change annotations, but gets around Typer not supporting Union types + cli_unsupported_params = [] for name, annotation in method.__annotations__.items(): if get_origin(annotation) is Union: + # If we can submit a string, we take the string from the cli if str in annotation.__args__: wrapper.__annotations__[name] = str + # Otherwise, we grab the first type that is supported by the CLI else: - wrapper.__annotations__[name] = annotation + found_supported_type = False + for arg in annotation.__args__: + if is_cli_supported_type(arg): + found_supported_type = True + wrapper.__annotations__[name] = arg + break + if not found_supported_type: + cli_unsupported_params.append(name) + # Ideally we could just not list the unsupported params, but it doesn't seem natively supported by Typer + # and requires more metaprogamming than makes sense at the moment. For now, we require methods to support str + for param in cli_unsupported_params: + raise Exception( + f"Parameter {param} on method {method.__name__} has an unsupported type for the CLI. Consider allowing a" + " string representation or writing a custom exception inside the method" + ) return wrapper diff --git a/src/groundlight/client.py b/src/groundlight/client.py index fbc63aaa..cf1bf6b2 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -727,7 +727,9 @@ def _wait_for_result( image_query = self._fixup_image_query(image_query) return image_query - def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Optional[list[ROI]] = None): + def add_label( + self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Union[list[ROI], str, None] = None + ): """ Add a new label to an image query. This answers the detector's question. @@ -739,6 +741,8 @@ def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str :return: None """ + if isinstance(rois, str): + raise TypeError("rois must be a list of ROI objects. CLI support is not implemented") if isinstance(image_query, ImageQuery): image_query_id = image_query.id else: @@ -748,8 +752,8 @@ def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str if not image_query_id.startswith(("chk_", "iq_")): raise ValueError(f"Invalid image query id {image_query_id}") api_label = convert_display_label_to_internal(image_query_id, label) - request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=rois) - import IPython; IPython.embed() + rois_json = [roi.dict() for roi in rois] if rois else None + request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=rois_json) self.labels_api.create_label(request_params) def start_inspection(self) -> str: diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 3c15cfb7..0c6dd609 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -7,8 +7,9 @@ """ import json -from typing import Any, Dict, Tuple, List, Union +from typing import Any, Dict, List, Tuple, Union +from groundlight.binary_labels import Label, convert_display_label_to_internal from groundlight_openapi_client.api.actions_api import ActionsApi from groundlight_openapi_client.api.detector_groups_api import DetectorGroupsApi from groundlight_openapi_client.api.image_queries_api import ImageQueriesApi @@ -17,10 +18,11 @@ from groundlight_openapi_client.model.channel_enum import ChannelEnum from groundlight_openapi_client.model.condition_request import ConditionRequest from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest +from groundlight_openapi_client.model.label_value_request import LabelValueRequest from groundlight_openapi_client.model.note_request import NoteRequest from groundlight_openapi_client.model.rule_request import RuleRequest from groundlight_openapi_client.model.verb_enum import VerbEnum -from model import Detector, DetectorGroup, PaginatedRuleList, Rule, ROI, BBoxGeometry +from model import ROI, BBoxGeometry, Detector, DetectorGroup, ImageQuery, PaginatedRuleList, Rule from .client import Groundlight @@ -217,11 +219,41 @@ def create_roi(self, label: str, top_left: Tuple[int, int], bottom_right: Tuple[ label=label, score=1.0, geometry=BBoxGeometry( - left = top_left[0], - top = top_left[1], - right = bottom_right[0], - bottom = bottom_right[1], - x = (top_left[0] + bottom_right[0]) / 2, - y = (top_left[1] + bottom_right[1]) / 2, - ) - ) \ No newline at end of file + left=top_left[0], + top=top_left[1], + right=bottom_right[0], + bottom=bottom_right[1], + x=(top_left[0] + bottom_right[0]) / 2, + y=(top_left[1] + bottom_right[1]) / 2, + ), + ) + + def add_label( + self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Union[list[ROI], str, None] = None + ): + """ + Experimental version of add_label. + Add a new label to an image query. This answers the detector's question. + + :param image_query: Either an ImageQuery object (returned from `submit_image_query`) + or an image_query id as a string. + + :param label: The string "YES" or the string "NO" in answer to the query. + :param rois: An option list of regions of interest (ROIs) to associate with the label. (This feature experimental) + + :return: None + """ + if isinstance(rois, str): + raise TypeError("rois must be a list of ROI objects. CLI support is not implemented") + if isinstance(image_query, ImageQuery): + image_query_id = image_query.id + else: + image_query_id = str(image_query) + # Some old imagequery id's started with "chk_" + # TODO: handle iqe_ for image_queries returned from edge endpoints + if not image_query_id.startswith(("chk_", "iq_")): + raise ValueError(f"Invalid image query id {image_query_id}") + api_label = convert_display_label_to_internal(image_query_id, label) + rois_json = [roi.dict() for roi in rois] if rois else None + request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=rois_json) + self.labels_api.create_label(request_params) \ No newline at end of file diff --git a/src/groundlight/internalapi.py b/src/groundlight/internalapi.py index 769e641c..4da2a18c 100644 --- a/src/groundlight/internalapi.py +++ b/src/groundlight/internalapi.py @@ -208,6 +208,7 @@ def _add_label(self, image_query_id: str, label: str) -> dict: start_time = time.time() url = f"{self.configuration.host}/labels" + # TODO: remove posicheck_id data = {"label": label, "posicheck_id": image_query_id, "review_reason": ReviewReason.CUSTOMER_INITIATED} headers = self._headers() diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index 4dc10219..4f515253 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -64,6 +64,35 @@ def is_valid_display_label(label: str) -> bool: return label in VALID_DISPLAY_LABELS +@pytest.fixture(name="gl") +def fixture_gl() -> Groundlight: + """Creates a Groundlight client object for testing.""" + _gl = Groundlight() + _gl.DEFAULT_WAIT = 10 + return _gl + + +@pytest.fixture(name="detector") +def fixture_detector(gl: Groundlight) -> Detector: + """Creates a new Test detector.""" + name = f"Test {datetime.utcnow()}" # Need a unique name + query = "Is there a dog?" + pipeline_config = "never-review" + return gl.create_detector(name=name, query=query, pipeline_config=pipeline_config) + + +@pytest.fixture(name="image_query_yes") +def fixture_image_query_yes(gl: Groundlight, detector: Detector) -> ImageQuery: + iq = gl.submit_image_query(detector=detector.id, image="test/assets/dog.jpeg", human_review="NEVER") + return iq + + +@pytest.fixture(name="image_query_no") +def fixture_image_query_no(gl: Groundlight, detector: Detector) -> ImageQuery: + iq = gl.submit_image_query(detector=detector.id, image="test/assets/cat.jpeg", human_review="NEVER") + return iq + + @pytest.fixture(name="image") def fixture_image() -> str: return "test/assets/dog.jpeg" diff --git a/test/unit/conftest.py b/test/unit/conftest.py index d523b9d2..9a4ff64d 100644 --- a/test/unit/conftest.py +++ b/test/unit/conftest.py @@ -1,7 +1,8 @@ -import pytest from datetime import datetime -from groundlight import ExperimentalApi, Groundlight, Detector, ImageQuery +import pytest +from groundlight import Detector, ExperimentalApi, Groundlight, ImageQuery + @pytest.fixture(name="gl") def fixture_gl() -> Groundlight: @@ -10,6 +11,7 @@ def fixture_gl() -> Groundlight: _gl.DEFAULT_WAIT = 10 return _gl + @pytest.fixture(name="detector") def fixture_detector(gl: Groundlight) -> Detector: """Creates a new Test detector.""" @@ -18,16 +20,19 @@ def fixture_detector(gl: Groundlight) -> Detector: pipeline_config = "never-review" return gl.create_detector(name=name, query=query, pipeline_config=pipeline_config) + @pytest.fixture(name="image_query_yes") def fixture_image_query_yes(gl: Groundlight, detector: Detector) -> ImageQuery: iq = gl.submit_image_query(detector=detector.id, image="test/assets/dog.jpeg", human_review="NEVER") return iq + @pytest.fixture(name="image_query_no") def fixture_image_query_no(gl: Groundlight, detector: Detector) -> ImageQuery: iq = gl.submit_image_query(detector=detector.id, image="test/assets/cat.jpeg", human_review="NEVER") return iq + @pytest.fixture(name="gl_experimental") def _gl() -> ExperimentalApi: return ExperimentalApi() diff --git a/test/unit/test_experimental.py b/test/unit/test_experimental.py index 9acfada2..48fa277a 100644 --- a/test/unit/test_experimental.py +++ b/test/unit/test_experimental.py @@ -1,6 +1,7 @@ from datetime import datetime -from groundlight import ExperimentalApi, Detector, ImageQuery, ROI +from groundlight import ExperimentalApi, ImageQuery + def test_detector_groups(gl_experimental: ExperimentalApi): """ @@ -11,6 +12,7 @@ def test_detector_groups(gl_experimental: ExperimentalApi): all_groups = gl_experimental.list_detector_groups() assert created_group in all_groups + def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuery): """ verify that we can submit an ROI @@ -19,10 +21,11 @@ def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuer roi = gl_experimental.create_roi(label_name, (0, 0), (0.5, 0.5)) gl_experimental.add_label(image_query_yes.id, "YES", [roi]) + def test_submit_rois(gl_experimental: ExperimentalApi, image_query_no: ImageQuery): """ verify that we can submit multiple ROIs """ label_name = "dog" roi = gl_experimental.create_roi(label_name, (0, 0), (0.5, 0.5)) - gl_experimental.add_label(image_query_no, "YES", [roi]*3) \ No newline at end of file + gl_experimental.add_label(image_query_no, "YES", [roi] * 3) From 223524a50a588f183b603c9d93c46120c1716bd8 Mon Sep 17 00:00:00 2001 From: brandon Date: Fri, 2 Aug 2024 15:01:20 -0700 Subject: [PATCH 08/15] wip --- src/groundlight/experimental_api.py | 1 + test/unit/test_experimental.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index cfa7079e..0708628a 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -257,4 +257,5 @@ def add_label( api_label = convert_display_label_to_internal(image_query_id, label) rois_json = [roi.dict() for roi in rois] if rois else None request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=rois_json) + import IPython; IPython.embed() self.labels_api.create_label(request_params) diff --git a/test/unit/test_experimental.py b/test/unit/test_experimental.py index 48fa277a..ce1cb988 100644 --- a/test/unit/test_experimental.py +++ b/test/unit/test_experimental.py @@ -22,7 +22,7 @@ def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuer gl_experimental.add_label(image_query_yes.id, "YES", [roi]) -def test_submit_rois(gl_experimental: ExperimentalApi, image_query_no: ImageQuery): +def test_submit_multiple_rois(gl_experimental: ExperimentalApi, image_query_no: ImageQuery): """ verify that we can submit multiple ROIs """ From fd0ddd8a24d4aa0805ad8cbda3b71d9b3890cf61 Mon Sep 17 00:00:00 2001 From: brandon Date: Mon, 5 Aug 2024 10:52:14 -0700 Subject: [PATCH 09/15] Fixing tests --- Makefile | 2 +- src/groundlight/experimental_api.py | 15 ++++++++++++--- test/unit/test_experimental.py | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5cc4a261..7e8ebc70 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ PYTEST=poetry run pytest -v # `make test TEST_ARGS="-k some_filter"` TEST_ARGS= -CLOUD_FILTERS = -m "not run_only_for_edge_endpoint" +CLOUD_FILTERS = -m "not (run_only_for_edge_endpoint or skip)" EDGE_FILTERS = -m "not skip_for_edge_endpoint" test: install ## Run tests against the prod API (needs GROUNDLIGHT_API_TOKEN) diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 0708628a..446b49c3 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -20,6 +20,8 @@ from groundlight_openapi_client.model.label_value_request import LabelValueRequest from groundlight_openapi_client.model.note_request import NoteRequest from groundlight_openapi_client.model.rule_request import RuleRequest +from groundlight_openapi_client.model.roi_request import ROIRequest +from groundlight_openapi_client.model.b_box_geometry_request import BBoxGeometryRequest from groundlight_openapi_client.model.verb_enum import VerbEnum from model import ROI, BBoxGeometry, Detector, DetectorGroup, ImageQuery, PaginatedRuleList, Rule @@ -255,7 +257,14 @@ def add_label( if not image_query_id.startswith(("chk_", "iq_")): raise ValueError(f"Invalid image query id {image_query_id}") api_label = convert_display_label_to_internal(image_query_id, label) - rois_json = [roi.dict() for roi in rois] if rois else None - request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=rois_json) - import IPython; IPython.embed() + geometry_requests = [BBoxGeometryRequest(**roi.geometry.dict()) for roi in rois] if rois else None + roi_requests = ( + [ + ROIRequest(label=roi.label, score=roi.score, geometry=geometry) + for roi, geometry in zip(rois, geometry_requests) + ] + if rois + else None + ) + request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=roi_requests) self.labels_api.create_label(request_params) diff --git a/test/unit/test_experimental.py b/test/unit/test_experimental.py index ce1cb988..215a0eb6 100644 --- a/test/unit/test_experimental.py +++ b/test/unit/test_experimental.py @@ -1,4 +1,5 @@ from datetime import datetime +import pytest from groundlight import ExperimentalApi, ImageQuery @@ -13,6 +14,14 @@ def test_detector_groups(gl_experimental: ExperimentalApi): assert created_group in all_groups +pytest.mark.skip( + reason=( + "Users currently don't have permission to turn object detection on their own. If you have questions, reach out" + " to Groundlight support." + ) +) + + def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuery): """ verify that we can submit an ROI @@ -22,6 +31,14 @@ def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuer gl_experimental.add_label(image_query_yes.id, "YES", [roi]) +pytest.mark.skip( + reason=( + "Users currently don't have permission to turn object detection on their own. If you have questions, reach out" + " to Groundlight support." + ) +) + + def test_submit_multiple_rois(gl_experimental: ExperimentalApi, image_query_no: ImageQuery): """ verify that we can submit multiple ROIs From 88f85d4c75c80bb4cd682a40d039c8050e0bbcfd Mon Sep 17 00:00:00 2001 From: brandon Date: Mon, 5 Aug 2024 10:52:33 -0700 Subject: [PATCH 10/15] regenerating --- generated/.openapi-generator/FILES | 50 +- generated/README.md | 4 +- generated/docs/BBoxGeometry.md | 1 + generated/docs/BBoxGeometryRequest.md | 16 + generated/docs/ImageQuery.md | 1 + generated/docs/LabelValue.md | 5 +- generated/docs/LabelValueRequest.md | 2 +- generated/docs/LabelsApi.md | 12 +- generated/docs/ROI.md | 1 + generated/docs/ROIRequest.md | 14 + .../api/images_api.py | 134 ------ .../api/rules_api.py | 435 ------------------ ...ion_input.py => b_box_geometry_request.py} | 44 +- .../model/blank_enum.py | 274 ----------- .../model/detector_creation_input.py | 319 ------------- .../model/image_query.py | 11 + .../model/label_value.py | 63 +-- .../model/label_value_request.py | 21 +- .../model/null_enum.py | 282 ------------ .../model/review_reason_enum.py | 290 ------------ ...lassification_result.py => roi_request.py} | 44 +- .../model/rule_base.py | 317 ------------- .../model/rule_creation_input.py | 365 --------------- .../groundlight_openapi_client/model/user.py | 274 ----------- .../models/__init__.py | 4 +- generated/model.py | 82 ++-- generated/test/test_action.py | 7 +- ...enum.py => test_b_box_geometry_request.py} | 12 +- generated/test/test_classification_result.py | 35 -- generated/test/test_condition.py | 7 +- generated/test/test_detector.py | 4 +- .../test/test_detector_creation_input.py | 35 -- generated/test/test_detector_type_enum.py | 4 +- generated/test/test_detectors_api.py | 16 +- generated/test/test_image_queries_api.py | 8 +- generated/test/test_image_query.py | 6 + generated/test/test_image_query_type_enum.py | 4 +- generated/test/test_images_api.py | 32 -- generated/test/test_inline_response200.py | 7 +- generated/test/test_label_value.py | 8 +- generated/test/test_label_value_request.py | 8 +- generated/test/test_labels_api.py | 4 +- generated/test/test_note.py | 4 +- generated/test/test_note_creation_input.py | 35 -- generated/test/test_notes_api.py | 4 +- generated/test/test_null_enum.py | 35 -- .../test/test_paginated_all_notes_list.py | 38 -- .../test/test_paginated_detector_list.py | 4 +- .../test/test_paginated_image_query_list.py | 4 +- generated/test/test_paginated_rule_list.py | 4 +- generated/test/test_result_type_enum.py | 4 +- generated/test/test_review_reason_enum.py | 35 -- ...nated_note_list.py => test_roi_request.py} | 16 +- generated/test/test_rule.py | 8 +- generated/test/test_rule_base.py | 40 -- generated/test/test_rule_creation_input.py | 42 -- generated/test/test_rules_api.py | 44 -- generated/test/test_user.py | 35 -- generated/test/test_user_api.py | 4 +- spec/public-api.yaml | 105 +++-- 60 files changed, 366 insertions(+), 3357 deletions(-) create mode 100644 generated/docs/BBoxGeometryRequest.md create mode 100644 generated/docs/ROIRequest.md delete mode 100644 generated/groundlight_openapi_client/api/images_api.py delete mode 100644 generated/groundlight_openapi_client/api/rules_api.py rename generated/groundlight_openapi_client/model/{note_creation_input.py => b_box_geometry_request.py} (89%) delete mode 100644 generated/groundlight_openapi_client/model/blank_enum.py delete mode 100644 generated/groundlight_openapi_client/model/detector_creation_input.py delete mode 100644 generated/groundlight_openapi_client/model/null_enum.py delete mode 100644 generated/groundlight_openapi_client/model/review_reason_enum.py rename generated/groundlight_openapi_client/model/{classification_result.py => roi_request.py} (90%) delete mode 100644 generated/groundlight_openapi_client/model/rule_base.py delete mode 100644 generated/groundlight_openapi_client/model/rule_creation_input.py delete mode 100644 generated/groundlight_openapi_client/model/user.py rename generated/test/{test_blank_enum.py => test_b_box_geometry_request.py} (66%) delete mode 100644 generated/test/test_classification_result.py delete mode 100644 generated/test/test_detector_creation_input.py delete mode 100644 generated/test/test_images_api.py delete mode 100644 generated/test/test_note_creation_input.py delete mode 100644 generated/test/test_null_enum.py delete mode 100644 generated/test/test_paginated_all_notes_list.py delete mode 100644 generated/test/test_review_reason_enum.py rename generated/test/{test_paginated_note_list.py => test_roi_request.py} (61%) delete mode 100644 generated/test/test_rule_base.py delete mode 100644 generated/test/test_rule_creation_input.py delete mode 100644 generated/test/test_rules_api.py delete mode 100644 generated/test/test_user.py diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index 084f5922..8d630f4c 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -8,6 +8,7 @@ docs/ActionsApi.md docs/AllNotes.md docs/AnnotationsRequestedEnum.md docs/BBoxGeometry.md +docs/BBoxGeometryRequest.md docs/BinaryClassificationResult.md docs/ChannelEnum.md docs/Condition.md @@ -31,13 +32,12 @@ docs/ModeEnum.md docs/Note.md docs/NoteRequest.md docs/NotesApi.md -docs/NullEnum.md docs/PaginatedDetectorList.md docs/PaginatedImageQueryList.md docs/PaginatedRuleList.md docs/ROI.md +docs/ROIRequest.md docs/ResultTypeEnum.md -docs/ReviewReasonEnum.md docs/Rule.md docs/RuleRequest.md docs/SnoozeTimeUnitEnum.md @@ -64,6 +64,7 @@ groundlight_openapi_client/model/action_request.py groundlight_openapi_client/model/all_notes.py groundlight_openapi_client/model/annotations_requested_enum.py groundlight_openapi_client/model/b_box_geometry.py +groundlight_openapi_client/model/b_box_geometry_request.py groundlight_openapi_client/model/binary_classification_result.py groundlight_openapi_client/model/channel_enum.py groundlight_openapi_client/model/condition.py @@ -82,13 +83,12 @@ groundlight_openapi_client/model/label_value_request.py groundlight_openapi_client/model/mode_enum.py groundlight_openapi_client/model/note.py groundlight_openapi_client/model/note_request.py -groundlight_openapi_client/model/null_enum.py groundlight_openapi_client/model/paginated_detector_list.py groundlight_openapi_client/model/paginated_image_query_list.py groundlight_openapi_client/model/paginated_rule_list.py groundlight_openapi_client/model/result_type_enum.py -groundlight_openapi_client/model/review_reason_enum.py groundlight_openapi_client/model/roi.py +groundlight_openapi_client/model/roi_request.py groundlight_openapi_client/model/rule.py groundlight_openapi_client/model/rule_request.py groundlight_openapi_client/model/snooze_time_unit_enum.py @@ -102,4 +102,46 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_action.py +test/test_action_request.py +test/test_actions_api.py +test/test_all_notes.py +test/test_annotations_requested_enum.py +test/test_b_box_geometry.py +test/test_b_box_geometry_request.py +test/test_binary_classification_result.py +test/test_channel_enum.py +test/test_condition.py +test/test_condition_request.py +test/test_counting_result.py +test/test_detector.py +test/test_detector_creation_input_request.py +test/test_detector_group.py +test/test_detector_group_request.py +test/test_detector_groups_api.py +test/test_detector_type_enum.py +test/test_detectors_api.py +test/test_image_queries_api.py +test/test_image_query.py +test/test_image_query_type_enum.py +test/test_inline_response200.py +test/test_label_value.py +test/test_label_value_request.py +test/test_labels_api.py +test/test_mode_enum.py +test/test_note.py +test/test_note_request.py +test/test_notes_api.py +test/test_paginated_detector_list.py +test/test_paginated_image_query_list.py +test/test_paginated_rule_list.py +test/test_result_type_enum.py +test/test_roi.py +test/test_roi_request.py +test/test_rule.py +test/test_rule_request.py +test/test_snooze_time_unit_enum.py +test/test_source_enum.py +test/test_user_api.py +test/test_verb_enum.py tox.ini diff --git a/generated/README.md b/generated/README.md index 08f16cac..60492381 100644 --- a/generated/README.md +++ b/generated/README.md @@ -139,6 +139,7 @@ Class | Method | HTTP request | Description - [AllNotes](docs/AllNotes.md) - [AnnotationsRequestedEnum](docs/AnnotationsRequestedEnum.md) - [BBoxGeometry](docs/BBoxGeometry.md) + - [BBoxGeometryRequest](docs/BBoxGeometryRequest.md) - [BinaryClassificationResult](docs/BinaryClassificationResult.md) - [ChannelEnum](docs/ChannelEnum.md) - [Condition](docs/Condition.md) @@ -157,13 +158,12 @@ Class | Method | HTTP request | Description - [ModeEnum](docs/ModeEnum.md) - [Note](docs/Note.md) - [NoteRequest](docs/NoteRequest.md) - - [NullEnum](docs/NullEnum.md) - [PaginatedDetectorList](docs/PaginatedDetectorList.md) - [PaginatedImageQueryList](docs/PaginatedImageQueryList.md) - [PaginatedRuleList](docs/PaginatedRuleList.md) - [ROI](docs/ROI.md) + - [ROIRequest](docs/ROIRequest.md) - [ResultTypeEnum](docs/ResultTypeEnum.md) - - [ReviewReasonEnum](docs/ReviewReasonEnum.md) - [Rule](docs/Rule.md) - [RuleRequest](docs/RuleRequest.md) - [SnoozeTimeUnitEnum](docs/SnoozeTimeUnitEnum.md) diff --git a/generated/docs/BBoxGeometry.md b/generated/docs/BBoxGeometry.md index e062ed84..432bb48c 100644 --- a/generated/docs/BBoxGeometry.md +++ b/generated/docs/BBoxGeometry.md @@ -1,5 +1,6 @@ # BBoxGeometry +Mixin for serializers to handle data in the StrictBaseModel format ## Properties Name | Type | Description | Notes diff --git a/generated/docs/BBoxGeometryRequest.md b/generated/docs/BBoxGeometryRequest.md new file mode 100644 index 00000000..93432d84 --- /dev/null +++ b/generated/docs/BBoxGeometryRequest.md @@ -0,0 +1,16 @@ +# BBoxGeometryRequest + +Mixin for serializers to handle data in the StrictBaseModel format + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**left** | **float** | | +**top** | **float** | | +**right** | **float** | | +**bottom** | **float** | | +**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/ImageQuery.md b/generated/docs/ImageQuery.md index 92078b73..9589ee7d 100644 --- a/generated/docs/ImageQuery.md +++ b/generated/docs/ImageQuery.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **result** | **bool, date, datetime, dict, float, int, list, str, none_type** | The result of the image query. | [readonly] **patience_time** | **float** | How long to wait for a confident response. | [readonly] **confidence_threshold** | **float** | Min confidence needed to accept the response of the image query. | [readonly] +**bounding_boxes** | [**[ROI], none_type**](ROI.md) | An array of bounding boxes collected on image | [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/LabelValue.md b/generated/docs/LabelValue.md index 02404352..9d4bf329 100644 --- a/generated/docs/LabelValue.md +++ b/generated/docs/LabelValue.md @@ -4,16 +4,13 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**value** | **float, none_type** | | [readonly] **confidence** | **float, none_type** | | [readonly] **class_name** | **str, none_type** | A human-readable class name for this label | [readonly] -**feedback_text** | **str, none_type** | | [readonly] **annotations_requested** | **[bool, date, datetime, dict, float, int, list, str, none_type]** | | [readonly] -**review_reason** | **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] -**rois** | **bool, date, datetime, dict, float, int, list, str, none_type** | List of region-of-interest (ROI) annotations | [optional] +**rois** | [**[ROI], none_type**](ROI.md) | | [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/LabelValueRequest.md b/generated/docs/LabelValueRequest.md index 1789d7d7..a6934ab5 100644 --- a/generated/docs/LabelValueRequest.md +++ b/generated/docs/LabelValueRequest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **label** | **str** | | **image_query_id** | **str** | | -**rois** | **bool, date, datetime, dict, float, int, list, str, none_type** | List of region-of-interest (ROI) annotations | [optional] +**rois** | [**[ROIRequest], none_type**](ROIRequest.md) | | [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/LabelsApi.md b/generated/docs/LabelsApi.md index e7845a27..487e3fe4 100644 --- a/generated/docs/LabelsApi.md +++ b/generated/docs/LabelsApi.md @@ -49,7 +49,17 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: label_value_request = LabelValueRequest( label="label_example", image_query_id="image_query_id_example", - rois=None, + rois=[ + ROIRequest( + label="label_example", + geometry=BBoxGeometryRequest( + left=3.14, + top=3.14, + right=3.14, + bottom=3.14, + ), + ), + ], ) # LabelValueRequest | # example passing only required values which don't have defaults set diff --git a/generated/docs/ROI.md b/generated/docs/ROI.md index 84e5d7ad..1c17de14 100644 --- a/generated/docs/ROI.md +++ b/generated/docs/ROI.md @@ -1,5 +1,6 @@ # ROI +A serializer for ROI objects. Corresponds directly with predictors.types.ROI The class should handle like a normal serializer, just note that the when instantiating as ROISerializer(instance=obj), the obj is the json representation pulled straight from the database ## Properties Name | Type | Description | Notes diff --git a/generated/docs/ROIRequest.md b/generated/docs/ROIRequest.md new file mode 100644 index 00000000..11c5d232 --- /dev/null +++ b/generated/docs/ROIRequest.md @@ -0,0 +1,14 @@ +# ROIRequest + +A serializer for ROI objects. Corresponds directly with predictors.types.ROI The class should handle like a normal serializer, just note that the when instantiating as ROISerializer(instance=obj), the obj is the json representation pulled straight from the database + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**label** | **str** | The label of the bounding box. | +**geometry** | [**BBoxGeometryRequest**](BBoxGeometryRequest.md) | | +**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/api/images_api.py b/generated/groundlight_openapi_client/api/images_api.py deleted file mode 100644 index 1dd52ab2..00000000 --- a/generated/groundlight_openapi_client/api/images_api.py +++ /dev/null @@ -1,134 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) - - -class ImagesApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - self.get_image_endpoint = _Endpoint( - settings={ - "response_type": (file_type,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/image-queries/{id}/image", - "operation_id": "get_image", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (str,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["image/jpeg"], - "content_type": [], - }, - api_client=api_client, - ) - - def get_image(self, id, **kwargs): - """get_image # noqa: E501 - - Retrieve an image by its image query id. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_image(id, async_req=True) - >>> result = thread.get() - - Args: - id (str): Choose an image by its image query id. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - file_type - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.get_image_endpoint.call_with_http_info(**kwargs) diff --git a/generated/groundlight_openapi_client/api/rules_api.py b/generated/groundlight_openapi_client/api/rules_api.py deleted file mode 100644 index 6b7b4567..00000000 --- a/generated/groundlight_openapi_client/api/rules_api.py +++ /dev/null @@ -1,435 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList -from groundlight_openapi_client.model.rule import Rule -from groundlight_openapi_client.model.rule_creation_input import RuleCreationInput - - -class RulesApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - self.create_rule_endpoint = _Endpoint( - settings={ - "response_type": (Rule,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/actions/detector/{detector_id}/rules", - "operation_id": "create_rule", - "http_method": "POST", - "servers": None, - }, - params_map={ - "all": [ - "detector_id", - "rule_creation_input", - ], - "required": [ - "detector_id", - "rule_creation_input", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_id": (str,), - "rule_creation_input": (RuleCreationInput,), - }, - "attribute_map": { - "detector_id": "detector_id", - }, - "location_map": { - "detector_id": "path", - "rule_creation_input": "body", - }, - "collection_format_map": {}, - }, - headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, - api_client=api_client, - ) - self.delete_rule_endpoint = _Endpoint( - settings={ - "response_type": None, - "auth": ["ApiToken"], - "endpoint_path": "/v1/actions/rules/{id}", - "operation_id": "delete_rule", - "http_method": "DELETE", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (int,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": [], - "content_type": [], - }, - api_client=api_client, - ) - self.get_rule_endpoint = _Endpoint( - settings={ - "response_type": (Rule,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/actions/rules/{id}", - "operation_id": "get_rule", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (int,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, - ) - self.list_rules_endpoint = _Endpoint( - settings={ - "response_type": (PaginatedRuleList,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/actions/rules", - "operation_id": "list_rules", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "page", - "page_size", - ], - "required": [], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "page": (int,), - "page_size": (int,), - }, - "attribute_map": { - "page": "page", - "page_size": "page_size", - }, - "location_map": { - "page": "query", - "page_size": "query", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, - ) - - def create_rule(self, detector_id, rule_creation_input, **kwargs): - """create_rule # noqa: E501 - - Create a new rule for a detector. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_rule(detector_id, rule_creation_input, async_req=True) - >>> result = thread.get() - - Args: - detector_id (str): Choose a detector by its ID. - rule_creation_input (RuleCreationInput): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Rule - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_id"] = detector_id - kwargs["rule_creation_input"] = rule_creation_input - return self.create_rule_endpoint.call_with_http_info(**kwargs) - - def delete_rule(self, id, **kwargs): - """delete_rule # noqa: E501 - - Delete a rule # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_rule(id, async_req=True) - >>> result = thread.get() - - Args: - id (int): Delete a rule by its ID. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.delete_rule_endpoint.call_with_http_info(**kwargs) - - def get_rule(self, id, **kwargs): - """get_rule # noqa: E501 - - Retrieve a rule # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_rule(id, async_req=True) - >>> result = thread.get() - - Args: - id (int): Get a rule by its ID. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Rule - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.get_rule_endpoint.call_with_http_info(**kwargs) - - def list_rules(self, **kwargs): - """list_rules # noqa: E501 - - Retrieve a list of rules. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_rules(async_req=True) - >>> result = thread.get() - - - Keyword Args: - page (int): A page number within the paginated result set.. [optional] - page_size (int): Number of results to return per page.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PaginatedRuleList - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - return self.list_rules_endpoint.call_with_http_info(**kwargs) diff --git a/generated/groundlight_openapi_client/model/note_creation_input.py b/generated/groundlight_openapi_client/model/b_box_geometry_request.py similarity index 89% rename from generated/groundlight_openapi_client/model/note_creation_input.py rename to generated/groundlight_openapi_client/model/b_box_geometry_request.py index 2cdce48d..6e756bd6 100644 --- a/generated/groundlight_openapi_client/model/note_creation_input.py +++ b/generated/groundlight_openapi_client/model/b_box_geometry_request.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -29,7 +29,7 @@ from groundlight_openapi_client.exceptions import ApiAttributeError -class NoteCreationInput(ModelNormal): +class BBoxGeometryRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -88,7 +88,10 @@ def openapi_types(): and the value is attribute type. """ return { - "content": (str,), # noqa: E501 + "left": (float,), # noqa: E501 + "top": (float,), # noqa: E501 + "right": (float,), # noqa: E501 + "bottom": (float,), # noqa: E501 } @cached_property @@ -96,7 +99,10 @@ def discriminator(): return None attribute_map = { - "content": "content", # noqa: E501 + "left": "left", # noqa: E501 + "top": "top", # noqa: E501 + "right": "right", # noqa: E501 + "bottom": "bottom", # noqa: E501 } read_only_vars = {} @@ -105,11 +111,14 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, content, *args, **kwargs): # noqa: E501 - """NoteCreationInput - a model defined in OpenAPI + def _from_openapi_data(cls, left, top, right, bottom, *args, **kwargs): # noqa: E501 + """BBoxGeometryRequest - a model defined in OpenAPI Args: - content (str): The text inside the note + left (float): + top (float): + right (float): + bottom (float): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -170,7 +179,10 @@ def _from_openapi_data(cls, content, *args, **kwargs): # noqa: E501 self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.content = content + self.left = left + self.top = top + self.right = right + self.bottom = bottom for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map @@ -193,11 +205,14 @@ def _from_openapi_data(cls, content, *args, **kwargs): # noqa: E501 ]) @convert_js_args_to_python_args - def __init__(self, content, *args, **kwargs): # noqa: E501 - """NoteCreationInput - a model defined in OpenAPI + def __init__(self, left, top, right, bottom, *args, **kwargs): # noqa: E501 + """BBoxGeometryRequest - a model defined in OpenAPI Args: - content (str): The text inside the note + left (float): + top (float): + right (float): + bottom (float): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -256,7 +271,10 @@ def __init__(self, content, *args, **kwargs): # noqa: E501 self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.content = content + self.left = left + self.top = top + self.right = right + self.bottom = bottom for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map diff --git a/generated/groundlight_openapi_client/model/blank_enum.py b/generated/groundlight_openapi_client/model/blank_enum.py deleted file mode 100644 index 8f634d5b..00000000 --- a/generated/groundlight_openapi_client/model/blank_enum.py +++ /dev/null @@ -1,274 +0,0 @@ -""" - Groundlight API - - 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.15.3 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel, -) -from groundlight_openapi_client.exceptions import ApiAttributeError - - -class BlankEnum(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ("value",): { - "EMPTY": "", - }, - } - - validations = {} - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - "value": (str,), - } - - @cached_property - def discriminator(): - return None - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """BlankEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): if omitted defaults to "", must be one of ["", ] # noqa: E501 - - Keyword Args: - value (str): if omitted defaults to "", must be one of ["", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop("_path_to_item", ()) - - if "value" in kwargs: - value = kwargs.pop("value") - elif args: - args = list(args) - value = args.pop(0) - else: - value = "" - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." - % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """BlankEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): if omitted defaults to "", must be one of ["", ] # noqa: E501 - - Keyword Args: - value (str): if omitted defaults to "", must be one of ["", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop("_path_to_item", ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if "value" in kwargs: - value = kwargs.pop("value") - elif args: - args = list(args) - value = args.pop(0) - else: - value = "" - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." - % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/generated/groundlight_openapi_client/model/detector_creation_input.py b/generated/groundlight_openapi_client/model/detector_creation_input.py deleted file mode 100644 index 7e1e6788..00000000 --- a/generated/groundlight_openapi_client/model/detector_creation_input.py +++ /dev/null @@ -1,319 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel, -) -from groundlight_openapi_client.exceptions import ApiAttributeError - - -class DetectorCreationInput(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = {} - - validations = { - ("name",): { - "max_length": 200, - }, - ("query",): { - "max_length": 300, - }, - ("group_name",): { - "max_length": 100, - }, - ("confidence_threshold",): { - "inclusive_maximum": 1.0, - "inclusive_minimum": 0.0, - }, - ("pipeline_config",): { - "max_length": 8192, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return ( - bool, - date, - datetime, - dict, - float, - int, - list, - str, - none_type, - ) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - "name": (str,), # noqa: E501 - "query": (str,), # noqa: E501 - "group_name": (str,), # noqa: E501 - "confidence_threshold": (float,), # noqa: E501 - "pipeline_config": ( - str, - none_type, - ), # noqa: E501 - "metadata": ( - str, - none_type, - ), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - attribute_map = { - "name": "name", # noqa: E501 - "query": "query", # noqa: E501 - "group_name": "group_name", # noqa: E501 - "confidence_threshold": "confidence_threshold", # noqa: E501 - "pipeline_config": "pipeline_config", # noqa: E501 - "metadata": "metadata", # noqa: E501 - } - - read_only_vars = {} - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, name, query, *args, **kwargs): # noqa: E501 - """DetectorCreationInput - a model defined in OpenAPI - - Args: - name (str): A short, descriptive name for the detector. - query (str): A question about the image. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - group_name (str): Which group should this detector be part of?. [optional] # noqa: E501 - confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501 - pipeline_config (str, none_type): (Advanced usage) Configuration to instantiate a specific prediction pipeline.. [optional] # noqa: E501 - metadata (str, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded as a URL-safe, base64-encoded JSON string.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _path_to_item = kwargs.pop("_path_to_item", ()) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.query = query - for var_name, var_value in kwargs.items(): - if ( - var_name not in self.attribute_map - and self._configuration is not None - and self._configuration.discard_unknown_keys - and self.additional_properties_type is None - ): - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ]) - - @convert_js_args_to_python_args - def __init__(self, name, query, *args, **kwargs): # noqa: E501 - """DetectorCreationInput - a model defined in OpenAPI - - Args: - name (str): A short, descriptive name for the detector. - query (str): A question about the image. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - group_name (str): Which group should this detector be part of?. [optional] # noqa: E501 - confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501 - pipeline_config (str, none_type): (Advanced usage) Configuration to instantiate a specific prediction pipeline.. [optional] # noqa: E501 - metadata (str, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded as a URL-safe, base64-encoded JSON string.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _path_to_item = kwargs.pop("_path_to_item", ()) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.query = query - for var_name, var_value in kwargs.items(): - if ( - var_name not in self.attribute_map - and self._configuration is not None - and self._configuration.discard_unknown_keys - and self.additional_properties_type is None - ): - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - "class with read only attributes." - ) diff --git a/generated/groundlight_openapi_client/model/image_query.py b/generated/groundlight_openapi_client/model/image_query.py index cb570040..e5b18667 100644 --- a/generated/groundlight_openapi_client/model/image_query.py +++ b/generated/groundlight_openapi_client/model/image_query.py @@ -34,10 +34,12 @@ def lazy_import(): from groundlight_openapi_client.model.counting_result import CountingResult from groundlight_openapi_client.model.image_query_type_enum import ImageQueryTypeEnum from groundlight_openapi_client.model.result_type_enum import ResultTypeEnum + from groundlight_openapi_client.model.roi import ROI globals()["BinaryClassificationResult"] = BinaryClassificationResult globals()["CountingResult"] = CountingResult globals()["ImageQueryTypeEnum"] = ImageQueryTypeEnum + globals()["ROI"] = ROI globals()["ResultTypeEnum"] = ResultTypeEnum @@ -145,6 +147,10 @@ def openapi_types(): ), # noqa: E501 "patience_time": (float,), # noqa: E501 "confidence_threshold": (float,), # noqa: E501 + "bounding_boxes": ( + [ROI], + none_type, + ), # noqa: E501 } @cached_property @@ -162,6 +168,7 @@ def discriminator(): "result": "result", # noqa: E501 "patience_time": "patience_time", # noqa: E501 "confidence_threshold": "confidence_threshold", # noqa: E501 + "bounding_boxes": "bounding_boxes", # noqa: E501 } read_only_vars = { @@ -175,6 +182,7 @@ def discriminator(): "result", # noqa: E501 "patience_time", # noqa: E501 "confidence_threshold", # noqa: E501 + "bounding_boxes", # noqa: E501 } _composed_schemas = {} @@ -193,6 +201,7 @@ def _from_openapi_data( result, patience_time, confidence_threshold, + bounding_boxes, *args, **kwargs, ): # noqa: E501 @@ -209,6 +218,7 @@ def _from_openapi_data( result (bool, date, datetime, dict, float, int, list, str, none_type): The result of the image query. patience_time (float): How long to wait for a confident response. confidence_threshold (float): Min confidence needed to accept the response of the image query. + bounding_boxes ([ROI], none_type): An array of bounding boxes collected on image Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -279,6 +289,7 @@ def _from_openapi_data( self.result = result self.patience_time = patience_time self.confidence_threshold = confidence_threshold + self.bounding_boxes = bounding_boxes for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map diff --git a/generated/groundlight_openapi_client/model/label_value.py b/generated/groundlight_openapi_client/model/label_value.py index 38a55f68..7cb397e6 100644 --- a/generated/groundlight_openapi_client/model/label_value.py +++ b/generated/groundlight_openapi_client/model/label_value.py @@ -31,13 +31,11 @@ def lazy_import(): from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum - from groundlight_openapi_client.model.null_enum import NullEnum - from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum + from groundlight_openapi_client.model.roi import ROI from groundlight_openapi_client.model.source_enum import SourceEnum globals()["AnnotationsRequestedEnum"] = AnnotationsRequestedEnum - globals()["NullEnum"] = NullEnum - globals()["ReviewReasonEnum"] = ReviewReasonEnum + globals()["ROI"] = ROI globals()["SourceEnum"] = SourceEnum @@ -102,10 +100,6 @@ def openapi_types(): """ lazy_import() return { - "value": ( - float, - none_type, - ), # noqa: E501 "confidence": ( float, none_type, @@ -114,22 +108,7 @@ def openapi_types(): str, none_type, ), # noqa: E501 - "feedback_text": ( - str, - none_type, - ), # noqa: E501 "annotations_requested": ([bool, date, datetime, dict, float, int, list, str, none_type],), # noqa: E501 - "review_reason": ( - bool, - date, - datetime, - dict, - float, - int, - list, - str, - none_type, - ), # noqa: E501 "created_at": (datetime,), # noqa: E501 "detector_id": ( int, @@ -147,14 +126,7 @@ def openapi_types(): none_type, ), # noqa: E501 "rois": ( - bool, - date, - datetime, - dict, - float, - int, - list, - str, + [ROI], none_type, ), # noqa: E501 } @@ -164,12 +136,9 @@ def discriminator(): return None attribute_map = { - "value": "value", # noqa: E501 "confidence": "confidence", # noqa: E501 "class_name": "class_name", # noqa: E501 - "feedback_text": "feedback_text", # noqa: E501 "annotations_requested": "annotations_requested", # noqa: E501 - "review_reason": "review_reason", # noqa: E501 "created_at": "created_at", # noqa: E501 "detector_id": "detector_id", # noqa: E501 "source": "source", # noqa: E501 @@ -177,12 +146,9 @@ def discriminator(): } read_only_vars = { - "value", # noqa: E501 "confidence", # noqa: E501 "class_name", # noqa: E501 - "feedback_text", # noqa: E501 "annotations_requested", # noqa: E501 - "review_reason", # noqa: E501 "created_at", # noqa: E501 "detector_id", # noqa: E501 "source", # noqa: E501 @@ -193,28 +159,14 @@ def discriminator(): @classmethod @convert_js_args_to_python_args def _from_openapi_data( - cls, - value, - confidence, - class_name, - feedback_text, - annotations_requested, - review_reason, - created_at, - detector_id, - source, - *args, - **kwargs, + cls, confidence, class_name, annotations_requested, created_at, detector_id, source, *args, **kwargs ): # noqa: E501 """LabelValue - a model defined in OpenAPI Args: - value (float, none_type): confidence (float, none_type): class_name (str, none_type): A human-readable class name for this label - feedback_text (str, none_type): annotations_requested ([bool, date, datetime, dict, float, int, list, str, none_type]): - review_reason (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): @@ -250,7 +202,7 @@ def _from_openapi_data( Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 + rois ([ROI], none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -279,12 +231,9 @@ def _from_openapi_data( self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value self.confidence = confidence self.class_name = class_name - self.feedback_text = feedback_text self.annotations_requested = annotations_requested - self.review_reason = review_reason self.created_at = created_at self.detector_id = detector_id self.source = source @@ -344,7 +293,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 + rois ([ROI], 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 d563099b..36ecde44 100644 --- a/generated/groundlight_openapi_client/model/label_value_request.py +++ b/generated/groundlight_openapi_client/model/label_value_request.py @@ -29,6 +29,12 @@ from groundlight_openapi_client.exceptions import ApiAttributeError +def lazy_import(): + from groundlight_openapi_client.model.roi_request import ROIRequest + + globals()["ROIRequest"] = ROIRequest + + class LabelValueRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -70,6 +76,7 @@ def additional_properties_type(): This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ + lazy_import() return ( bool, date, @@ -94,18 +101,12 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ + lazy_import() return { "label": (str,), # noqa: E501 "image_query_id": (str,), # noqa: E501 "rois": ( - bool, - date, - datetime, - dict, - float, - int, - list, - str, + [ROIRequest], none_type, ), # noqa: E501 } @@ -164,7 +165,7 @@ def _from_openapi_data(cls, label, image_query_id, *args, **kwargs): # noqa: E5 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 + rois ([ROIRequest], none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -255,7 +256,7 @@ def __init__(self, label, image_query_id, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - rois (bool, date, datetime, dict, float, int, list, str, none_type): List of region-of-interest (ROI) annotations. [optional] # noqa: E501 + rois ([ROIRequest], none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) diff --git a/generated/groundlight_openapi_client/model/null_enum.py b/generated/groundlight_openapi_client/model/null_enum.py deleted file mode 100644 index e1e8c4f5..00000000 --- a/generated/groundlight_openapi_client/model/null_enum.py +++ /dev/null @@ -1,282 +0,0 @@ -""" - Groundlight API - - 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.15.3 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel, -) -from groundlight_openapi_client.exceptions import ApiAttributeError - - -class NullEnum(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ("value",): { - "NULL": "null", - }, - } - - validations = {} - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - "value": (str,), - } - - @cached_property - def discriminator(): - return None - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """NullEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str):, must be one of ["null", ] # noqa: E501 - - Keyword Args: - value (str):, must be one of ["null", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop("_path_to_item", ()) - - if "value" in kwargs: - value = kwargs.pop("value") - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." - % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """NullEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str):, must be one of ["null", ] # noqa: E501 - - Keyword Args: - value (str):, must be one of ["null", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop("_path_to_item", ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if "value" in kwargs: - value = kwargs.pop("value") - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." - % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/generated/groundlight_openapi_client/model/review_reason_enum.py b/generated/groundlight_openapi_client/model/review_reason_enum.py deleted file mode 100644 index ac2cdabf..00000000 --- a/generated/groundlight_openapi_client/model/review_reason_enum.py +++ /dev/null @@ -1,290 +0,0 @@ -""" - Groundlight API - - 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.15.3 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel, -) -from groundlight_openapi_client.exceptions import ApiAttributeError - - -class ReviewReasonEnum(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ("value",): { - "ESCALATION": "ESCALATION", - "AUDIT": "AUDIT", - "ASSESSMENT": "ASSESSMENT", - "CUSTOMER_INITIATED": "CUSTOMER_INITIATED", - "CONFIDENT_UNCLEAR": "CONFIDENT_UNCLEAR", - "CONFIDENT_UNCLEAR_AUDIT": "CONFIDENT_UNCLEAR_AUDIT", - "DISAGREEMENT": "DISAGREEMENT", - "DISAGREEMENT_ON_ASSESSMENT": "DISAGREEMENT_ON_ASSESSMENT", - "CONFIRM_ACTION_TRIGGER": "CONFIRM_ACTION_TRIGGER", - }, - } - - validations = {} - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - "value": (str,), - } - - @cached_property - def discriminator(): - return None - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """ReviewReasonEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): * `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER., must be one of ["ESCALATION", "AUDIT", "ASSESSMENT", "CUSTOMER_INITIATED", "CONFIDENT_UNCLEAR", "CONFIDENT_UNCLEAR_AUDIT", "DISAGREEMENT", "DISAGREEMENT_ON_ASSESSMENT", "CONFIRM_ACTION_TRIGGER", ] # noqa: E501 - - Keyword Args: - value (str): * `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER., must be one of ["ESCALATION", "AUDIT", "ASSESSMENT", "CUSTOMER_INITIATED", "CONFIDENT_UNCLEAR", "CONFIDENT_UNCLEAR_AUDIT", "DISAGREEMENT", "DISAGREEMENT_ON_ASSESSMENT", "CONFIRM_ACTION_TRIGGER", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop("_path_to_item", ()) - - if "value" in kwargs: - value = kwargs.pop("value") - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." - % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """ReviewReasonEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): * `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER., must be one of ["ESCALATION", "AUDIT", "ASSESSMENT", "CUSTOMER_INITIATED", "CONFIDENT_UNCLEAR", "CONFIDENT_UNCLEAR_AUDIT", "DISAGREEMENT", "DISAGREEMENT_ON_ASSESSMENT", "CONFIRM_ACTION_TRIGGER", ] # noqa: E501 - - Keyword Args: - value (str): * `ESCALATION` - ESCALATION * `AUDIT` - AUDIT * `ASSESSMENT` - ASSESSMENT * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT * `DISAGREEMENT` - DISAGREEMENT * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER., must be one of ["ESCALATION", "AUDIT", "ASSESSMENT", "CUSTOMER_INITIATED", "CONFIDENT_UNCLEAR", "CONFIDENT_UNCLEAR_AUDIT", "DISAGREEMENT", "DISAGREEMENT_ON_ASSESSMENT", "CONFIRM_ACTION_TRIGGER", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop("_path_to_item", ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if "value" in kwargs: - value = kwargs.pop("value") - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." - % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/generated/groundlight_openapi_client/model/classification_result.py b/generated/groundlight_openapi_client/model/roi_request.py similarity index 90% rename from generated/groundlight_openapi_client/model/classification_result.py rename to generated/groundlight_openapi_client/model/roi_request.py index ca1aedb2..07dbb5cc 100644 --- a/generated/groundlight_openapi_client/model/classification_result.py +++ b/generated/groundlight_openapi_client/model/roi_request.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -29,7 +29,13 @@ from groundlight_openapi_client.exceptions import ApiAttributeError -class ClassificationResult(ModelNormal): +def lazy_import(): + from groundlight_openapi_client.model.b_box_geometry_request import BBoxGeometryRequest + + globals()["BBoxGeometryRequest"] = BBoxGeometryRequest + + +class ROIRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -56,9 +62,8 @@ class ClassificationResult(ModelNormal): allowed_values = {} validations = { - ("confidence",): { - "inclusive_maximum": 1, - "inclusive_minimum": 0, + ("label",): { + "min_length": 1, }, } @@ -68,6 +73,7 @@ def additional_properties_type(): This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ + lazy_import() return ( bool, date, @@ -92,12 +98,10 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ + lazy_import() return { "label": (str,), # noqa: E501 - "confidence": ( - float, - none_type, - ), # noqa: E501 + "geometry": (BBoxGeometryRequest,), # noqa: E501 } @cached_property @@ -106,7 +110,7 @@ def discriminator(): attribute_map = { "label": "label", # noqa: E501 - "confidence": "confidence", # noqa: E501 + "geometry": "geometry", # noqa: E501 } read_only_vars = {} @@ -115,11 +119,12 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, label, *args, **kwargs): # noqa: E501 - """ClassificationResult - a model defined in OpenAPI + def _from_openapi_data(cls, label, geometry, *args, **kwargs): # noqa: E501 + """ROIRequest - a model defined in OpenAPI Args: - label (str): What is the predicted label? + label (str): The label of the bounding box. + geometry (BBoxGeometryRequest): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -152,7 +157,6 @@ def _from_openapi_data(cls, label, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - confidence (float, none_type): On a scale of 0 to 1, how confident are we in the predicted label?. [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -182,6 +186,7 @@ def _from_openapi_data(cls, label, *args, **kwargs): # noqa: E501 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.label = label + self.geometry = geometry for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map @@ -204,11 +209,12 @@ def _from_openapi_data(cls, label, *args, **kwargs): # noqa: E501 ]) @convert_js_args_to_python_args - def __init__(self, label, *args, **kwargs): # noqa: E501 - """ClassificationResult - a model defined in OpenAPI + def __init__(self, label, geometry, *args, **kwargs): # noqa: E501 + """ROIRequest - a model defined in OpenAPI Args: - label (str): What is the predicted label? + label (str): The label of the bounding box. + geometry (BBoxGeometryRequest): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -241,7 +247,6 @@ def __init__(self, label, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - confidence (float, none_type): On a scale of 0 to 1, how confident are we in the predicted label?. [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -269,6 +274,7 @@ def __init__(self, label, *args, **kwargs): # noqa: E501 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.label = label + self.geometry = geometry for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map diff --git a/generated/groundlight_openapi_client/model/rule_base.py b/generated/groundlight_openapi_client/model/rule_base.py deleted file mode 100644 index 20f1dc5e..00000000 --- a/generated/groundlight_openapi_client/model/rule_base.py +++ /dev/null @@ -1,317 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel, -) -from groundlight_openapi_client.exceptions import ApiAttributeError - - -def lazy_import(): - from groundlight_openapi_client.model.action import Action - from groundlight_openapi_client.model.condition import Condition - - globals()["Action"] = Action - globals()["Condition"] = Condition - - -class RuleBase(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ("snooze_time_unit",): { - "SECONDS": "SECONDS", - "MINUTES": "MINUTES", - "HOURS": "HOURS", - "DAYS": "DAYS", - }, - } - - validations = { - ("name",): { - "max_length": 200, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - lazy_import() - return ( - bool, - date, - datetime, - dict, - float, - int, - list, - str, - none_type, - ) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - lazy_import() - return { - "detector_id": (str,), # noqa: E501 - "name": (str,), # noqa: E501 - "enabled": (bool,), # noqa: E501 - "snooze_time_enabled": (bool,), # noqa: E501 - "snooze_time_value": (int,), # noqa: E501 - "snooze_time_unit": (str,), # noqa: E501 - "action": (Action,), # noqa: E501 - "condition": (Condition,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - attribute_map = { - "detector_id": "detector_id", # noqa: E501 - "name": "name", # noqa: E501 - "enabled": "enabled", # noqa: E501 - "snooze_time_enabled": "snooze_time_enabled", # noqa: E501 - "snooze_time_value": "snooze_time_value", # noqa: E501 - "snooze_time_unit": "snooze_time_unit", # noqa: E501 - "action": "action", # noqa: E501 - "condition": "condition", # noqa: E501 - } - - read_only_vars = {} - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RuleBase - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - detector_id (str): Which detector should this rule be associated with?. [optional] # noqa: E501 - name (str): A short, descriptive name for the rule.. [optional] # noqa: E501 - enabled (bool): Is this rule enabled?. [optional] if omitted the server will use the default value of True # noqa: E501 - snooze_time_enabled (bool): Is this rule snooze time enabled?. [optional] if omitted the server will use the default value of False # noqa: E501 - snooze_time_value (int): How long to snooze the rule for (in seconds).. [optional] if omitted the server will use the default value of 1 # noqa: E501 - snooze_time_unit (str): What unit of time to use for the snooze time.. [optional] if omitted the server will use the default value of "DAYS" # noqa: E501 - action (Action): [optional] # noqa: E501 - condition (Condition): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _path_to_item = kwargs.pop("_path_to_item", ()) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if ( - var_name not in self.attribute_map - and self._configuration is not None - and self._configuration.discard_unknown_keys - and self.additional_properties_type is None - ): - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RuleBase - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - detector_id (str): Which detector should this rule be associated with?. [optional] # noqa: E501 - name (str): A short, descriptive name for the rule.. [optional] # noqa: E501 - enabled (bool): Is this rule enabled?. [optional] if omitted the server will use the default value of True # noqa: E501 - snooze_time_enabled (bool): Is this rule snooze time enabled?. [optional] if omitted the server will use the default value of False # noqa: E501 - snooze_time_value (int): How long to snooze the rule for (in seconds).. [optional] if omitted the server will use the default value of 1 # noqa: E501 - snooze_time_unit (str): What unit of time to use for the snooze time.. [optional] if omitted the server will use the default value of "DAYS" # noqa: E501 - action (Action): [optional] # noqa: E501 - condition (Condition): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _path_to_item = kwargs.pop("_path_to_item", ()) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if ( - var_name not in self.attribute_map - and self._configuration is not None - and self._configuration.discard_unknown_keys - and self.additional_properties_type is None - ): - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - "class with read only attributes." - ) diff --git a/generated/groundlight_openapi_client/model/rule_creation_input.py b/generated/groundlight_openapi_client/model/rule_creation_input.py deleted file mode 100644 index 0be588b7..00000000 --- a/generated/groundlight_openapi_client/model/rule_creation_input.py +++ /dev/null @@ -1,365 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel, -) -from groundlight_openapi_client.exceptions import ApiAttributeError - - -def lazy_import(): - from groundlight_openapi_client.model.action import Action - from groundlight_openapi_client.model.condition import Condition - from groundlight_openapi_client.model.rule_base import RuleBase - - globals()["Action"] = Action - globals()["Condition"] = Condition - globals()["RuleBase"] = RuleBase - - -class RuleCreationInput(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ("snooze_time_unit",): { - "SECONDS": "SECONDS", - "MINUTES": "MINUTES", - "HOURS": "HOURS", - "DAYS": "DAYS", - }, - } - - validations = { - ("name",): { - "max_length": 200, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - lazy_import() - return ( - bool, - date, - datetime, - dict, - float, - int, - list, - str, - none_type, - ) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - lazy_import() - return { - "detector_id": (str,), # noqa: E501 - "name": (str,), # noqa: E501 - "enabled": (bool,), # noqa: E501 - "snooze_time_enabled": (bool,), # noqa: E501 - "snooze_time_value": (int,), # noqa: E501 - "snooze_time_unit": (str,), # noqa: E501 - "action": (Action,), # noqa: E501 - "condition": (Condition,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - attribute_map = { - "detector_id": "detector_id", # noqa: E501 - "name": "name", # noqa: E501 - "enabled": "enabled", # noqa: E501 - "snooze_time_enabled": "snooze_time_enabled", # noqa: E501 - "snooze_time_value": "snooze_time_value", # noqa: E501 - "snooze_time_unit": "snooze_time_unit", # noqa: E501 - "action": "action", # noqa: E501 - "condition": "condition", # noqa: E501 - } - - read_only_vars = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RuleCreationInput - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - detector_id (str): Which detector should this rule be associated with?. [optional] # noqa: E501 - name (str): A short, descriptive name for the rule.. [optional] # noqa: E501 - enabled (bool): Is this rule enabled?. [optional] if omitted the server will use the default value of True # noqa: E501 - snooze_time_enabled (bool): Is this rule snooze time enabled?. [optional] if omitted the server will use the default value of False # noqa: E501 - snooze_time_value (int): How long to snooze the rule for (in seconds).. [optional] if omitted the server will use the default value of 1 # noqa: E501 - snooze_time_unit (str): What unit of time to use for the snooze time.. [optional] if omitted the server will use the default value of "DAYS" # noqa: E501 - action (Action): [optional] # noqa: E501 - condition (Condition): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _path_to_item = kwargs.pop("_path_to_item", ()) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - constant_args = { - "_check_type": _check_type, - "_path_to_item": _path_to_item, - "_spec_property_naming": _spec_property_naming, - "_configuration": _configuration, - "_visited_composed_classes": self._visited_composed_classes, - } - composed_info = validate_get_composed_info(constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if ( - var_name in discarded_args - and self._configuration is not None - and self._configuration.discard_unknown_keys - and self._additional_properties_model_instances - ): - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - "_composed_instances", - "_var_name_to_model_instances", - "_additional_properties_model_instances", - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RuleCreationInput - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - detector_id (str): Which detector should this rule be associated with?. [optional] # noqa: E501 - name (str): A short, descriptive name for the rule.. [optional] # noqa: E501 - enabled (bool): Is this rule enabled?. [optional] if omitted the server will use the default value of True # noqa: E501 - snooze_time_enabled (bool): Is this rule snooze time enabled?. [optional] if omitted the server will use the default value of False # noqa: E501 - snooze_time_value (int): How long to snooze the rule for (in seconds).. [optional] if omitted the server will use the default value of 1 # noqa: E501 - snooze_time_unit (str): What unit of time to use for the snooze time.. [optional] if omitted the server will use the default value of "DAYS" # noqa: E501 - action (Action): [optional] # noqa: E501 - condition (Condition): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _path_to_item = kwargs.pop("_path_to_item", ()) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - constant_args = { - "_check_type": _check_type, - "_path_to_item": _path_to_item, - "_spec_property_naming": _spec_property_naming, - "_configuration": _configuration, - "_visited_composed_classes": self._visited_composed_classes, - } - composed_info = validate_get_composed_info(constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if ( - var_name in discarded_args - and self._configuration is not None - and self._configuration.discard_unknown_keys - and self._additional_properties_model_instances - ): - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - "class with read only attributes." - ) - - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - lazy_import() - return { - "anyOf": [], - "allOf": [ - RuleBase, - ], - "oneOf": [], - } diff --git a/generated/groundlight_openapi_client/model/user.py b/generated/groundlight_openapi_client/model/user.py deleted file mode 100644 index e78b021e..00000000 --- a/generated/groundlight_openapi_client/model/user.py +++ /dev/null @@ -1,274 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel, -) -from groundlight_openapi_client.exceptions import ApiAttributeError - - -class User(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = {} - - validations = {} - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return ( - bool, - date, - datetime, - dict, - float, - int, - list, - str, - none_type, - ) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - "username": (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - attribute_map = { - "username": "username", # noqa: E501 - } - - read_only_vars = {} - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, username, *args, **kwargs): # noqa: E501 - """User - a model defined in OpenAPI - - Args: - username (str): The user's username. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _path_to_item = kwargs.pop("_path_to_item", ()) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.username = username - for var_name, var_value in kwargs.items(): - if ( - var_name not in self.attribute_map - and self._configuration is not None - and self._configuration.discard_unknown_keys - and self.additional_properties_type is None - ): - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ]) - - @convert_js_args_to_python_args - def __init__(self, username, *args, **kwargs): # noqa: E501 - """User - a model defined in OpenAPI - - Args: - username (str): The user's username. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop("_check_type", True) - _spec_property_naming = kwargs.pop("_spec_property_naming", False) - _path_to_item = kwargs.pop("_path_to_item", ()) - _configuration = kwargs.pop("_configuration", None) - _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.username = username - for var_name, var_value in kwargs.items(): - if ( - var_name not in self.attribute_map - and self._configuration is not None - and self._configuration.discard_unknown_keys - and self.additional_properties_type is None - ): - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - "class with read only attributes." - ) diff --git a/generated/groundlight_openapi_client/models/__init__.py b/generated/groundlight_openapi_client/models/__init__.py index 4a31acce..0491cc60 100644 --- a/generated/groundlight_openapi_client/models/__init__.py +++ b/generated/groundlight_openapi_client/models/__init__.py @@ -14,6 +14,7 @@ from groundlight_openapi_client.model.all_notes import AllNotes from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum from groundlight_openapi_client.model.b_box_geometry import BBoxGeometry +from groundlight_openapi_client.model.b_box_geometry_request import BBoxGeometryRequest from groundlight_openapi_client.model.binary_classification_result import BinaryClassificationResult from groundlight_openapi_client.model.channel_enum import ChannelEnum from groundlight_openapi_client.model.condition import Condition @@ -32,13 +33,12 @@ from groundlight_openapi_client.model.mode_enum import ModeEnum from groundlight_openapi_client.model.note import Note from groundlight_openapi_client.model.note_request import NoteRequest -from groundlight_openapi_client.model.null_enum import NullEnum from groundlight_openapi_client.model.paginated_detector_list import PaginatedDetectorList from groundlight_openapi_client.model.paginated_image_query_list import PaginatedImageQueryList from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList from groundlight_openapi_client.model.roi import ROI +from groundlight_openapi_client.model.roi_request import ROIRequest from groundlight_openapi_client.model.result_type_enum import ResultTypeEnum -from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum from groundlight_openapi_client.model.rule import Rule from groundlight_openapi_client.model.rule_request import RuleRequest from groundlight_openapi_client.model.snooze_time_unit_enum import SnoozeTimeUnitEnum diff --git a/generated/model.py b/generated/model.py index 7637d7e3..cc5cc2ba 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2024-07-31T22:47:13+00:00 +# timestamp: 2024-08-05T17:49:43+00:00 from __future__ import annotations @@ -22,6 +22,10 @@ class AnnotationsRequestedEnum(Enum): class BBoxGeometry(BaseModel): + """ + Mixin for serializers to handle data in the StrictBaseModel format + """ + left: float top: float right: float @@ -30,6 +34,17 @@ class BBoxGeometry(BaseModel): y: float +class BBoxGeometryRequest(BaseModel): + """ + Mixin for serializers to handle data in the StrictBaseModel format + """ + + left: float + top: float + right: float + bottom: float + + class ChannelEnum(Enum): """ * `EMAIL` - EMAIL @@ -57,12 +72,6 @@ class ImageQueryTypeEnum(Enum): image_query = "image_query" -class LabelValueRequest(BaseModel): - label: constr(min_length=1) - image_query_id: constr(min_length=1) - rois: Optional[Any] = Field(None, description="List of region-of-interest (ROI) annotations") - - class ModeEnum(Enum): """ * `BINARY` - BINARY @@ -84,43 +93,36 @@ class NoteRequest(BaseModel): content: constr(min_length=1) = Field(..., description="Text content of the note.") -class NullEnum(Enum): - NoneType_None = None +class ROI(BaseModel): + """ + A serializer for ROI objects. + Corresponds directly with predictors.types.ROI + The class should handle like a normal serializer, just note that the when instantiating as + ROISerializer(instance=obj), the obj is the json representation pulled straight from the database + """ -class ROI(BaseModel): label: str = Field(..., description="The label of the bounding box.") score: float = Field(..., description="The confidence of the bounding box.") geometry: BBoxGeometry -class ResultTypeEnum(Enum): - binary_classification = "binary_classification" - counting = "counting" - - -class ReviewReasonEnum(Enum): +class ROIRequest(BaseModel): """ - * `ESCALATION` - ESCALATION - * `AUDIT` - AUDIT - * `ASSESSMENT` - ASSESSMENT - * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED - * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR - * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT - * `DISAGREEMENT` - DISAGREEMENT - * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT - * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER + A serializer for ROI objects. + Corresponds directly with predictors.types.ROI + + The class should handle like a normal serializer, just note that the when instantiating as + ROISerializer(instance=obj), the obj is the json representation pulled straight from the database """ - ESCALATION = "ESCALATION" - AUDIT = "AUDIT" - ASSESSMENT = "ASSESSMENT" - CUSTOMER_INITIATED = "CUSTOMER_INITIATED" - CONFIDENT_UNCLEAR = "CONFIDENT_UNCLEAR" - CONFIDENT_UNCLEAR_AUDIT = "CONFIDENT_UNCLEAR_AUDIT" - DISAGREEMENT = "DISAGREEMENT" - DISAGREEMENT_ON_ASSESSMENT = "DISAGREEMENT_ON_ASSESSMENT" - CONFIRM_ACTION_TRIGGER = "CONFIRM_ACTION_TRIGGER" + label: constr(min_length=1) = Field(..., description="The label of the bounding box.") + geometry: BBoxGeometryRequest + + +class ResultTypeEnum(Enum): + binary_classification = "binary_classification" + counting = "counting" class SnoozeTimeUnitEnum(Enum): @@ -298,21 +300,25 @@ class ImageQuery(BaseModel): confidence_threshold: float = Field( ..., description="Min confidence needed to accept the response of the image query." ) + bounding_boxes: Optional[List[ROI]] = Field(..., description="An array of bounding boxes collected on image") class LabelValue(BaseModel): - value: Optional[float] = Field(...) confidence: Optional[float] = Field(...) class_name: Optional[str] = Field(..., description="A human-readable class name for this label") - feedback_text: Optional[str] = Field(...) - rois: Optional[Any] = Field(None, description="List of region-of-interest (ROI) annotations") + rois: Optional[List[ROI]] = None annotations_requested: List[AnnotationsRequestedEnum] - review_reason: Optional[Union[ReviewReasonEnum, NullEnum]] = Field(...) created_at: datetime detector_id: Optional[int] = Field(...) source: SourceEnum +class LabelValueRequest(BaseModel): + label: constr(min_length=1) + image_query_id: constr(min_length=1) + rois: Optional[List[ROIRequest]] = None + + class PaginatedDetectorList(BaseModel): count: int = Field(..., example=123) next: Optional[AnyUrl] = Field(None, example="http://api.example.org/accounts/?page=4") diff --git a/generated/test/test_action.py b/generated/test/test_action.py index 05e47837..533ecd23 100644 --- a/generated/test/test_action.py +++ b/generated/test/test_action.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -12,6 +12,9 @@ import unittest import groundlight_openapi_client +from groundlight_openapi_client.model.channel_enum import ChannelEnum + +globals()["ChannelEnum"] = ChannelEnum from groundlight_openapi_client.model.action import Action diff --git a/generated/test/test_blank_enum.py b/generated/test/test_b_box_geometry_request.py similarity index 66% rename from generated/test/test_blank_enum.py rename to generated/test/test_b_box_geometry_request.py index 14707bf4..0a17a4a9 100644 --- a/generated/test/test_blank_enum.py +++ b/generated/test/test_b_box_geometry_request.py @@ -12,11 +12,11 @@ import unittest import groundlight_openapi_client -from groundlight_openapi_client.model.blank_enum import BlankEnum +from groundlight_openapi_client.model.b_box_geometry_request import BBoxGeometryRequest -class TestBlankEnum(unittest.TestCase): - """BlankEnum unit test stubs""" +class TestBBoxGeometryRequest(unittest.TestCase): + """BBoxGeometryRequest unit test stubs""" def setUp(self): pass @@ -24,10 +24,10 @@ def setUp(self): def tearDown(self): pass - def testBlankEnum(self): - """Test BlankEnum""" + def testBBoxGeometryRequest(self): + """Test BBoxGeometryRequest""" # FIXME: construct object with mandatory attributes with example values - # model = BlankEnum() # noqa: E501 + # model = BBoxGeometryRequest() # noqa: E501 pass diff --git a/generated/test/test_classification_result.py b/generated/test/test_classification_result.py deleted file mode 100644 index a95afa37..00000000 --- a/generated/test/test_classification_result.py +++ /dev/null @@ -1,35 +0,0 @@ -""" - Groundlight API - - 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.15.3 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import sys -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.model.classification_result import ClassificationResult - - -class TestClassificationResult(unittest.TestCase): - """ClassificationResult unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassificationResult(self): - """Test ClassificationResult""" - # FIXME: construct object with mandatory attributes with example values - # model = ClassificationResult() # noqa: E501 - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_condition.py b/generated/test/test_condition.py index f7830b38..55820e20 100644 --- a/generated/test/test_condition.py +++ b/generated/test/test_condition.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -12,6 +12,9 @@ import unittest import groundlight_openapi_client +from groundlight_openapi_client.model.verb_enum import VerbEnum + +globals()["VerbEnum"] = VerbEnum from groundlight_openapi_client.model.condition import Condition diff --git a/generated/test/test_detector.py b/generated/test/test_detector.py index 56ad9079..93c39251 100644 --- a/generated/test/test_detector.py +++ b/generated/test/test_detector.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/test/test_detector_creation_input.py b/generated/test/test_detector_creation_input.py deleted file mode 100644 index 63c2afb2..00000000 --- a/generated/test/test_detector_creation_input.py +++ /dev/null @@ -1,35 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import sys -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.model.detector_creation_input import DetectorCreationInput - - -class TestDetectorCreationInput(unittest.TestCase): - """DetectorCreationInput unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testDetectorCreationInput(self): - """Test DetectorCreationInput""" - # FIXME: construct object with mandatory attributes with example values - # model = DetectorCreationInput() # noqa: E501 - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_detector_type_enum.py b/generated/test/test_detector_type_enum.py index b4fe6029..5208bf9d 100644 --- a/generated/test/test_detector_type_enum.py +++ b/generated/test/test_detector_type_enum.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/test/test_detectors_api.py b/generated/test/test_detectors_api.py index 422e6a75..654127eb 100644 --- a/generated/test/test_detectors_api.py +++ b/generated/test/test_detectors_api.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -27,10 +27,22 @@ def test_create_detector(self): """Test case for create_detector""" pass + def test_create_detector_group2(self): + """Test case for create_detector_group2""" + pass + + def test_delete_detector(self): + """Test case for delete_detector""" + pass + def test_get_detector(self): """Test case for get_detector""" pass + def test_get_detector_groups2(self): + """Test case for get_detector_groups2""" + pass + def test_list_detectors(self): """Test case for list_detectors""" pass diff --git a/generated/test/test_image_queries_api.py b/generated/test/test_image_queries_api.py index 01ae7442..337f8a24 100644 --- a/generated/test/test_image_queries_api.py +++ b/generated/test/test_image_queries_api.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -23,6 +23,10 @@ def setUp(self): def tearDown(self): pass + def test_get_image(self): + """Test case for get_image""" + pass + def test_get_image_query(self): """Test case for get_image_query""" pass diff --git a/generated/test/test_image_query.py b/generated/test/test_image_query.py index eed34123..5b9cfeda 100644 --- a/generated/test/test_image_query.py +++ b/generated/test/test_image_query.py @@ -12,10 +12,16 @@ import unittest import groundlight_openapi_client +from groundlight_openapi_client.model.binary_classification_result import BinaryClassificationResult +from groundlight_openapi_client.model.counting_result import CountingResult from groundlight_openapi_client.model.image_query_type_enum import ImageQueryTypeEnum from groundlight_openapi_client.model.result_type_enum import ResultTypeEnum +from groundlight_openapi_client.model.roi import ROI +globals()["BinaryClassificationResult"] = BinaryClassificationResult +globals()["CountingResult"] = CountingResult globals()["ImageQueryTypeEnum"] = ImageQueryTypeEnum +globals()["ROI"] = ROI globals()["ResultTypeEnum"] = ResultTypeEnum from groundlight_openapi_client.model.image_query import ImageQuery diff --git a/generated/test/test_image_query_type_enum.py b/generated/test/test_image_query_type_enum.py index 2484c245..3b4fdf62 100644 --- a/generated/test/test_image_query_type_enum.py +++ b/generated/test/test_image_query_type_enum.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/test/test_images_api.py b/generated/test/test_images_api.py deleted file mode 100644 index ef7f4e18..00000000 --- a/generated/test/test_images_api.py +++ /dev/null @@ -1,32 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.api.images_api import ImagesApi # noqa: E501 - - -class TestImagesApi(unittest.TestCase): - """ImagesApi unit test stubs""" - - def setUp(self): - self.api = ImagesApi() # noqa: E501 - - def tearDown(self): - pass - - def test_get_image(self): - """Test case for get_image""" - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_inline_response200.py b/generated/test/test_inline_response200.py index 1b31c00d..6848d1f5 100644 --- a/generated/test/test_inline_response200.py +++ b/generated/test/test_inline_response200.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -12,9 +12,6 @@ import unittest import groundlight_openapi_client -from groundlight_openapi_client.model.note import Note - -globals()["Note"] = Note from groundlight_openapi_client.model.inline_response200 import InlineResponse200 diff --git a/generated/test/test_label_value.py b/generated/test/test_label_value.py index 23d239cc..e68cf812 100644 --- a/generated/test/test_label_value.py +++ b/generated/test/test_label_value.py @@ -13,15 +13,11 @@ import groundlight_openapi_client from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum -from groundlight_openapi_client.model.blank_enum import BlankEnum -from groundlight_openapi_client.model.null_enum import NullEnum -from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum +from groundlight_openapi_client.model.roi import ROI from groundlight_openapi_client.model.source_enum import SourceEnum globals()["AnnotationsRequestedEnum"] = AnnotationsRequestedEnum -globals()["BlankEnum"] = BlankEnum -globals()["NullEnum"] = NullEnum -globals()["ReviewReasonEnum"] = ReviewReasonEnum +globals()["ROI"] = ROI globals()["SourceEnum"] = SourceEnum from groundlight_openapi_client.model.label_value import LabelValue diff --git a/generated/test/test_label_value_request.py b/generated/test/test_label_value_request.py index d8b9e6cc..bd9c93c3 100644 --- a/generated/test/test_label_value_request.py +++ b/generated/test/test_label_value_request.py @@ -12,13 +12,9 @@ import unittest import groundlight_openapi_client -from groundlight_openapi_client.model.blank_enum import BlankEnum -from groundlight_openapi_client.model.null_enum import NullEnum -from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum +from groundlight_openapi_client.model.roi_request import ROIRequest -globals()["BlankEnum"] = BlankEnum -globals()["NullEnum"] = NullEnum -globals()["ReviewReasonEnum"] = ReviewReasonEnum +globals()["ROIRequest"] = ROIRequest from groundlight_openapi_client.model.label_value_request import LabelValueRequest diff --git a/generated/test/test_labels_api.py b/generated/test/test_labels_api.py index 1fd03968..4d583f2a 100644 --- a/generated/test/test_labels_api.py +++ b/generated/test/test_labels_api.py @@ -23,8 +23,8 @@ def setUp(self): def tearDown(self): pass - def test_labels_create(self): - """Test case for labels_create""" + def test_create_label(self): + """Test case for create_label""" pass diff --git a/generated/test/test_note.py b/generated/test/test_note.py index e96516d0..ce74c309 100644 --- a/generated/test/test_note.py +++ b/generated/test/test_note.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/test/test_note_creation_input.py b/generated/test/test_note_creation_input.py deleted file mode 100644 index 79f5c4c4..00000000 --- a/generated/test/test_note_creation_input.py +++ /dev/null @@ -1,35 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import sys -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.model.note_creation_input import NoteCreationInput - - -class TestNoteCreationInput(unittest.TestCase): - """NoteCreationInput unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testNoteCreationInput(self): - """Test NoteCreationInput""" - # FIXME: construct object with mandatory attributes with example values - # model = NoteCreationInput() # noqa: E501 - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_notes_api.py b/generated/test/test_notes_api.py index 71b527ae..9ae90325 100644 --- a/generated/test/test_notes_api.py +++ b/generated/test/test_notes_api.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/test/test_null_enum.py b/generated/test/test_null_enum.py deleted file mode 100644 index 893cd0c7..00000000 --- a/generated/test/test_null_enum.py +++ /dev/null @@ -1,35 +0,0 @@ -""" - Groundlight API - - 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.15.3 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import sys -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.model.null_enum import NullEnum - - -class TestNullEnum(unittest.TestCase): - """NullEnum unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testNullEnum(self): - """Test NullEnum""" - # FIXME: construct object with mandatory attributes with example values - # model = NullEnum() # noqa: E501 - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_paginated_all_notes_list.py b/generated/test/test_paginated_all_notes_list.py deleted file mode 100644 index e35ee324..00000000 --- a/generated/test/test_paginated_all_notes_list.py +++ /dev/null @@ -1,38 +0,0 @@ -""" - Groundlight API - - 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.15.3 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import sys -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.model.all_notes import AllNotes - -globals()["AllNotes"] = AllNotes -from groundlight_openapi_client.model.paginated_all_notes_list import PaginatedAllNotesList - - -class TestPaginatedAllNotesList(unittest.TestCase): - """PaginatedAllNotesList unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testPaginatedAllNotesList(self): - """Test PaginatedAllNotesList""" - # FIXME: construct object with mandatory attributes with example values - # model = PaginatedAllNotesList() # noqa: E501 - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_paginated_detector_list.py b/generated/test/test_paginated_detector_list.py index 496730dd..24a02160 100644 --- a/generated/test/test_paginated_detector_list.py +++ b/generated/test/test_paginated_detector_list.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/test/test_paginated_image_query_list.py b/generated/test/test_paginated_image_query_list.py index 5488a2ec..01afa4e8 100644 --- a/generated/test/test_paginated_image_query_list.py +++ b/generated/test/test_paginated_image_query_list.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/test/test_paginated_rule_list.py b/generated/test/test_paginated_rule_list.py index f03d3751..12f3b387 100644 --- a/generated/test/test_paginated_rule_list.py +++ b/generated/test/test_paginated_rule_list.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/test/test_result_type_enum.py b/generated/test/test_result_type_enum.py index aaaefe90..68312d1a 100644 --- a/generated/test/test_result_type_enum.py +++ b/generated/test/test_result_type_enum.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/generated/test/test_review_reason_enum.py b/generated/test/test_review_reason_enum.py deleted file mode 100644 index 10a728de..00000000 --- a/generated/test/test_review_reason_enum.py +++ /dev/null @@ -1,35 +0,0 @@ -""" - Groundlight API - - 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.15.3 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import sys -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.model.review_reason_enum import ReviewReasonEnum - - -class TestReviewReasonEnum(unittest.TestCase): - """ReviewReasonEnum unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testReviewReasonEnum(self): - """Test ReviewReasonEnum""" - # FIXME: construct object with mandatory attributes with example values - # model = ReviewReasonEnum() # noqa: E501 - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_paginated_note_list.py b/generated/test/test_roi_request.py similarity index 61% rename from generated/test/test_paginated_note_list.py rename to generated/test/test_roi_request.py index 9c66490f..836b26f1 100644 --- a/generated/test/test_paginated_note_list.py +++ b/generated/test/test_roi_request.py @@ -12,14 +12,14 @@ import unittest import groundlight_openapi_client -from groundlight_openapi_client.model.note import Note +from groundlight_openapi_client.model.b_box_geometry_request import BBoxGeometryRequest -globals()["Note"] = Note -from groundlight_openapi_client.model.paginated_note_list import PaginatedNoteList +globals()["BBoxGeometryRequest"] = BBoxGeometryRequest +from groundlight_openapi_client.model.roi_request import ROIRequest -class TestPaginatedNoteList(unittest.TestCase): - """PaginatedNoteList unit test stubs""" +class TestROIRequest(unittest.TestCase): + """ROIRequest unit test stubs""" def setUp(self): pass @@ -27,10 +27,10 @@ def setUp(self): def tearDown(self): pass - def testPaginatedNoteList(self): - """Test PaginatedNoteList""" + def testROIRequest(self): + """Test ROIRequest""" # FIXME: construct object with mandatory attributes with example values - # model = PaginatedNoteList() # noqa: E501 + # model = ROIRequest() # noqa: E501 pass diff --git a/generated/test/test_rule.py b/generated/test/test_rule.py index 3714818f..9720d2a2 100644 --- a/generated/test/test_rule.py +++ b/generated/test/test_rule.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ @@ -14,11 +14,11 @@ import groundlight_openapi_client from groundlight_openapi_client.model.action import Action from groundlight_openapi_client.model.condition import Condition -from groundlight_openapi_client.model.rule_base import RuleBase +from groundlight_openapi_client.model.snooze_time_unit_enum import SnoozeTimeUnitEnum globals()["Action"] = Action globals()["Condition"] = Condition -globals()["RuleBase"] = RuleBase +globals()["SnoozeTimeUnitEnum"] = SnoozeTimeUnitEnum from groundlight_openapi_client.model.rule import Rule diff --git a/generated/test/test_rule_base.py b/generated/test/test_rule_base.py deleted file mode 100644 index 8c53a1ac..00000000 --- a/generated/test/test_rule_base.py +++ /dev/null @@ -1,40 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import sys -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.model.action import Action -from groundlight_openapi_client.model.condition import Condition - -globals()["Action"] = Action -globals()["Condition"] = Condition -from groundlight_openapi_client.model.rule_base import RuleBase - - -class TestRuleBase(unittest.TestCase): - """RuleBase unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testRuleBase(self): - """Test RuleBase""" - # FIXME: construct object with mandatory attributes with example values - # model = RuleBase() # noqa: E501 - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_rule_creation_input.py b/generated/test/test_rule_creation_input.py deleted file mode 100644 index 4684d6c0..00000000 --- a/generated/test/test_rule_creation_input.py +++ /dev/null @@ -1,42 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import sys -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.model.action import Action -from groundlight_openapi_client.model.condition import Condition -from groundlight_openapi_client.model.rule_base import RuleBase - -globals()["Action"] = Action -globals()["Condition"] = Condition -globals()["RuleBase"] = RuleBase -from groundlight_openapi_client.model.rule_creation_input import RuleCreationInput - - -class TestRuleCreationInput(unittest.TestCase): - """RuleCreationInput unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testRuleCreationInput(self): - """Test RuleCreationInput""" - # FIXME: construct object with mandatory attributes with example values - # model = RuleCreationInput() # noqa: E501 - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_rules_api.py b/generated/test/test_rules_api.py deleted file mode 100644 index 36539521..00000000 --- a/generated/test/test_rules_api.py +++ /dev/null @@ -1,44 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.api.rules_api import RulesApi # noqa: E501 - - -class TestRulesApi(unittest.TestCase): - """RulesApi unit test stubs""" - - def setUp(self): - self.api = RulesApi() # noqa: E501 - - def tearDown(self): - pass - - def test_create_rule(self): - """Test case for create_rule""" - pass - - def test_delete_rule(self): - """Test case for delete_rule""" - pass - - def test_get_rule(self): - """Test case for get_rule""" - pass - - def test_list_rules(self): - """Test case for list_rules""" - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_user.py b/generated/test/test_user.py deleted file mode 100644 index c6e7f5f3..00000000 --- a/generated/test/test_user.py +++ /dev/null @@ -1,35 +0,0 @@ -""" - Groundlight API - - Easy Computer Vision powered by Natural Language # noqa: E501 - - The version of the OpenAPI document: 0.6.0 - Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" - -import sys -import unittest - -import groundlight_openapi_client -from groundlight_openapi_client.model.user import User - - -class TestUser(unittest.TestCase): - """User unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUser(self): - """Test User""" - # FIXME: construct object with mandatory attributes with example values - # model = User() # noqa: E501 - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/generated/test/test_user_api.py b/generated/test/test_user_api.py index eb698f08..497759fa 100644 --- a/generated/test/test_user_api.py +++ b/generated/test/test_user_api.py @@ -1,9 +1,9 @@ """ Groundlight API - Easy Computer Vision powered by Natural Language # noqa: E501 + 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.6.0 + The version of the OpenAPI document: 0.15.3 Contact: support@groundlight.ai Generated by: https://openapi-generator.tech """ diff --git a/spec/public-api.yaml b/spec/public-api.yaml index 7b2cf563..02d168d2 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -605,6 +605,7 @@ components: * `BOUNDING_BOXES` - Bounding Boxes BBoxGeometry: type: object + description: Mixin for serializers to handle data in the StrictBaseModel format properties: left: type: number @@ -633,6 +634,27 @@ components: - top - x - y + BBoxGeometryRequest: + type: object + description: Mixin for serializers to handle data in the StrictBaseModel format + properties: + left: + type: number + format: double + top: + type: number + format: double + right: + type: number + format: double + bottom: + type: number + format: double + required: + - bottom + - left + - right + - top ChannelEnum: enum: - EMAIL @@ -877,7 +899,15 @@ components: format: double readOnly: true description: Min confidence needed to accept the response of the image query. + bounding_boxes: + type: array + items: + $ref: '#/components/schemas/ROI' + readOnly: true + nullable: true + description: An array of bounding boxes collected on image required: + - bounding_boxes - confidence_threshold - created_at - detector_id @@ -896,11 +926,6 @@ components: LabelValue: type: object properties: - value: - type: number - format: double - readOnly: true - nullable: true confidence: type: number format: double @@ -911,13 +936,11 @@ components: nullable: true description: A human-readable class name for this label readOnly: true - feedback_text: - type: string - readOnly: true - nullable: true rois: + type: array + items: + $ref: '#/components/schemas/ROI' nullable: true - description: List of region-of-interest (ROI) annotations annotations_requested: type: array items: @@ -929,12 +952,6 @@ components: * `BINARY_CLASSIFICATION` - Binary Classification * `BOUNDING_BOXES` - Bounding Boxes readOnly: true - review_reason: - readOnly: true - nullable: true - oneOf: - - $ref: '#/components/schemas/ReviewReasonEnum' - - $ref: '#/components/schemas/NullEnum' created_at: type: string format: date-time @@ -953,10 +970,7 @@ components: - confidence - created_at - detector_id - - feedback_text - - review_reason - source - - value LabelValueRequest: type: object properties: @@ -969,8 +983,10 @@ components: writeOnly: true minLength: 1 rois: + type: array + items: + $ref: '#/components/schemas/ROIRequest' nullable: true - description: List of region-of-interest (ROI) annotations required: - image_query_id - label @@ -1005,9 +1021,6 @@ components: description: Text content of the note. required: - content - NullEnum: - enum: - - null PaginatedDetectorList: type: object required: @@ -1079,6 +1092,12 @@ components: $ref: '#/components/schemas/Rule' ROI: type: object + description: |- + A serializer for ROI objects. + Corresponds directly with predictors.types.ROI + + The class should handle like a normal serializer, just note that the when instantiating as + ROISerializer(instance=obj), the obj is the json representation pulled straight from the database properties: label: type: string @@ -1094,33 +1113,29 @@ components: - geometry - label - score + ROIRequest: + type: object + description: |- + A serializer for ROI objects. + Corresponds directly with predictors.types.ROI + + The class should handle like a normal serializer, just note that the when instantiating as + ROISerializer(instance=obj), the obj is the json representation pulled straight from the database + properties: + label: + type: string + minLength: 1 + description: The label of the bounding box. + geometry: + $ref: '#/components/schemas/BBoxGeometryRequest' + required: + - geometry + - label ResultTypeEnum: enum: - binary_classification - counting type: string - ReviewReasonEnum: - enum: - - ESCALATION - - AUDIT - - ASSESSMENT - - CUSTOMER_INITIATED - - CONFIDENT_UNCLEAR - - CONFIDENT_UNCLEAR_AUDIT - - DISAGREEMENT - - DISAGREEMENT_ON_ASSESSMENT - - CONFIRM_ACTION_TRIGGER - type: string - description: |- - * `ESCALATION` - ESCALATION - * `AUDIT` - AUDIT - * `ASSESSMENT` - ASSESSMENT - * `CUSTOMER_INITIATED` - CUSTOMER_INITIATED - * `CONFIDENT_UNCLEAR` - CONFIDENT_UNCLEAR - * `CONFIDENT_UNCLEAR_AUDIT` - CONFIDENT_UNCLEAR_AUDIT - * `DISAGREEMENT` - DISAGREEMENT - * `DISAGREEMENT_ON_ASSESSMENT` - DISAGREEMENT_ON_ASSESSMENT - * `CONFIRM_ACTION_TRIGGER` - CONFIRM_ACTION_TRIGGER Rule: type: object properties: From f8548ed801915562751a70ad3179ae0fbc28a0e3 Mon Sep 17 00:00:00 2001 From: Auto-format Bot Date: Mon, 5 Aug 2024 17:53:28 +0000 Subject: [PATCH 11/15] Automatically reformatting code --- src/groundlight/experimental_api.py | 4 ++-- test/unit/test_experimental.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 446b49c3..301103f9 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -14,14 +14,14 @@ from groundlight_openapi_client.api.image_queries_api import ImageQueriesApi from groundlight_openapi_client.api.notes_api import NotesApi from groundlight_openapi_client.model.action_request import ActionRequest +from groundlight_openapi_client.model.b_box_geometry_request import BBoxGeometryRequest from groundlight_openapi_client.model.channel_enum import ChannelEnum from groundlight_openapi_client.model.condition_request import ConditionRequest from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest from groundlight_openapi_client.model.label_value_request import LabelValueRequest from groundlight_openapi_client.model.note_request import NoteRequest -from groundlight_openapi_client.model.rule_request import RuleRequest from groundlight_openapi_client.model.roi_request import ROIRequest -from groundlight_openapi_client.model.b_box_geometry_request import BBoxGeometryRequest +from groundlight_openapi_client.model.rule_request import RuleRequest from groundlight_openapi_client.model.verb_enum import VerbEnum from model import ROI, BBoxGeometry, Detector, DetectorGroup, ImageQuery, PaginatedRuleList, Rule diff --git a/test/unit/test_experimental.py b/test/unit/test_experimental.py index 215a0eb6..c1b6b6f2 100644 --- a/test/unit/test_experimental.py +++ b/test/unit/test_experimental.py @@ -1,6 +1,6 @@ from datetime import datetime -import pytest +import pytest from groundlight import ExperimentalApi, ImageQuery From f44afa95334b9d87e486a9080fb08e994fa99757 Mon Sep 17 00:00:00 2001 From: brandon Date: Mon, 5 Aug 2024 13:16:09 -0700 Subject: [PATCH 12/15] Organizing tests --- Makefile | 2 +- generated/.openapi-generator/FILES | 42 ------------------------------ generated/model.py | 2 +- test/unit/test_actions.py | 14 +++++----- test/unit/test_experimental.py | 8 ++---- test/unit/test_http_retries.py | 4 +-- test/unit/test_images.py | 10 +++---- test/unit/test_notes.py | 10 +++---- 8 files changed, 23 insertions(+), 69 deletions(-) diff --git a/Makefile b/Makefile index 7e8ebc70..5cc4a261 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ PYTEST=poetry run pytest -v # `make test TEST_ARGS="-k some_filter"` TEST_ARGS= -CLOUD_FILTERS = -m "not (run_only_for_edge_endpoint or skip)" +CLOUD_FILTERS = -m "not run_only_for_edge_endpoint" EDGE_FILTERS = -m "not skip_for_edge_endpoint" test: install ## Run tests against the prod API (needs GROUNDLIGHT_API_TOKEN) diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index 8d630f4c..0db4410e 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -102,46 +102,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_action.py -test/test_action_request.py -test/test_actions_api.py -test/test_all_notes.py -test/test_annotations_requested_enum.py -test/test_b_box_geometry.py -test/test_b_box_geometry_request.py -test/test_binary_classification_result.py -test/test_channel_enum.py -test/test_condition.py -test/test_condition_request.py -test/test_counting_result.py -test/test_detector.py -test/test_detector_creation_input_request.py -test/test_detector_group.py -test/test_detector_group_request.py -test/test_detector_groups_api.py -test/test_detector_type_enum.py -test/test_detectors_api.py -test/test_image_queries_api.py -test/test_image_query.py -test/test_image_query_type_enum.py -test/test_inline_response200.py -test/test_label_value.py -test/test_label_value_request.py -test/test_labels_api.py -test/test_mode_enum.py -test/test_note.py -test/test_note_request.py -test/test_notes_api.py -test/test_paginated_detector_list.py -test/test_paginated_image_query_list.py -test/test_paginated_rule_list.py -test/test_result_type_enum.py -test/test_roi.py -test/test_roi_request.py -test/test_rule.py -test/test_rule_request.py -test/test_snooze_time_unit_enum.py -test/test_source_enum.py -test/test_user_api.py -test/test_verb_enum.py tox.ini diff --git a/generated/model.py b/generated/model.py index cc5cc2ba..8c48b8ce 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2024-08-05T17:49:43+00:00 +# timestamp: 2024-08-05T18:57:00+00:00 from __future__ import annotations diff --git a/test/unit/test_actions.py b/test/unit/test_actions.py index 4c0c10ae..255906db 100644 --- a/test/unit/test_actions.py +++ b/test/unit/test_actions.py @@ -5,17 +5,17 @@ from groundlight_openapi_client.exceptions import NotFoundException -def test_create_action(gl: ExperimentalApi): +def test_create_action(gl_experimental: ExperimentalApi): # We first clear out any rules in case the account has any left over from a previous test - gl.delete_all_rules() + gl_experimental.delete_all_rules() name = f"Test {datetime.utcnow()}" - det = gl.get_or_create_detector(name, "test_query") - rule = gl.create_rule(det, "test_rule", "EMAIL", "test@example.com") - rule2 = gl.get_rule(rule.id) + det = gl_experimental.get_or_create_detector(name, "test_query") + rule = gl_experimental.create_rule(det, "test_rule", "EMAIL", "test@example.com") + rule2 = gl_experimental.get_rule(rule.id) assert rule == rule2 - gl.delete_rule(rule.id) + gl_experimental.delete_rule(rule.id) with pytest.raises(NotFoundException) as _: - gl.get_rule(rule.id) + gl_experimental.get_rule(rule.id) @pytest.mark.skip(reason="actions are global on account, the test matrix collides with itself") # type: ignore diff --git a/test/unit/test_experimental.py b/test/unit/test_experimental.py index c1b6b6f2..f4458105 100644 --- a/test/unit/test_experimental.py +++ b/test/unit/test_experimental.py @@ -14,14 +14,12 @@ def test_detector_groups(gl_experimental: ExperimentalApi): assert created_group in all_groups -pytest.mark.skip( +@pytest.mark.skip( reason=( "Users currently don't have permission to turn object detection on their own. If you have questions, reach out" " to Groundlight support." ) ) - - def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuery): """ verify that we can submit an ROI @@ -31,14 +29,12 @@ def test_submit_roi(gl_experimental: ExperimentalApi, image_query_yes: ImageQuer gl_experimental.add_label(image_query_yes.id, "YES", [roi]) -pytest.mark.skip( +@pytest.mark.skip( reason=( "Users currently don't have permission to turn object detection on their own. If you have questions, reach out" " to Groundlight support." ) ) - - def test_submit_multiple_rois(gl_experimental: ExperimentalApi, image_query_no: ImageQuery): """ verify that we can submit multiple ROIs diff --git a/test/unit/test_http_retries.py b/test/unit/test_http_retries.py index ffc8d77c..42ab0caf 100644 --- a/test/unit/test_http_retries.py +++ b/test/unit/test_http_retries.py @@ -108,7 +108,7 @@ def test_list_image_queries_attempts_retries(gl: Groundlight): def test_add_label_attempts_retries(gl: Groundlight, detector: Detector): image_query = gl.submit_image_query(detector=detector.id, image=IMAGE_FILE) run_test( - mocked_call="requests.request", + mocked_call="urllib3.PoolManager.request", api_method=gl.add_label, expected_call_counts=TOTAL_RETRIES + 1, image_query=image_query, @@ -116,7 +116,7 @@ def test_add_label_attempts_retries(gl: Groundlight, detector: Detector): ) run_test( - mocked_call="requests.request", + mocked_call="urllib3.PoolManager.request", api_method=gl.add_label, expected_call_counts=TOTAL_RETRIES + 1, image_query=image_query, diff --git a/test/unit/test_images.py b/test/unit/test_images.py index e35a3cc5..12220ade 100644 --- a/test/unit/test_images.py +++ b/test/unit/test_images.py @@ -4,9 +4,9 @@ from groundlight import ExperimentalApi -def test_get_image(gl: ExperimentalApi): +def test_get_image(gl_experimental: ExperimentalApi): name = f"Test {datetime.utcnow()}" - det = gl.get_or_create_detector(name, "test_query") - iq = gl.submit_image_query(det, image="test/assets/dog.jpeg", wait=10) - gl.get_image(iq.id) - assert isinstance(PIL.Image.open(gl.get_image(iq.id)), PIL.Image.Image) + det = gl_experimental.get_or_create_detector(name, "test_query") + iq = gl_experimental.submit_image_query(det, image="test/assets/dog.jpeg", wait=10) + gl_experimental.get_image(iq.id) + assert isinstance(PIL.Image.open(gl_experimental.get_image(iq.id)), PIL.Image.Image) diff --git a/test/unit/test_notes.py b/test/unit/test_notes.py index e0e5dc48..b8189169 100644 --- a/test/unit/test_notes.py +++ b/test/unit/test_notes.py @@ -3,12 +3,12 @@ from groundlight import ExperimentalApi -def test_notes(gl: ExperimentalApi): +def test_notes(gl_experimental: ExperimentalApi): name = f"Test {datetime.utcnow()}" - det = gl.create_detector(name, "test_query") - gl.create_note(det, "test_note") - # test runner could be either a customer or GL - notes = (gl.get_notes(det).get("customer") or []) + (gl.get_notes(det).get("gl") or []) + det = gl_experimental.create_detector(name, "test_query") + gl_experimental.create_note(det, "test_note") + # test runner could be either a customer or gl_experimental + notes = (gl_experimental.get_notes(det).get("customer") or []) + (gl_experimental.get_notes(det).get("gl") or []) found_note = False for i in range(len(notes)): if notes[i].content == "test_note": From c272e4532973e09a5f1c88f12f9fe98cc2000064 Mon Sep 17 00:00:00 2001 From: brandon Date: Mon, 12 Aug 2024 17:00:30 -0700 Subject: [PATCH 13/15] Updating spec --- generated/docs/ImageQuery.md | 2 +- generated/docs/LabelValue.md | 2 +- generated/docs/ROI.md | 2 +- generated/docs/ROIRequest.md | 2 +- .../model/image_query.py | 12 +++++----- .../model/label_value.py | 2 +- generated/model.py | 20 ++++++---------- spec/public-api.yaml | 23 ++++++------------- src/groundlight/internalapi.py | 2 +- 9 files changed, 26 insertions(+), 41 deletions(-) diff --git a/generated/docs/ImageQuery.md b/generated/docs/ImageQuery.md index 9589ee7d..e75a620b 100644 --- a/generated/docs/ImageQuery.md +++ b/generated/docs/ImageQuery.md @@ -15,7 +15,7 @@ Name | Type | Description | Notes **result** | **bool, date, datetime, dict, float, int, list, str, none_type** | The result of the image query. | [readonly] **patience_time** | **float** | How long to wait for a confident response. | [readonly] **confidence_threshold** | **float** | Min confidence needed to accept the response of the image query. | [readonly] -**bounding_boxes** | [**[ROI], none_type**](ROI.md) | An array of bounding boxes collected on image | [readonly] +**rois** | [**[ROI], none_type**](ROI.md) | An array of regions of interest (bounding boxes) collected on image | [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/LabelValue.md b/generated/docs/LabelValue.md index 9d4bf329..a96d9ab6 100644 --- a/generated/docs/LabelValue.md +++ b/generated/docs/LabelValue.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **confidence** | **float, none_type** | | [readonly] -**class_name** | **str, none_type** | A human-readable class name for this label | [readonly] +**class_name** | **str, none_type** | A human-readable class name for this label (e.g. YES/NO) | [readonly] **annotations_requested** | **[bool, date, datetime, dict, float, int, list, str, none_type]** | | [readonly] **created_at** | **datetime** | | [readonly] **detector_id** | **int, none_type** | | [readonly] diff --git a/generated/docs/ROI.md b/generated/docs/ROI.md index 1c17de14..60da87e6 100644 --- a/generated/docs/ROI.md +++ b/generated/docs/ROI.md @@ -1,6 +1,6 @@ # ROI -A serializer for ROI objects. Corresponds directly with predictors.types.ROI The class should handle like a normal serializer, just note that the when instantiating as ROISerializer(instance=obj), the obj is the json representation pulled straight from the database +Mixin for serializers to handle data in the StrictBaseModel format ## Properties Name | Type | Description | Notes diff --git a/generated/docs/ROIRequest.md b/generated/docs/ROIRequest.md index 11c5d232..8d675ec3 100644 --- a/generated/docs/ROIRequest.md +++ b/generated/docs/ROIRequest.md @@ -1,6 +1,6 @@ # ROIRequest -A serializer for ROI objects. Corresponds directly with predictors.types.ROI The class should handle like a normal serializer, just note that the when instantiating as ROISerializer(instance=obj), the obj is the json representation pulled straight from the database +Mixin for serializers to handle data in the StrictBaseModel format ## Properties Name | Type | Description | Notes diff --git a/generated/groundlight_openapi_client/model/image_query.py b/generated/groundlight_openapi_client/model/image_query.py index e5b18667..aa6a5a1b 100644 --- a/generated/groundlight_openapi_client/model/image_query.py +++ b/generated/groundlight_openapi_client/model/image_query.py @@ -147,7 +147,7 @@ def openapi_types(): ), # noqa: E501 "patience_time": (float,), # noqa: E501 "confidence_threshold": (float,), # noqa: E501 - "bounding_boxes": ( + "rois": ( [ROI], none_type, ), # noqa: E501 @@ -168,7 +168,7 @@ def discriminator(): "result": "result", # noqa: E501 "patience_time": "patience_time", # noqa: E501 "confidence_threshold": "confidence_threshold", # noqa: E501 - "bounding_boxes": "bounding_boxes", # noqa: E501 + "rois": "rois", # noqa: E501 } read_only_vars = { @@ -182,7 +182,7 @@ def discriminator(): "result", # noqa: E501 "patience_time", # noqa: E501 "confidence_threshold", # noqa: E501 - "bounding_boxes", # noqa: E501 + "rois", # noqa: E501 } _composed_schemas = {} @@ -201,7 +201,7 @@ def _from_openapi_data( result, patience_time, confidence_threshold, - bounding_boxes, + rois, *args, **kwargs, ): # noqa: E501 @@ -218,7 +218,7 @@ def _from_openapi_data( result (bool, date, datetime, dict, float, int, list, str, none_type): The result of the image query. patience_time (float): How long to wait for a confident response. confidence_threshold (float): Min confidence needed to accept the response of the image query. - bounding_boxes ([ROI], none_type): An array of bounding boxes collected on image + rois ([ROI], none_type): An array of regions of interest (bounding boxes) collected on image Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -289,7 +289,7 @@ def _from_openapi_data( self.result = result self.patience_time = patience_time self.confidence_threshold = confidence_threshold - self.bounding_boxes = bounding_boxes + self.rois = rois for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map diff --git a/generated/groundlight_openapi_client/model/label_value.py b/generated/groundlight_openapi_client/model/label_value.py index 7cb397e6..b6ac9148 100644 --- a/generated/groundlight_openapi_client/model/label_value.py +++ b/generated/groundlight_openapi_client/model/label_value.py @@ -165,7 +165,7 @@ def _from_openapi_data( Args: confidence (float, none_type): - class_name (str, none_type): A human-readable class name for this label + class_name (str, none_type): A human-readable class name for this label (e.g. YES/NO) annotations_requested ([bool, date, datetime, dict, float, int, list, str, none_type]): created_at (datetime): detector_id (int, none_type): diff --git a/generated/model.py b/generated/model.py index 8c48b8ce..d439bf93 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2024-08-05T18:57:00+00:00 +# timestamp: 2024-08-13T00:01:16+00:00 from __future__ import annotations @@ -95,11 +95,7 @@ class NoteRequest(BaseModel): class ROI(BaseModel): """ - A serializer for ROI objects. - Corresponds directly with predictors.types.ROI - - The class should handle like a normal serializer, just note that the when instantiating as - ROISerializer(instance=obj), the obj is the json representation pulled straight from the database + Mixin for serializers to handle data in the StrictBaseModel format """ label: str = Field(..., description="The label of the bounding box.") @@ -109,11 +105,7 @@ class ROI(BaseModel): class ROIRequest(BaseModel): """ - A serializer for ROI objects. - Corresponds directly with predictors.types.ROI - - The class should handle like a normal serializer, just note that the when instantiating as - ROISerializer(instance=obj), the obj is the json representation pulled straight from the database + Mixin for serializers to handle data in the StrictBaseModel format """ label: constr(min_length=1) = Field(..., description="The label of the bounding box.") @@ -300,12 +292,14 @@ class ImageQuery(BaseModel): confidence_threshold: float = Field( ..., description="Min confidence needed to accept the response of the image query." ) - bounding_boxes: Optional[List[ROI]] = Field(..., description="An array of bounding boxes collected on image") + rois: Optional[List[ROI]] = Field( + ..., description="An array of regions of interest (bounding boxes) collected on image" + ) class LabelValue(BaseModel): confidence: Optional[float] = Field(...) - class_name: Optional[str] = Field(..., description="A human-readable class name for this label") + class_name: Optional[str] = Field(..., description="A human-readable class name for this label (e.g. YES/NO)") rois: Optional[List[ROI]] = None annotations_requested: List[AnnotationsRequestedEnum] created_at: datetime diff --git a/spec/public-api.yaml b/spec/public-api.yaml index 02d168d2..c6b3d8bb 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -899,15 +899,15 @@ components: format: double readOnly: true description: Min confidence needed to accept the response of the image query. - bounding_boxes: + rois: type: array items: $ref: '#/components/schemas/ROI' readOnly: true nullable: true - description: An array of bounding boxes collected on image + description: An array of regions of interest (bounding boxes) collected + on image required: - - bounding_boxes - confidence_threshold - created_at - detector_id @@ -917,6 +917,7 @@ components: - query - result - result_type + - rois - type x-internal: true ImageQueryTypeEnum: @@ -934,7 +935,7 @@ components: class_name: type: string nullable: true - description: A human-readable class name for this label + description: A human-readable class name for this label (e.g. YES/NO) readOnly: true rois: type: array @@ -1092,12 +1093,7 @@ components: $ref: '#/components/schemas/Rule' ROI: type: object - description: |- - A serializer for ROI objects. - Corresponds directly with predictors.types.ROI - - The class should handle like a normal serializer, just note that the when instantiating as - ROISerializer(instance=obj), the obj is the json representation pulled straight from the database + description: Mixin for serializers to handle data in the StrictBaseModel format properties: label: type: string @@ -1115,12 +1111,7 @@ components: - score ROIRequest: type: object - description: |- - A serializer for ROI objects. - Corresponds directly with predictors.types.ROI - - The class should handle like a normal serializer, just note that the when instantiating as - ROISerializer(instance=obj), the obj is the json representation pulled straight from the database + description: Mixin for serializers to handle data in the StrictBaseModel format properties: label: type: string diff --git a/src/groundlight/internalapi.py b/src/groundlight/internalapi.py index 4da2a18c..f4984810 100644 --- a/src/groundlight/internalapi.py +++ b/src/groundlight/internalapi.py @@ -203,7 +203,7 @@ def _headers(self) -> dict: @RequestsRetryDecorator() def _add_label(self, image_query_id: str, label: str) -> dict: """Temporary internal call to add a label to an image query. Not supported.""" - logger.warning("This method is slated for removal") + logger.warning("This method is slated for removal, instead use the labels_api in the groundlight client") # TODO: Properly model this with OpenApi spec. start_time = time.time() url = f"{self.configuration.host}/labels" From f73e3d07c865126f5ff0440f4db20f70d9eecb80 Mon Sep 17 00:00:00 2001 From: brandon Date: Mon, 12 Aug 2024 17:22:28 -0700 Subject: [PATCH 14/15] cleanup --- src/groundlight/client.py | 4 ++-- src/groundlight/experimental_api.py | 6 +++--- test/unit/conftest.py | 3 ++- test/unit/test_actions.py | 32 ++++++++++++++--------------- test/unit/test_experimental.py | 3 ++- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 49d205eb..6b44fde0 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -4,7 +4,7 @@ import warnings from functools import partial from io import BufferedReader, BytesIO -from typing import Callable, Optional, Union +from typing import Callable, Optional, Union, List from groundlight_openapi_client import Configuration from groundlight_openapi_client.api.detectors_api import DetectorsApi @@ -728,7 +728,7 @@ def _wait_for_result( return image_query def add_label( - self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Union[list[ROI], str, None] = None + self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Union[List[ROI], str, None] = None ): """ Add a new label to an image query. This answers the detector's question. diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 04c2c873..db97beda 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -210,7 +210,7 @@ def list_detector_groups(self) -> List[DetectorGroup]: """ return [DetectorGroup(**det.to_dict()) for det in self.detector_group_api.get_detector_groups()] - def create_roi(self, label: str, top_left: Tuple[int, int], bottom_right: Tuple[int, int]) -> ROI: + def create_roi(self, label: str, top_left: Tuple[float, float], bottom_right: Tuple[float, float]) -> ROI: """ Adds a region of interest to the given detector NOTE: This feature is only available to Pro tier and higher @@ -235,7 +235,7 @@ def create_roi(self, label: str, top_left: Tuple[int, int], bottom_right: Tuple[ ) def add_label( - self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Union[list[ROI], str, None] = None + self, image_query: Union[ImageQuery, str], label: Union[Label, str], rois: Union[List[ROI], str, None] = None ): """ Experimental version of add_label. @@ -266,7 +266,7 @@ def add_label( ROIRequest(label=roi.label, score=roi.score, geometry=geometry) for roi, geometry in zip(rois, geometry_requests) ] - if rois + if rois and geometry_requests else None ) request_params = LabelValueRequest(label=api_label, image_query_id=image_query_id, rois=roi_requests) diff --git a/test/unit/conftest.py b/test/unit/conftest.py index 9a4ff64d..49550bde 100644 --- a/test/unit/conftest.py +++ b/test/unit/conftest.py @@ -1,7 +1,8 @@ from datetime import datetime import pytest -from groundlight import Detector, ExperimentalApi, Groundlight, ImageQuery +from groundlight import ExperimentalApi, Groundlight +from model import Detector, ImageQuery @pytest.fixture(name="gl") diff --git a/test/unit/test_actions.py b/test/unit/test_actions.py index 81f47f7a..91016e7a 100644 --- a/test/unit/test_actions.py +++ b/test/unit/test_actions.py @@ -19,30 +19,30 @@ def test_create_action(gl_experimental: ExperimentalApi): @pytest.mark.skip(reason="actions are global on account, the test matrix collides with itself") # type: ignore -def test_get_all_actions(gl: ExperimentalApi): +def test_get_all_actions(gl_experimental: ExperimentalApi): name = f"Test {datetime.utcnow()}" num_test_rules = 13 # needs to be larger than the default page size - gl.ITEMS_PER_PAGE = 10 - assert gl.ITEMS_PER_PAGE < num_test_rules - det = gl.get_or_create_detector(name, "test_query") - gl.delete_all_rules() + gl_experimental.ITEMS_PER_PAGE = 10 + assert gl_experimental.ITEMS_PER_PAGE < num_test_rules + det = gl_experimental.get_or_create_detector(name, "test_query") + gl_experimental.delete_all_rules() for i in range(num_test_rules): - _ = gl.create_rule(det, f"test_rule_{i}", "EMAIL", "test@example.com") - rules = gl.list_rules(page_size=gl.ITEMS_PER_PAGE) + _ = gl_experimental.create_rule(det, f"test_rule_{i}", "EMAIL", "test@example.com") + rules = gl_experimental.list_rules(page_size=gl_experimental.ITEMS_PER_PAGE) assert rules.count == num_test_rules - assert len(rules.results) == gl.ITEMS_PER_PAGE - num_deleted = gl.delete_all_rules() + assert len(rules.results) == gl_experimental.ITEMS_PER_PAGE + num_deleted = gl_experimental.delete_all_rules() assert num_deleted == num_test_rules - rules = gl.list_rules() + rules = gl_experimental.list_rules() assert rules.count == 0 -def test_create_action_with_human_review(gl: ExperimentalApi): +def test_create_action_with_human_review(gl_experimental: ExperimentalApi): name = f"Test {datetime.utcnow()}" - det = gl.get_or_create_detector(name, "test_query") - rule = gl.create_rule(det, f"test_rule_{name}", "EMAIL", "test@example.com", human_review_required=True) - rule2 = gl.get_rule(rule.id) + det = gl_experimental.get_or_create_detector(name, "test_query") + rule = gl_experimental.create_rule(det, f"test_rule_{name}", "EMAIL", "test@example.com", human_review_required=True) + rule2 = gl_experimental.get_rule(rule.id) assert rule == rule2 - gl.delete_rule(rule.id) + gl_experimental.delete_rule(rule.id) with pytest.raises(NotFoundException) as _: - gl.get_rule(rule.id) + gl_experimental.get_rule(rule.id) diff --git a/test/unit/test_experimental.py b/test/unit/test_experimental.py index f4458105..5a94a8a9 100644 --- a/test/unit/test_experimental.py +++ b/test/unit/test_experimental.py @@ -1,7 +1,8 @@ from datetime import datetime import pytest -from groundlight import ExperimentalApi, ImageQuery +from groundlight import ExperimentalApi +from model import ImageQuery def test_detector_groups(gl_experimental: ExperimentalApi): From 95861141566b3e6ec84ec2edec5367498307f32b Mon Sep 17 00:00:00 2001 From: Auto-format Bot Date: Tue, 13 Aug 2024 00:23:24 +0000 Subject: [PATCH 15/15] Automatically reformatting code --- src/groundlight/client.py | 2 +- test/unit/test_actions.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 6b44fde0..6cb787b2 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -4,7 +4,7 @@ import warnings from functools import partial from io import BufferedReader, BytesIO -from typing import Callable, Optional, Union, List +from typing import Callable, List, Optional, Union from groundlight_openapi_client import Configuration from groundlight_openapi_client.api.detectors_api import DetectorsApi diff --git a/test/unit/test_actions.py b/test/unit/test_actions.py index 91016e7a..08a79606 100644 --- a/test/unit/test_actions.py +++ b/test/unit/test_actions.py @@ -40,7 +40,9 @@ def test_get_all_actions(gl_experimental: ExperimentalApi): def test_create_action_with_human_review(gl_experimental: ExperimentalApi): name = f"Test {datetime.utcnow()}" det = gl_experimental.get_or_create_detector(name, "test_query") - rule = gl_experimental.create_rule(det, f"test_rule_{name}", "EMAIL", "test@example.com", human_review_required=True) + rule = gl_experimental.create_rule( + det, f"test_rule_{name}", "EMAIL", "test@example.com", human_review_required=True + ) rule2 = gl_experimental.get_rule(rule.id) assert rule == rule2 gl_experimental.delete_rule(rule.id)