From 045d907c06018f87e01f375a672159915d0f52d4 Mon Sep 17 00:00:00 2001 From: brandon Date: Fri, 21 Feb 2025 16:45:01 -0800 Subject: [PATCH 1/9] generating files, client update, starting tests --- generated/.openapi-generator/FILES | 19 +- generated/README.md | 10 + generated/docs/Detector.md | 2 +- generated/docs/DetectorsApi.md | 156 +++++++++ generated/docs/EdgeApi.md | 86 +++++ generated/docs/EdgeModelInfo.md | 19 ++ generated/docs/ImageQuery.md | 2 +- generated/docs/InlineResponse200.md | 2 +- generated/docs/InlineResponse2001.md | 12 + .../InlineResponse2001EvaluationResults.md | 19 ++ generated/docs/InlineResponse2002.md | 12 + generated/docs/InlineResponse200Summary.md | 16 + .../InlineResponse200SummaryClassCounts.md | 16 + generated/docs/PatchedDetectorRequest.md | 2 +- generated/docs/TextModeConfiguration.md | 12 + generated/docs/UserApi.md | 6 +- generated/docs/WebhookAction.md | 2 +- .../api/detectors_api.py | 198 +++++++++++ .../api/edge_api.py | 135 ++++++++ .../api/user_api.py | 6 +- .../apis/__init__.py | 1 + .../model/detector_creation_input_request.py | 2 + .../model/edge_model_info.py | 322 ++++++++++++++++++ .../model/inline_response200.py | 16 +- .../model/inline_response2001.py | 278 +++++++++++++++ .../inline_response2001_evaluation_results.py | 305 +++++++++++++++++ .../model/inline_response2002.py | 268 +++++++++++++++ .../model/inline_response200_summary.py | 296 ++++++++++++++++ ...inline_response200_summary_class_counts.py | 284 +++++++++++++++ .../model/label_value_request.py | 3 - .../model/text_mode_configuration.py | 273 +++++++++++++++ .../model/webhook_action.py | 9 +- .../models/__init__.py | 7 + generated/model.py | 34 +- generated/test/test_edge_api.py | 32 ++ generated/test/test_edge_model_info.py | 35 ++ generated/test/test_inline_response2001.py | 38 +++ ..._inline_response2001_evaluation_results.py | 35 ++ generated/test/test_inline_response2002.py | 35 ++ .../test/test_inline_response200_summary.py | 38 +++ ...inline_response200_summary_class_counts.py | 35 ++ .../test/test_text_mode_configuration.py | 35 ++ spec/public-api.yaml | 166 ++++++++- src/groundlight/experimental_api.py | 27 ++ test/unit/test_metrics_and_evaluation.py | 16 + 45 files changed, 3287 insertions(+), 35 deletions(-) create mode 100644 generated/docs/EdgeApi.md create mode 100644 generated/docs/EdgeModelInfo.md create mode 100644 generated/docs/InlineResponse2001.md create mode 100644 generated/docs/InlineResponse2001EvaluationResults.md create mode 100644 generated/docs/InlineResponse2002.md create mode 100644 generated/docs/InlineResponse200Summary.md create mode 100644 generated/docs/InlineResponse200SummaryClassCounts.md create mode 100644 generated/docs/TextModeConfiguration.md create mode 100644 generated/groundlight_openapi_client/api/edge_api.py create mode 100644 generated/groundlight_openapi_client/model/edge_model_info.py create mode 100644 generated/groundlight_openapi_client/model/inline_response2001.py create mode 100644 generated/groundlight_openapi_client/model/inline_response2001_evaluation_results.py create mode 100644 generated/groundlight_openapi_client/model/inline_response2002.py create mode 100644 generated/groundlight_openapi_client/model/inline_response200_summary.py create mode 100644 generated/groundlight_openapi_client/model/inline_response200_summary_class_counts.py create mode 100644 generated/groundlight_openapi_client/model/text_mode_configuration.py create mode 100644 generated/test/test_edge_api.py create mode 100644 generated/test/test_edge_model_info.py create mode 100644 generated/test/test_inline_response2001.py create mode 100644 generated/test/test_inline_response2001_evaluation_results.py create mode 100644 generated/test/test_inline_response2002.py create mode 100644 generated/test/test_inline_response200_summary.py create mode 100644 generated/test/test_inline_response200_summary_class_counts.py create mode 100644 generated/test/test_text_mode_configuration.py create mode 100644 test/unit/test_metrics_and_evaluation.py diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index e97074f3..621d92cc 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -22,11 +22,18 @@ docs/DetectorGroupsApi.md docs/DetectorResetApi.md docs/DetectorTypeEnum.md docs/DetectorsApi.md +docs/EdgeApi.md +docs/EdgeModelInfo.md docs/EscalationTypeEnum.md docs/ImageQueriesApi.md docs/ImageQuery.md docs/ImageQueryTypeEnum.md docs/InlineResponse200.md +docs/InlineResponse2001.md +docs/InlineResponse2001EvaluationResults.md +docs/InlineResponse2002.md +docs/InlineResponse200Summary.md +docs/InlineResponse200SummaryClassCounts.md docs/LabelValue.md docs/LabelValueRequest.md docs/LabelsApi.md @@ -48,6 +55,7 @@ docs/RuleRequest.md docs/SnoozeTimeUnitEnum.md docs/SourceEnum.md docs/StatusEnum.md +docs/TextModeConfiguration.md docs/TextRecognitionResult.md docs/UserApi.md docs/VerbEnum.md @@ -60,6 +68,7 @@ groundlight_openapi_client/api/actions_api.py groundlight_openapi_client/api/detector_groups_api.py groundlight_openapi_client/api/detector_reset_api.py groundlight_openapi_client/api/detectors_api.py +groundlight_openapi_client/api/edge_api.py groundlight_openapi_client/api/image_queries_api.py groundlight_openapi_client/api/labels_api.py groundlight_openapi_client/api/notes_api.py @@ -87,10 +96,16 @@ 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/edge_model_info.py groundlight_openapi_client/model/escalation_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/inline_response2001.py +groundlight_openapi_client/model/inline_response2001_evaluation_results.py +groundlight_openapi_client/model/inline_response2002.py +groundlight_openapi_client/model/inline_response200_summary.py +groundlight_openapi_client/model/inline_response200_summary_class_counts.py groundlight_openapi_client/model/label_value.py groundlight_openapi_client/model/label_value_request.py groundlight_openapi_client/model/mode_enum.py @@ -110,6 +125,7 @@ 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/status_enum.py +groundlight_openapi_client/model/text_mode_configuration.py groundlight_openapi_client/model/text_recognition_result.py groundlight_openapi_client/model/verb_enum.py groundlight_openapi_client/model/webhook_action.py @@ -122,7 +138,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_text_recognition_result.py -test/test_webhook_action.py -test/test_webhook_action_request.py tox.ini diff --git a/generated/README.md b/generated/README.md index 881ceeaa..ffd5d1cc 100644 --- a/generated/README.md +++ b/generated/README.md @@ -122,8 +122,11 @@ Class | Method | HTTP request | Description *DetectorsApi* | [**create_detector**](docs/DetectorsApi.md#create_detector) | **POST** /v1/detectors | *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_evaluation**](docs/DetectorsApi.md#get_detector_evaluation) | **GET** /v1/detectors/{id}/evaluation | +*DetectorsApi* | [**get_detector_metrics**](docs/DetectorsApi.md#get_detector_metrics) | **GET** /v1/detectors/{detector_id}/metrics | *DetectorsApi* | [**list_detectors**](docs/DetectorsApi.md#list_detectors) | **GET** /v1/detectors | *DetectorsApi* | [**update_detector**](docs/DetectorsApi.md#update_detector) | **PATCH** /v1/detectors/{id} | +*EdgeApi* | [**get_model_urls**](docs/EdgeApi.md#get_model_urls) | **GET** /v1/edge/fetch-model-urls/{detector_id}/ | *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 | @@ -154,10 +157,16 @@ Class | Method | HTTP request | Description - [DetectorGroup](docs/DetectorGroup.md) - [DetectorGroupRequest](docs/DetectorGroupRequest.md) - [DetectorTypeEnum](docs/DetectorTypeEnum.md) + - [EdgeModelInfo](docs/EdgeModelInfo.md) - [EscalationTypeEnum](docs/EscalationTypeEnum.md) - [ImageQuery](docs/ImageQuery.md) - [ImageQueryTypeEnum](docs/ImageQueryTypeEnum.md) - [InlineResponse200](docs/InlineResponse200.md) + - [InlineResponse2001](docs/InlineResponse2001.md) + - [InlineResponse2001EvaluationResults](docs/InlineResponse2001EvaluationResults.md) + - [InlineResponse2002](docs/InlineResponse2002.md) + - [InlineResponse200Summary](docs/InlineResponse200Summary.md) + - [InlineResponse200SummaryClassCounts](docs/InlineResponse200SummaryClassCounts.md) - [LabelValue](docs/LabelValue.md) - [LabelValueRequest](docs/LabelValueRequest.md) - [ModeEnum](docs/ModeEnum.md) @@ -177,6 +186,7 @@ Class | Method | HTTP request | Description - [SnoozeTimeUnitEnum](docs/SnoozeTimeUnitEnum.md) - [SourceEnum](docs/SourceEnum.md) - [StatusEnum](docs/StatusEnum.md) + - [TextModeConfiguration](docs/TextModeConfiguration.md) - [TextRecognitionResult](docs/TextRecognitionResult.md) - [VerbEnum](docs/VerbEnum.md) - [WebhookAction](docs/WebhookAction.md) diff --git a/generated/docs/Detector.md b/generated/docs/Detector.md index 97d08359..133bfeba 100644 --- a/generated/docs/Detector.md +++ b/generated/docs/Detector.md @@ -1,6 +1,6 @@ # Detector -Spec for serializing a detector object in the public API. +Groundlight Detectors provide answers to natural language questions about images. Each detector can answer a single question, and multiple detectors can be strung together for more complex logic. Detectors can be created through the create_detector method, or through the create_[MODE]_detector methods for pro tier users ## Properties Name | Type | Description | Notes diff --git a/generated/docs/DetectorsApi.md b/generated/docs/DetectorsApi.md index b0eeb292..1394577e 100644 --- a/generated/docs/DetectorsApi.md +++ b/generated/docs/DetectorsApi.md @@ -7,6 +7,8 @@ Method | HTTP request | Description [**create_detector**](DetectorsApi.md#create_detector) | **POST** /v1/detectors | [**delete_detector**](DetectorsApi.md#delete_detector) | **DELETE** /v1/detectors/{id} | [**get_detector**](DetectorsApi.md#get_detector) | **GET** /v1/detectors/{id} | +[**get_detector_evaluation**](DetectorsApi.md#get_detector_evaluation) | **GET** /v1/detectors/{id}/evaluation | +[**get_detector_metrics**](DetectorsApi.md#get_detector_metrics) | **GET** /v1/detectors/{detector_id}/metrics | [**list_detectors**](DetectorsApi.md#list_detectors) | **GET** /v1/detectors | [**update_detector**](DetectorsApi.md#update_detector) | **PATCH** /v1/detectors/{id} | @@ -243,6 +245,160 @@ 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_evaluation** +> InlineResponse2001 get_detector_evaluation(id) + + + +Get Detector evaluation results Is null if there isn't enough ground truth data to evaluate the detector.returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds + +### 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.inline_response2001 import InlineResponse2001 +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) + id = "id_example" # str | + + # example passing only required values which don't have defaults set + try: + api_response = api_instance.get_detector_evaluation(id) + pprint(api_response) + except groundlight_openapi_client.ApiException as e: + print("Exception when calling DetectorsApi->get_detector_evaluation: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **str**| | + +### Return type + +[**InlineResponse2001**](InlineResponse2001.md) + +### Authorization + +[ApiToken](../README.md#ApiToken) + +### HTTP request headers + + - **Content-Type**: Not defined + - **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_metrics** +> InlineResponse200 get_detector_metrics(detector_id) + + + +Get Detector metrics, primarily the counts of different types of labels + +### 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.inline_response200 import InlineResponse200 +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_id = "detector_id_example" # str | + + # example passing only required values which don't have defaults set + try: + api_response = api_instance.get_detector_metrics(detector_id) + pprint(api_response) + except groundlight_openapi_client.ApiException as e: + print("Exception when calling DetectorsApi->get_detector_metrics: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **detector_id** | **str**| | + +### Return type + +[**InlineResponse200**](InlineResponse200.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/EdgeApi.md b/generated/docs/EdgeApi.md new file mode 100644 index 00000000..a702b352 --- /dev/null +++ b/generated/docs/EdgeApi.md @@ -0,0 +1,86 @@ +# groundlight_openapi_client.EdgeApi + +All URIs are relative to *https://api.groundlight.ai/device-api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_model_urls**](EdgeApi.md#get_model_urls) | **GET** /v1/edge/fetch-model-urls/{detector_id}/ | + + +# **get_model_urls** +> EdgeModelInfo get_model_urls(detector_id) + + + +Gets time limited pre-authenticated URLs to download a detector's edge model and oodd model. + +### Example + +* Api Key Authentication (ApiToken): + +```python +import time +import groundlight_openapi_client +from groundlight_openapi_client.api import edge_api +from groundlight_openapi_client.model.edge_model_info import EdgeModelInfo +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 = edge_api.EdgeApi(api_client) + detector_id = "detector_id_example" # str | + + # example passing only required values which don't have defaults set + try: + api_response = api_instance.get_model_urls(detector_id) + pprint(api_response) + except groundlight_openapi_client.ApiException as e: + print("Exception when calling EdgeApi->get_model_urls: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **detector_id** | **str**| | + +### Return type + +[**EdgeModelInfo**](EdgeModelInfo.md) + +### Authorization + +[ApiToken](../README.md#ApiToken) + +### HTTP request headers + + - **Content-Type**: Not defined + - **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) + diff --git a/generated/docs/EdgeModelInfo.md b/generated/docs/EdgeModelInfo.md new file mode 100644 index 00000000..3141373f --- /dev/null +++ b/generated/docs/EdgeModelInfo.md @@ -0,0 +1,19 @@ +# EdgeModelInfo + +Information for the model running on edge, including temporary presigned urls to the model binaries + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**model_binary_id** | **str** | | [optional] +**model_binary_url** | **str** | | [optional] +**oodd_model_binary_id** | **str** | | [optional] +**oodd_model_binary_url** | **str** | | [optional] +**pipeline_config** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] +**oodd_pipeline_config** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] +**predictor_metadata** | **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/ImageQuery.md b/generated/docs/ImageQuery.md index 83920b20..f7999986 100644 --- a/generated/docs/ImageQuery.md +++ b/generated/docs/ImageQuery.md @@ -1,6 +1,6 @@ # ImageQuery -Spec for serializing a image-query object in the public API. +ImageQuery objects are the answers to natural language questions about images created by detectors. ## Properties Name | Type | Description | Notes diff --git a/generated/docs/InlineResponse200.md b/generated/docs/InlineResponse200.md index 020894d5..23dc2df0 100644 --- a/generated/docs/InlineResponse200.md +++ b/generated/docs/InlineResponse200.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**username** | **str** | The user's username | [optional] +**summary** | [**InlineResponse200Summary**](InlineResponse200Summary.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/InlineResponse2001.md b/generated/docs/InlineResponse2001.md new file mode 100644 index 00000000..aa7bbe38 --- /dev/null +++ b/generated/docs/InlineResponse2001.md @@ -0,0 +1,12 @@ +# InlineResponse2001 + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**evaluation_results** | [**InlineResponse2001EvaluationResults**](InlineResponse2001EvaluationResults.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/InlineResponse2001EvaluationResults.md b/generated/docs/InlineResponse2001EvaluationResults.md new file mode 100644 index 00000000..01f845e5 --- /dev/null +++ b/generated/docs/InlineResponse2001EvaluationResults.md @@ -0,0 +1,19 @@ +# InlineResponse2001EvaluationResults + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**eval_timestamp** | **datetime** | | [optional] +**total_ground_truth_examples** | **int, none_type** | | [optional] +**kfold_pooled__balanced_accuracy** | **float** | | [optional] +**kfold_pooled__positive_accuracy** | **float** | | [optional] +**kfold_pooled__negative_accuracy** | **float** | | [optional] +**balanced_system_accuracies** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional] +**positive_system_accuracies** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional] +**negative_system_accuracies** | **{str: (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/InlineResponse2002.md b/generated/docs/InlineResponse2002.md new file mode 100644 index 00000000..59b1a320 --- /dev/null +++ b/generated/docs/InlineResponse2002.md @@ -0,0 +1,12 @@ +# InlineResponse2002 + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **str** | The user's username | [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/InlineResponse200Summary.md b/generated/docs/InlineResponse200Summary.md new file mode 100644 index 00000000..aebcac9c --- /dev/null +++ b/generated/docs/InlineResponse200Summary.md @@ -0,0 +1,16 @@ +# InlineResponse200Summary + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**num_ground_truth** | **int** | | [optional] +**num_current_source_human** | **int** | | [optional] +**class_counts** | [**InlineResponse200SummaryClassCounts**](InlineResponse200SummaryClassCounts.md) | | [optional] +**unconfident_counts** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional] +**total_iqs** | **int** | | [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/InlineResponse200SummaryClassCounts.md b/generated/docs/InlineResponse200SummaryClassCounts.md new file mode 100644 index 00000000..463959ad --- /dev/null +++ b/generated/docs/InlineResponse200SummaryClassCounts.md @@ -0,0 +1,16 @@ +# InlineResponse200SummaryClassCounts + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_ml** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional] +**source_human** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional] +**cloud_labeler** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional] +**cloud** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional] +**total** | **{str: (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/PatchedDetectorRequest.md b/generated/docs/PatchedDetectorRequest.md index 24dc3363..819310b8 100644 --- a/generated/docs/PatchedDetectorRequest.md +++ b/generated/docs/PatchedDetectorRequest.md @@ -1,6 +1,6 @@ # PatchedDetectorRequest -Spec for serializing a detector object in the public API. +Groundlight Detectors provide answers to natural language questions about images. Each detector can answer a single question, and multiple detectors can be strung together for more complex logic. Detectors can be created through the create_detector method, or through the create_[MODE]_detector methods for pro tier users ## Properties Name | Type | Description | Notes diff --git a/generated/docs/TextModeConfiguration.md b/generated/docs/TextModeConfiguration.md new file mode 100644 index 00000000..01bcfdf1 --- /dev/null +++ b/generated/docs/TextModeConfiguration.md @@ -0,0 +1,12 @@ +# TextModeConfiguration + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value_max_length** | **int** | | [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/UserApi.md b/generated/docs/UserApi.md index 7e7d864d..b10f06bc 100644 --- a/generated/docs/UserApi.md +++ b/generated/docs/UserApi.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **who_am_i** -> InlineResponse200 who_am_i() +> InlineResponse2002 who_am_i() @@ -22,7 +22,7 @@ Retrieve the current user. import time import groundlight_openapi_client from groundlight_openapi_client.api import user_api -from groundlight_openapi_client.model.inline_response200 import InlineResponse200 +from groundlight_openapi_client.model.inline_response2002 import InlineResponse2002 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. @@ -60,7 +60,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponse200**](InlineResponse200.md) +[**InlineResponse2002**](InlineResponse2002.md) ### Authorization diff --git a/generated/docs/WebhookAction.md b/generated/docs/WebhookAction.md index 639f1f7a..ad224e7c 100644 --- a/generated/docs/WebhookAction.md +++ b/generated/docs/WebhookAction.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **url** | **str** | | -**include_image** | **bool** | | [optional] +**include_image** | **bool, 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/groundlight_openapi_client/api/detectors_api.py b/generated/groundlight_openapi_client/api/detectors_api.py index a46e110f..1a838d3e 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.inline_response200 import InlineResponse200 +from groundlight_openapi_client.model.inline_response2001 import InlineResponse2001 from groundlight_openapi_client.model.paginated_detector_list import PaginatedDetectorList from groundlight_openapi_client.model.patched_detector_request import PatchedDetectorRequest @@ -153,6 +155,86 @@ def __init__(self, api_client=None): }, api_client=api_client, ) + self.get_detector_evaluation_endpoint = _Endpoint( + settings={ + "response_type": (InlineResponse2001,), + "auth": ["ApiToken"], + "endpoint_path": "/v1/detectors/{id}/evaluation", + "operation_id": "get_detector_evaluation", + "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": ["application/json"], + "content_type": [], + }, + api_client=api_client, + ) + self.get_detector_metrics_endpoint = _Endpoint( + settings={ + "response_type": (InlineResponse200,), + "auth": ["ApiToken"], + "endpoint_path": "/v1/detectors/{detector_id}/metrics", + "operation_id": "get_detector_metrics", + "http_method": "GET", + "servers": None, + }, + params_map={ + "all": [ + "detector_id", + ], + "required": [ + "detector_id", + ], + "nullable": [], + "enum": [], + "validation": [], + }, + root_map={ + "validations": {}, + "allowed_values": {}, + "openapi_types": { + "detector_id": (str,), + }, + "attribute_map": { + "detector_id": "detector_id", + }, + "location_map": { + "detector_id": "path", + }, + "collection_format_map": {}, + }, + headers_map={ + "accept": ["application/json"], + "content_type": [], + }, + api_client=api_client, + ) self.list_detectors_endpoint = _Endpoint( settings={ "response_type": (PaginatedDetectorList,), @@ -413,6 +495,122 @@ def get_detector(self, id, **kwargs): kwargs["id"] = id return self.get_detector_endpoint.call_with_http_info(**kwargs) + def get_detector_evaluation(self, id, **kwargs): + """get_detector_evaluation # noqa: E501 + + Get Detector evaluation results Is null if there isn't enough ground truth data to evaluate the detector.returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds # 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_evaluation(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + 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: + InlineResponse2001 + 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_detector_evaluation_endpoint.call_with_http_info(**kwargs) + + def get_detector_metrics(self, detector_id, **kwargs): + """get_detector_metrics # noqa: E501 + + Get Detector metrics, primarily the counts of different types of labels # 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_metrics(detector_id, async_req=True) + >>> result = thread.get() + + Args: + detector_id (str): + + 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: + InlineResponse200 + 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 + return self.get_detector_metrics_endpoint.call_with_http_info(**kwargs) + def list_detectors(self, **kwargs): """list_detectors # noqa: E501 diff --git a/generated/groundlight_openapi_client/api/edge_api.py b/generated/groundlight_openapi_client/api/edge_api.py new file mode 100644 index 00000000..7d6e4c85 --- /dev/null +++ b/generated/groundlight_openapi_client/api/edge_api.py @@ -0,0 +1,135 @@ +""" + 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.18.2 + 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.edge_model_info import EdgeModelInfo + + +class EdgeApi(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_model_urls_endpoint = _Endpoint( + settings={ + "response_type": (EdgeModelInfo,), + "auth": ["ApiToken"], + "endpoint_path": "/v1/edge/fetch-model-urls/{detector_id}/", + "operation_id": "get_model_urls", + "http_method": "GET", + "servers": None, + }, + params_map={ + "all": [ + "detector_id", + ], + "required": [ + "detector_id", + ], + "nullable": [], + "enum": [], + "validation": [], + }, + root_map={ + "validations": {}, + "allowed_values": {}, + "openapi_types": { + "detector_id": (str,), + }, + "attribute_map": { + "detector_id": "detector_id", + }, + "location_map": { + "detector_id": "path", + }, + "collection_format_map": {}, + }, + headers_map={ + "accept": ["application/json"], + "content_type": [], + }, + api_client=api_client, + ) + + def get_model_urls(self, detector_id, **kwargs): + """get_model_urls # noqa: E501 + + Gets time limited pre-authenticated URLs to download a detector's edge model and oodd model. # 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_model_urls(detector_id, async_req=True) + >>> result = thread.get() + + Args: + detector_id (str): + + 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: + EdgeModelInfo + 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 + return self.get_model_urls_endpoint.call_with_http_info(**kwargs) diff --git a/generated/groundlight_openapi_client/api/user_api.py b/generated/groundlight_openapi_client/api/user_api.py index fa851468..a14200f2 100644 --- a/generated/groundlight_openapi_client/api/user_api.py +++ b/generated/groundlight_openapi_client/api/user_api.py @@ -21,7 +21,7 @@ none_type, validate_and_convert_types, ) -from groundlight_openapi_client.model.inline_response200 import InlineResponse200 +from groundlight_openapi_client.model.inline_response2002 import InlineResponse2002 class UserApi(object): @@ -37,7 +37,7 @@ def __init__(self, api_client=None): self.api_client = api_client self.who_am_i_endpoint = _Endpoint( settings={ - "response_type": (InlineResponse200,), + "response_type": (InlineResponse2002,), "auth": ["ApiToken"], "endpoint_path": "/v1/me", "operation_id": "who_am_i", @@ -100,7 +100,7 @@ def who_am_i(self, **kwargs): async_req (bool): execute request asynchronously Returns: - InlineResponse200 + InlineResponse2002 If the method is called asynchronously, returns the request thread. """ diff --git a/generated/groundlight_openapi_client/apis/__init__.py b/generated/groundlight_openapi_client/apis/__init__.py index ef5c1236..28edf7d0 100644 --- a/generated/groundlight_openapi_client/apis/__init__.py +++ b/generated/groundlight_openapi_client/apis/__init__.py @@ -17,6 +17,7 @@ from groundlight_openapi_client.api.detector_groups_api import DetectorGroupsApi from groundlight_openapi_client.api.detector_reset_api import DetectorResetApi from groundlight_openapi_client.api.detectors_api import DetectorsApi +from groundlight_openapi_client.api.edge_api import EdgeApi 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 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 8ac281c7..ee4d485a 100644 --- a/generated/groundlight_openapi_client/model/detector_creation_input_request.py +++ b/generated/groundlight_openapi_client/model/detector_creation_input_request.py @@ -33,10 +33,12 @@ def lazy_import(): from groundlight_openapi_client.model.count_mode_configuration import CountModeConfiguration from groundlight_openapi_client.model.mode_enum import ModeEnum from groundlight_openapi_client.model.multi_class_mode_configuration import MultiClassModeConfiguration + from groundlight_openapi_client.model.text_mode_configuration import TextModeConfiguration globals()["CountModeConfiguration"] = CountModeConfiguration globals()["ModeEnum"] = ModeEnum globals()["MultiClassModeConfiguration"] = MultiClassModeConfiguration + globals()["TextModeConfiguration"] = TextModeConfiguration class DetectorCreationInputRequest(ModelNormal): diff --git a/generated/groundlight_openapi_client/model/edge_model_info.py b/generated/groundlight_openapi_client/model/edge_model_info.py new file mode 100644 index 00000000..66826368 --- /dev/null +++ b/generated/groundlight_openapi_client/model/edge_model_info.py @@ -0,0 +1,322 @@ +""" + 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.18.2 + 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 EdgeModelInfo(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 { + "model_binary_id": (str,), # noqa: E501 + "model_binary_url": (str,), # noqa: E501 + "oodd_model_binary_id": (str,), # noqa: E501 + "oodd_model_binary_url": (str,), # noqa: E501 + "pipeline_config": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ), # noqa: E501 + "oodd_pipeline_config": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ), # noqa: E501 + "predictor_metadata": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "model_binary_id": "model_binary_id", # noqa: E501 + "model_binary_url": "model_binary_url", # noqa: E501 + "oodd_model_binary_id": "oodd_model_binary_id", # noqa: E501 + "oodd_model_binary_url": "oodd_model_binary_url", # noqa: E501 + "pipeline_config": "pipeline_config", # noqa: E501 + "oodd_pipeline_config": "oodd_pipeline_config", # noqa: E501 + "predictor_metadata": "predictor_metadata", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """EdgeModelInfo - 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,) + model_binary_id (str): [optional] # noqa: E501 + model_binary_url (str): [optional] # noqa: E501 + oodd_model_binary_id (str): [optional] # noqa: E501 + oodd_model_binary_url (str): [optional] # noqa: E501 + pipeline_config (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 + oodd_pipeline_config (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 + predictor_metadata (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__,) + + 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 + """EdgeModelInfo - 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,) + model_binary_id (str): [optional] # noqa: E501 + model_binary_url (str): [optional] # noqa: E501 + oodd_model_binary_id (str): [optional] # noqa: E501 + oodd_model_binary_url (str): [optional] # noqa: E501 + pipeline_config (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 + oodd_pipeline_config (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 + predictor_metadata (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/inline_response200.py b/generated/groundlight_openapi_client/model/inline_response200.py index 7e25ac59..62e2494f 100644 --- a/generated/groundlight_openapi_client/model/inline_response200.py +++ b/generated/groundlight_openapi_client/model/inline_response200.py @@ -29,6 +29,12 @@ from groundlight_openapi_client.exceptions import ApiAttributeError +def lazy_import(): + from groundlight_openapi_client.model.inline_response200_summary import InlineResponse200Summary + + globals()["InlineResponse200Summary"] = InlineResponse200Summary + + class InlineResponse200(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -63,6 +69,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, @@ -87,8 +94,9 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ + lazy_import() return { - "username": (str,), # noqa: E501 + "summary": (InlineResponse200Summary,), # noqa: E501 } @cached_property @@ -96,7 +104,7 @@ def discriminator(): return None attribute_map = { - "username": "username", # noqa: E501 + "summary": "summary", # noqa: E501 } read_only_vars = {} @@ -139,7 +147,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - username (str): The user's username. [optional] # noqa: E501 + summary (InlineResponse200Summary): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -224,7 +232,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,) - username (str): The user's username. [optional] # noqa: E501 + summary (InlineResponse200Summary): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) diff --git a/generated/groundlight_openapi_client/model/inline_response2001.py b/generated/groundlight_openapi_client/model/inline_response2001.py new file mode 100644 index 00000000..cdb30032 --- /dev/null +++ b/generated/groundlight_openapi_client/model/inline_response2001.py @@ -0,0 +1,278 @@ +""" + 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.18.2 + 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.inline_response2001_evaluation_results import ( + InlineResponse2001EvaluationResults, + ) + + globals()["InlineResponse2001EvaluationResults"] = InlineResponse2001EvaluationResults + + +class InlineResponse2001(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 { + "evaluation_results": (InlineResponse2001EvaluationResults,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "evaluation_results": "evaluation_results", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """InlineResponse2001 - 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,) + evaluation_results (InlineResponse2001EvaluationResults): [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 + """InlineResponse2001 - 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,) + evaluation_results (InlineResponse2001EvaluationResults): [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/inline_response2001_evaluation_results.py b/generated/groundlight_openapi_client/model/inline_response2001_evaluation_results.py new file mode 100644 index 00000000..987a8fcc --- /dev/null +++ b/generated/groundlight_openapi_client/model/inline_response2001_evaluation_results.py @@ -0,0 +1,305 @@ +""" + 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.18.2 + 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 InlineResponse2001EvaluationResults(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 = True + + @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 { + "eval_timestamp": (datetime,), # noqa: E501 + "total_ground_truth_examples": ( + int, + none_type, + ), # noqa: E501 + "kfold_pooled__balanced_accuracy": (float,), # noqa: E501 + "kfold_pooled__positive_accuracy": (float,), # noqa: E501 + "kfold_pooled__negative_accuracy": (float,), # noqa: E501 + "balanced_system_accuracies": ( + {str: (bool, date, datetime, dict, float, int, list, str, none_type)}, + ), # noqa: E501 + "positive_system_accuracies": ( + {str: (bool, date, datetime, dict, float, int, list, str, none_type)}, + ), # noqa: E501 + "negative_system_accuracies": ( + {str: (bool, date, datetime, dict, float, int, list, str, none_type)}, + ), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "eval_timestamp": "eval_timestamp", # noqa: E501 + "total_ground_truth_examples": "total_ground_truth_examples", # noqa: E501 + "kfold_pooled__balanced_accuracy": "kfold_pooled__balanced_accuracy", # noqa: E501 + "kfold_pooled__positive_accuracy": "kfold_pooled__positive_accuracy", # noqa: E501 + "kfold_pooled__negative_accuracy": "kfold_pooled__negative_accuracy", # noqa: E501 + "balanced_system_accuracies": "balanced_system_accuracies", # noqa: E501 + "positive_system_accuracies": "positive_system_accuracies", # noqa: E501 + "negative_system_accuracies": "negative_system_accuracies", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """InlineResponse2001EvaluationResults - 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,) + eval_timestamp (datetime): [optional] # noqa: E501 + total_ground_truth_examples (int, none_type): [optional] # noqa: E501 + kfold_pooled__balanced_accuracy (float): [optional] # noqa: E501 + kfold_pooled__positive_accuracy (float): [optional] # noqa: E501 + kfold_pooled__negative_accuracy (float): [optional] # noqa: E501 + balanced_system_accuracies ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + positive_system_accuracies ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + negative_system_accuracies ({str: (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__,) + + 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 + """InlineResponse2001EvaluationResults - 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,) + eval_timestamp (datetime): [optional] # noqa: E501 + total_ground_truth_examples (int, none_type): [optional] # noqa: E501 + kfold_pooled__balanced_accuracy (float): [optional] # noqa: E501 + kfold_pooled__positive_accuracy (float): [optional] # noqa: E501 + kfold_pooled__negative_accuracy (float): [optional] # noqa: E501 + balanced_system_accuracies ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + positive_system_accuracies ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + negative_system_accuracies ({str: (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/inline_response2002.py b/generated/groundlight_openapi_client/model/inline_response2002.py new file mode 100644 index 00000000..1fbfd51d --- /dev/null +++ b/generated/groundlight_openapi_client/model/inline_response2002.py @@ -0,0 +1,268 @@ +""" + 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.18.2 + 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 InlineResponse2002(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, *args, **kwargs): # noqa: E501 + """InlineResponse2002 - 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,) + username (str): The user's username. [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 + """InlineResponse2002 - 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,) + username (str): The user's username. [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/inline_response200_summary.py b/generated/groundlight_openapi_client/model/inline_response200_summary.py new file mode 100644 index 00000000..d5c30a12 --- /dev/null +++ b/generated/groundlight_openapi_client/model/inline_response200_summary.py @@ -0,0 +1,296 @@ +""" + 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.18.2 + 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.inline_response200_summary_class_counts import ( + InlineResponse200SummaryClassCounts, + ) + + globals()["InlineResponse200SummaryClassCounts"] = InlineResponse200SummaryClassCounts + + +class InlineResponse200Summary(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 = True + + @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 { + "num_ground_truth": (int,), # noqa: E501 + "num_current_source_human": (int,), # noqa: E501 + "class_counts": (InlineResponse200SummaryClassCounts,), # noqa: E501 + "unconfident_counts": ( + {str: (bool, date, datetime, dict, float, int, list, str, none_type)}, + ), # noqa: E501 + "total_iqs": (int,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "num_ground_truth": "num_ground_truth", # noqa: E501 + "num_current_source_human": "num_current_source_human", # noqa: E501 + "class_counts": "class_counts", # noqa: E501 + "unconfident_counts": "unconfident_counts", # noqa: E501 + "total_iqs": "total_iqs", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """InlineResponse200Summary - 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,) + num_ground_truth (int): [optional] # noqa: E501 + num_current_source_human (int): [optional] # noqa: E501 + class_counts (InlineResponse200SummaryClassCounts): [optional] # noqa: E501 + unconfident_counts ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + total_iqs (int): [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 + """InlineResponse200Summary - 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,) + num_ground_truth (int): [optional] # noqa: E501 + num_current_source_human (int): [optional] # noqa: E501 + class_counts (InlineResponse200SummaryClassCounts): [optional] # noqa: E501 + unconfident_counts ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + total_iqs (int): [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/inline_response200_summary_class_counts.py b/generated/groundlight_openapi_client/model/inline_response200_summary_class_counts.py new file mode 100644 index 00000000..b2eb180b --- /dev/null +++ b/generated/groundlight_openapi_client/model/inline_response200_summary_class_counts.py @@ -0,0 +1,284 @@ +""" + 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.18.2 + 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 InlineResponse200SummaryClassCounts(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 { + "source_ml": ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + "source_human": ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + "cloud_labeler": ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + "cloud": ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + "total": ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "source_ml": "source_ml", # noqa: E501 + "source_human": "source_human", # noqa: E501 + "cloud_labeler": "cloud_labeler", # noqa: E501 + "cloud": "cloud", # noqa: E501 + "total": "total", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """InlineResponse200SummaryClassCounts - 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,) + source_ml ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + source_human ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + cloud_labeler ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + cloud ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + total ({str: (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__,) + + 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 + """InlineResponse200SummaryClassCounts - 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,) + source_ml ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + source_human ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + cloud_labeler ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + cloud ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + total ({str: (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 index 362d870c..6a25d37f 100644 --- a/generated/groundlight_openapi_client/model/label_value_request.py +++ b/generated/groundlight_openapi_client/model/label_value_request.py @@ -62,9 +62,6 @@ class LabelValueRequest(ModelNormal): allowed_values = {} validations = { - ("label",): { - "min_length": 1, - }, ("image_query_id",): { "min_length": 1, }, diff --git a/generated/groundlight_openapi_client/model/text_mode_configuration.py b/generated/groundlight_openapi_client/model/text_mode_configuration.py new file mode 100644 index 00000000..ee4c4e73 --- /dev/null +++ b/generated/groundlight_openapi_client/model/text_mode_configuration.py @@ -0,0 +1,273 @@ +""" + 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.18.2 + 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 TextModeConfiguration(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 = { + ("value_max_length",): { + "inclusive_maximum": 250, + "inclusive_minimum": 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 { + "value_max_length": (int,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "value_max_length": "value_max_length", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """TextModeConfiguration - 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_max_length (int): [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 + """TextModeConfiguration - 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_max_length (int): [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/webhook_action.py b/generated/groundlight_openapi_client/model/webhook_action.py index 826b3312..20ae3007 100644 --- a/generated/groundlight_openapi_client/model/webhook_action.py +++ b/generated/groundlight_openapi_client/model/webhook_action.py @@ -93,7 +93,10 @@ def openapi_types(): """ return { "url": (str,), # noqa: E501 - "include_image": (bool,), # noqa: E501 + "include_image": ( + bool, + none_type, + ), # noqa: E501 } @cached_property @@ -148,7 +151,7 @@ def _from_openapi_data(cls, url, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - include_image (bool): [optional] # noqa: E501 + include_image (bool, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -237,7 +240,7 @@ def __init__(self, url, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - include_image (bool): [optional] # noqa: E501 + include_image (bool, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) diff --git a/generated/groundlight_openapi_client/models/__init__.py b/generated/groundlight_openapi_client/models/__init__.py index a81ec9af..4abd7eb2 100644 --- a/generated/groundlight_openapi_client/models/__init__.py +++ b/generated/groundlight_openapi_client/models/__init__.py @@ -27,10 +27,16 @@ 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.edge_model_info import EdgeModelInfo from groundlight_openapi_client.model.escalation_type_enum import EscalationTypeEnum 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.inline_response2001 import InlineResponse2001 +from groundlight_openapi_client.model.inline_response2001_evaluation_results import InlineResponse2001EvaluationResults +from groundlight_openapi_client.model.inline_response2002 import InlineResponse2002 +from groundlight_openapi_client.model.inline_response200_summary import InlineResponse200Summary +from groundlight_openapi_client.model.inline_response200_summary_class_counts import InlineResponse200SummaryClassCounts 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 @@ -50,6 +56,7 @@ 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.status_enum import StatusEnum +from groundlight_openapi_client.model.text_mode_configuration import TextModeConfiguration from groundlight_openapi_client.model.text_recognition_result import TextRecognitionResult from groundlight_openapi_client.model.verb_enum import VerbEnum from groundlight_openapi_client.model.webhook_action import WebhookAction diff --git a/generated/model.py b/generated/model.py index 60f81dcd..3942aa16 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2025-01-17T23:47:47+00:00 +# timestamp: 2025-02-22T00:43:40+00:00 from __future__ import annotations @@ -62,6 +62,20 @@ class DetectorTypeEnum(str, Enum): detector = "detector" +class EdgeModelInfo(BaseModel): + """ + Information for the model running on edge, including temporary presigned urls to the model binaries + """ + + model_binary_id: Optional[str] = None + model_binary_url: Optional[str] = None + oodd_model_binary_id: Optional[str] = None + oodd_model_binary_url: Optional[str] = None + pipeline_config: Optional[Any] = None + oodd_pipeline_config: Optional[Any] = None + predictor_metadata: Optional[Any] = None + + class EscalationTypeEnum(str, Enum): """ * `STANDARD` - STANDARD @@ -242,7 +256,7 @@ class MultiClassModeConfiguration(BaseModel): class TextModeConfiguration(BaseModel): - pass + value_max_length: Optional[conint(ge=1, le=250)] = None class ChannelEnum(str, Enum): @@ -282,7 +296,11 @@ class ConditionRequest(BaseModel): class Detector(BaseModel): """ - Spec for serializing a detector object in the public API. + Groundlight Detectors provide answers to natural language questions about images. + + Each detector can answer a single question, and multiple detectors can be strung together for + more complex logic. Detectors can be created through the create_detector method, or through the + create_[MODE]_detector methods for pro tier users """ id: str = Field(..., description="A unique ID for this object.") @@ -356,7 +374,7 @@ class DetectorCreationInputRequest(BaseModel): class ImageQuery(BaseModel): """ - Spec for serializing a image-query object in the public API. + ImageQuery objects are the answers to natural language questions about images created by detectors. """ metadata: Optional[Dict[str, Any]] = Field(..., description="Metadata about the image query.") @@ -393,7 +411,7 @@ class LabelValue(BaseModel): class LabelValueRequest(BaseModel): - label: constr(min_length=1) + label: str image_query_id: constr(min_length=1) rois: Optional[List[ROIRequest]] = None @@ -414,7 +432,11 @@ class PaginatedImageQueryList(BaseModel): class PatchedDetectorRequest(BaseModel): """ - Spec for serializing a detector object in the public API. + Groundlight Detectors provide answers to natural language questions about images. + + Each detector can answer a single question, and multiple detectors can be strung together for + more complex logic. Detectors can be created through the create_detector method, or through the + create_[MODE]_detector methods for pro tier users """ name: Optional[constr(min_length=1, max_length=200)] = Field( diff --git a/generated/test/test_edge_api.py b/generated/test/test_edge_api.py new file mode 100644 index 00000000..5d116941 --- /dev/null +++ b/generated/test/test_edge_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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.api.edge_api import EdgeApi # noqa: E501 + + +class TestEdgeApi(unittest.TestCase): + """EdgeApi unit test stubs""" + + def setUp(self): + self.api = EdgeApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_model_urls(self): + """Test case for get_model_urls""" + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_edge_model_info.py b/generated/test/test_edge_model_info.py new file mode 100644 index 00000000..6165fcf8 --- /dev/null +++ b/generated/test/test_edge_model_info.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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.edge_model_info import EdgeModelInfo + + +class TestEdgeModelInfo(unittest.TestCase): + """EdgeModelInfo unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEdgeModelInfo(self): + """Test EdgeModelInfo""" + # FIXME: construct object with mandatory attributes with example values + # model = EdgeModelInfo() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_inline_response2001.py b/generated/test/test_inline_response2001.py new file mode 100644 index 00000000..04e1f999 --- /dev/null +++ b/generated/test/test_inline_response2001.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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.inline_response2001_evaluation_results import InlineResponse2001EvaluationResults + +globals()["InlineResponse2001EvaluationResults"] = InlineResponse2001EvaluationResults +from groundlight_openapi_client.model.inline_response2001 import InlineResponse2001 + + +class TestInlineResponse2001(unittest.TestCase): + """InlineResponse2001 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testInlineResponse2001(self): + """Test InlineResponse2001""" + # FIXME: construct object with mandatory attributes with example values + # model = InlineResponse2001() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_inline_response2001_evaluation_results.py b/generated/test/test_inline_response2001_evaluation_results.py new file mode 100644 index 00000000..75e6fffa --- /dev/null +++ b/generated/test/test_inline_response2001_evaluation_results.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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.inline_response2001_evaluation_results import InlineResponse2001EvaluationResults + + +class TestInlineResponse2001EvaluationResults(unittest.TestCase): + """InlineResponse2001EvaluationResults unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testInlineResponse2001EvaluationResults(self): + """Test InlineResponse2001EvaluationResults""" + # FIXME: construct object with mandatory attributes with example values + # model = InlineResponse2001EvaluationResults() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_inline_response2002.py b/generated/test/test_inline_response2002.py new file mode 100644 index 00000000..84922f0f --- /dev/null +++ b/generated/test/test_inline_response2002.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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.inline_response2002 import InlineResponse2002 + + +class TestInlineResponse2002(unittest.TestCase): + """InlineResponse2002 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testInlineResponse2002(self): + """Test InlineResponse2002""" + # FIXME: construct object with mandatory attributes with example values + # model = InlineResponse2002() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_inline_response200_summary.py b/generated/test/test_inline_response200_summary.py new file mode 100644 index 00000000..add3206c --- /dev/null +++ b/generated/test/test_inline_response200_summary.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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.inline_response200_summary_class_counts import InlineResponse200SummaryClassCounts + +globals()["InlineResponse200SummaryClassCounts"] = InlineResponse200SummaryClassCounts +from groundlight_openapi_client.model.inline_response200_summary import InlineResponse200Summary + + +class TestInlineResponse200Summary(unittest.TestCase): + """InlineResponse200Summary unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testInlineResponse200Summary(self): + """Test InlineResponse200Summary""" + # FIXME: construct object with mandatory attributes with example values + # model = InlineResponse200Summary() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_inline_response200_summary_class_counts.py b/generated/test/test_inline_response200_summary_class_counts.py new file mode 100644 index 00000000..c5bf4ec4 --- /dev/null +++ b/generated/test/test_inline_response200_summary_class_counts.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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.inline_response200_summary_class_counts import InlineResponse200SummaryClassCounts + + +class TestInlineResponse200SummaryClassCounts(unittest.TestCase): + """InlineResponse200SummaryClassCounts unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testInlineResponse200SummaryClassCounts(self): + """Test InlineResponse200SummaryClassCounts""" + # FIXME: construct object with mandatory attributes with example values + # model = InlineResponse200SummaryClassCounts() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_text_mode_configuration.py b/generated/test/test_text_mode_configuration.py new file mode 100644 index 00000000..81ba287d --- /dev/null +++ b/generated/test/test_text_mode_configuration.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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.text_mode_configuration import TextModeConfiguration + + +class TestTextModeConfiguration(unittest.TestCase): + """TextModeConfiguration unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTextModeConfiguration(self): + """Test TextModeConfiguration""" + # FIXME: construct object with mandatory attributes with example values + # model = TextModeConfiguration() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/spec/public-api.yaml b/spec/public-api.yaml index 81b66670..ac056b51 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -250,6 +250,54 @@ paths: schema: $ref: '#/components/schemas/Detector' description: '' + /v1/detectors/{detector_id}/metrics: + get: + operationId: get detector metrics + description: Get Detector metrics, primarily the counts of different types of + labels + parameters: + - in: path + name: detector_id + schema: + type: string + required: true + tags: + - detectors + security: + - ApiToken: [] + responses: + '200': + content: + application/json: + schema: + type: object + properties: + summary: + type: object + properties: + num_ground_truth: + type: integer + num_current_source_human: + type: integer + class_counts: + type: object + properties: + source_ml: + type: object + source_human: + type: object + cloud_labeler: + type: object + cloud: + type: object + total: + type: object + unconfident_counts: + type: object + total_iqs: + type: integer + nullable: true + description: '' /v1/detectors/{id}: get: operationId: Get detector @@ -320,6 +368,81 @@ paths: responses: '204': description: No response body + /v1/detectors/{id}/evaluation: + get: + operationId: get detector evaluation + description: Get Detector evaluation results Is null if there isn't enough ground + truth data to evaluate the detector.returns the time of the evaulation, total + ground truth labels, the ml based kfold accuracies, and the system accuracies + at different confidence thresholds + parameters: + - in: path + name: id + schema: + type: string + required: true + tags: + - detectors + security: + - ApiToken: [] + responses: + '200': + content: + application/json: + schema: + type: object + properties: + evaluation_results: + type: object + properties: + eval_timestamp: + type: string + format: date-time + total_ground_truth_examples: + type: integer + nullable: true + kfold_pooled__balanced_accuracy: + type: number + format: float + kfold_pooled__positive_accuracy: + type: number + format: float + kfold_pooled__negative_accuracy: + type: number + format: float + balanced_system_accuracies: + type: object + additionalProperties: true + positive_system_accuracies: + type: object + additionalProperties: true + negative_system_accuracies: + type: object + additionalProperties: true + nullable: true + description: '' + /v1/edge/fetch-model-urls/{detector_id}/: + get: + operationId: Get Model URLs + description: Gets time limited pre-authenticated URLs to download a detector's + edge model and oodd model. + parameters: + - in: path + name: detector_id + schema: + type: string + required: true + tags: + - edge + security: + - ApiToken: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/EdgeModelInfo' + description: '' /v1/image-queries: get: operationId: List image queries @@ -706,7 +829,12 @@ components: - verb Detector: type: object - description: Spec for serializing a detector object in the public API. + description: |- + Groundlight Detectors provide answers to natural language questions about images. + + Each detector can answer a single question, and multiple detectors can be strung together for + more complex logic. Detectors can be created through the create_detector method, or through the + create_[MODE]_detector methods for pro tier users properties: id: type: string @@ -880,6 +1008,22 @@ components: enum: - detector type: string + EdgeModelInfo: + type: object + description: Information for the model running on edge, including temporary + presigned urls to the model binaries + properties: + model_binary_id: + type: string + model_binary_url: + type: string + oodd_model_binary_id: + type: string + oodd_model_binary_url: + type: string + pipeline_config: {} + oodd_pipeline_config: {} + predictor_metadata: {} EscalationTypeEnum: enum: - STANDARD @@ -890,7 +1034,8 @@ components: * `NO_HUMAN_LABELING` - NO_HUMAN_LABELING ImageQuery: type: object - description: Spec for serializing a image-query object in the public API. + description: ImageQuery objects are the answers to natural language questions + about images created by detectors. properties: metadata: type: object @@ -1033,7 +1178,6 @@ components: label: type: string writeOnly: true - minLength: 1 image_query_id: type: string writeOnly: true @@ -1154,7 +1298,12 @@ components: $ref: '#/components/schemas/Rule' PatchedDetectorRequest: type: object - description: Spec for serializing a detector object in the public API. + description: |- + Groundlight Detectors provide answers to natural language questions about images. + + Each detector can answer a single question, and multiple detectors can be strung together for + more complex logic. Detectors can be created through the create_detector method, or through the + create_[MODE]_detector methods for pro tier users properties: name: type: string @@ -1373,6 +1522,7 @@ components: maxLength: 200 include_image: type: boolean + nullable: true required: - url WebhookActionRequest: @@ -1508,6 +1658,12 @@ components: - class_names TextModeConfiguration: type: object + properties: + value_max_length: + type: integer + minimum: 1 + maximum: 250 + nullable: false ChannelEnum: type: string enum: @@ -1543,4 +1699,4 @@ servers: - url: https://device.positronix.ai/device-api description: Device Prod - url: https://device.integ.positronix.ai/device-api - description: Device Integ \ No newline at end of file + description: Device Integ diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 17f80d49..4aad70a5 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -947,3 +947,30 @@ def create_multiclass_detector( # noqa: PLR0913 # pylint: disable=too-many-argu detector_creation_input.mode_configuration = mode_config obj = self.detectors_api.create_detector(detector_creation_input, _request_timeout=DEFAULT_REQUEST_TIMEOUT) return Detector.parse_obj(obj.to_dict()) + + def get_detector_evaluation(self, detector: Union[str, Detector]) -> dict: + """ + Get a specific evaluation for a detector + + :param detector: the detector to get the evaluation for + :param evaluation_id: the evaluation id to get + + :return: The DetectorEvaluation object + """ + if isinstance(detector, Detector): + detector = detector.id + obj = self.detectors_api.get_detector_evaluation(detector) + return obj.to_dict() + + def get_detector_metrics(self, detector: Union[str, Detector]) -> dict: + """ + Get the metrics for a detector + + :param detector: the detector to get the metrics for + + :return: The DetectorMetrics object + """ + if isinstance(detector, Detector): + detector = detector.id + obj = self.detectors_api.get_detector_metrics(detector) + return obj.to_dict() diff --git a/test/unit/test_metrics_and_evaluation.py b/test/unit/test_metrics_and_evaluation.py new file mode 100644 index 00000000..9cd50269 --- /dev/null +++ b/test/unit/test_metrics_and_evaluation.py @@ -0,0 +1,16 @@ +from datetime import datetime + +import pytest +from groundlight import ExperimentalApi + + +def test_metrics_and_evaluation(gl_experimental: ExperimentalApi): + name = f"Test metrics and evaluation {datetime.utcnow()}" + det = gl_experimental.create_detector(name, "test_query") + iq1 = gl_experimental.submit_image_query(det, "test/assets/cat.jpeg") + for i in range(10): + gl_experimental.add_label(iq1, "YES") + gl_experimental.add_label(iq1, "NO") + metrics = gl_experimental.get_detector_metrics(det.id) + + evaluation = gl_experimental.evaluate_detector(det.id) From 3c566e6afd8edaa82740dc0044a1bdac297efd1f Mon Sep 17 00:00:00 2001 From: brandon Date: Fri, 21 Feb 2025 17:22:35 -0800 Subject: [PATCH 2/9] finalize test --- test/unit/test_metrics_and_evaluation.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/test/unit/test_metrics_and_evaluation.py b/test/unit/test_metrics_and_evaluation.py index 9cd50269..eda69657 100644 --- a/test/unit/test_metrics_and_evaluation.py +++ b/test/unit/test_metrics_and_evaluation.py @@ -7,10 +7,24 @@ def test_metrics_and_evaluation(gl_experimental: ExperimentalApi): name = f"Test metrics and evaluation {datetime.utcnow()}" det = gl_experimental.create_detector(name, "test_query") - iq1 = gl_experimental.submit_image_query(det, "test/assets/cat.jpeg") - for i in range(10): - gl_experimental.add_label(iq1, "YES") - gl_experimental.add_label(iq1, "NO") + for i in range(6): + iq = gl_experimental.submit_image_query(det, "test/assets/cat.jpeg", wait=0, patience_time=10, human_review="NEVER") + gl_experimental.add_label(iq, "YES") + iq = gl_experimental.submit_image_query(det, "test/assets/cat.jpeg", wait=0, patience_time=10, human_review="NEVER") + gl_experimental.add_label(iq, "NO") metrics = gl_experimental.get_detector_metrics(det.id) + assert metrics["summary"] is not None + assert metrics["summary"]["num_ground_truth"] is not None + assert metrics["summary"]["num_current_source_human"] is not None + assert metrics["summary"]["class_counts"] is not None + assert metrics["summary"]["unconfident_counts"] is not None + assert metrics["summary"]["total_iqs"] is not None - evaluation = gl_experimental.evaluate_detector(det.id) + # NOTE: this implicitly tests how quickly the evaluation is made available + evaluation = gl_experimental.get_detector_evaluation(det.id) + assert evaluation["evaluation_results"]["kfold_pooled__balanced_accuracy"] is not None + assert evaluation["evaluation_results"]["kfold_pooled__positive_accuracy"] is not None + assert evaluation["evaluation_results"]["kfold_pooled__negative_accuracy"] is not None + assert evaluation["evaluation_results"]["balanced_system_accuracies"] is not None + assert evaluation["evaluation_results"]["positive_system_accuracies"] is not None + assert evaluation["evaluation_results"]["negative_system_accuracies"] is not None \ No newline at end of file From 5a3c5afb2d4e8778f8ce5f5268c4c8c919dc046b Mon Sep 17 00:00:00 2001 From: Auto-format Bot Date: Sat, 22 Feb 2025 01:23:30 +0000 Subject: [PATCH 3/9] Automatically reformatting code --- test/unit/test_metrics_and_evaluation.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/unit/test_metrics_and_evaluation.py b/test/unit/test_metrics_and_evaluation.py index eda69657..3d05b100 100644 --- a/test/unit/test_metrics_and_evaluation.py +++ b/test/unit/test_metrics_and_evaluation.py @@ -1,6 +1,5 @@ from datetime import datetime -import pytest from groundlight import ExperimentalApi @@ -8,9 +7,13 @@ def test_metrics_and_evaluation(gl_experimental: ExperimentalApi): name = f"Test metrics and evaluation {datetime.utcnow()}" det = gl_experimental.create_detector(name, "test_query") for i in range(6): - iq = gl_experimental.submit_image_query(det, "test/assets/cat.jpeg", wait=0, patience_time=10, human_review="NEVER") + iq = gl_experimental.submit_image_query( + det, "test/assets/cat.jpeg", wait=0, patience_time=10, human_review="NEVER" + ) gl_experimental.add_label(iq, "YES") - iq = gl_experimental.submit_image_query(det, "test/assets/cat.jpeg", wait=0, patience_time=10, human_review="NEVER") + iq = gl_experimental.submit_image_query( + det, "test/assets/cat.jpeg", wait=0, patience_time=10, human_review="NEVER" + ) gl_experimental.add_label(iq, "NO") metrics = gl_experimental.get_detector_metrics(det.id) assert metrics["summary"] is not None @@ -27,4 +30,4 @@ def test_metrics_and_evaluation(gl_experimental: ExperimentalApi): assert evaluation["evaluation_results"]["kfold_pooled__negative_accuracy"] is not None assert evaluation["evaluation_results"]["balanced_system_accuracies"] is not None assert evaluation["evaluation_results"]["positive_system_accuracies"] is not None - assert evaluation["evaluation_results"]["negative_system_accuracies"] is not None \ No newline at end of file + assert evaluation["evaluation_results"]["negative_system_accuracies"] is not None From c2181d50b7c90176d0858ba0ac9bf90d0dc4d456 Mon Sep 17 00:00:00 2001 From: brandon Date: Fri, 21 Feb 2025 17:40:14 -0800 Subject: [PATCH 4/9] the linter --- src/groundlight/experimental_api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 7cab6fac..071835d1 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines """ experimental_api.py From 45682de33c18b888881b3a624e0aabd74def23ed Mon Sep 17 00:00:00 2001 From: brandon Date: Mon, 24 Feb 2025 14:54:23 -0800 Subject: [PATCH 5/9] regenerate --- generated/.openapi-generator/FILES | 6 + generated/README.md | 3 + generated/docs/ActionsApi.md | 1 + generated/docs/DetectorsApi.md | 2 +- generated/docs/PayloadTemplate.md | 12 + generated/docs/PayloadTemplateRequest.md | 12 + generated/docs/TextRecognitionResult.md | 2 +- generated/docs/WebhookAction.md | 3 +- generated/docs/WebhookActionRequest.md | 1 + .../api/detectors_api.py | 2 +- .../model/payload_template.py | 274 +++++++++++++++++ .../model/payload_template_request.py | 278 ++++++++++++++++++ .../model/text_recognition_result.py | 9 +- .../model/webhook_action.py | 25 +- .../model/webhook_action_request.py | 22 ++ .../models/__init__.py | 2 + generated/model.py | 14 +- generated/test/test_payload_template.py | 35 +++ .../test/test_payload_template_request.py | 35 +++ spec/public-api.yaml | 34 ++- src/groundlight/experimental_api.py | 5 +- 21 files changed, 751 insertions(+), 26 deletions(-) create mode 100644 generated/docs/PayloadTemplate.md create mode 100644 generated/docs/PayloadTemplateRequest.md create mode 100644 generated/groundlight_openapi_client/model/payload_template.py create mode 100644 generated/groundlight_openapi_client/model/payload_template_request.py create mode 100644 generated/test/test_payload_template.py create mode 100644 generated/test/test_payload_template_request.py diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index 621d92cc..0ea0904a 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -47,6 +47,8 @@ docs/PaginatedDetectorList.md docs/PaginatedImageQueryList.md docs/PaginatedRuleList.md docs/PatchedDetectorRequest.md +docs/PayloadTemplate.md +docs/PayloadTemplateRequest.md docs/ROI.md docs/ROIRequest.md docs/ResultTypeEnum.md @@ -117,6 +119,8 @@ 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/patched_detector_request.py +groundlight_openapi_client/model/payload_template.py +groundlight_openapi_client/model/payload_template_request.py groundlight_openapi_client/model/result_type_enum.py groundlight_openapi_client/model/roi.py groundlight_openapi_client/model/roi_request.py @@ -138,4 +142,6 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_payload_template.py +test/test_payload_template_request.py tox.ini diff --git a/generated/README.md b/generated/README.md index ffd5d1cc..373577ba 100644 --- a/generated/README.md +++ b/generated/README.md @@ -94,6 +94,7 @@ rule_request = RuleRequest( WebhookActionRequest( url="url_example", include_image=True, + payload_template=None, ), ], ) # RuleRequest | @@ -178,6 +179,8 @@ Class | Method | HTTP request | Description - [PaginatedImageQueryList](docs/PaginatedImageQueryList.md) - [PaginatedRuleList](docs/PaginatedRuleList.md) - [PatchedDetectorRequest](docs/PatchedDetectorRequest.md) + - [PayloadTemplate](docs/PayloadTemplate.md) + - [PayloadTemplateRequest](docs/PayloadTemplateRequest.md) - [ROI](docs/ROI.md) - [ROIRequest](docs/ROIRequest.md) - [ResultTypeEnum](docs/ResultTypeEnum.md) diff --git a/generated/docs/ActionsApi.md b/generated/docs/ActionsApi.md index 62acb205..9bf52c09 100644 --- a/generated/docs/ActionsApi.md +++ b/generated/docs/ActionsApi.md @@ -69,6 +69,7 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: WebhookActionRequest( url="url_example", include_image=True, + payload_template=None, ), ], ) # RuleRequest | diff --git a/generated/docs/DetectorsApi.md b/generated/docs/DetectorsApi.md index 1394577e..51cc1d1c 100644 --- a/generated/docs/DetectorsApi.md +++ b/generated/docs/DetectorsApi.md @@ -258,7 +258,7 @@ Name | Type | Description | Notes -Get Detector evaluation results Is null if there isn't enough ground truth data to evaluate the detector.returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds +Get Detector evaluation results. The result is null if there isn't enough ground truth data to evaluate the detector. Returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds ### Example diff --git a/generated/docs/PayloadTemplate.md b/generated/docs/PayloadTemplate.md new file mode 100644 index 00000000..a2c716c0 --- /dev/null +++ b/generated/docs/PayloadTemplate.md @@ -0,0 +1,12 @@ +# PayloadTemplate + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**template** | **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/PayloadTemplateRequest.md b/generated/docs/PayloadTemplateRequest.md new file mode 100644 index 00000000..ff584274 --- /dev/null +++ b/generated/docs/PayloadTemplateRequest.md @@ -0,0 +1,12 @@ +# PayloadTemplateRequest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**template** | **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/TextRecognitionResult.md b/generated/docs/TextRecognitionResult.md index 6258a200..d50b80df 100644 --- a/generated/docs/TextRecognitionResult.md +++ b/generated/docs/TextRecognitionResult.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**text** | **str, none_type** | | +**text** | **str** | | **truncated** | **bool** | | **confidence** | **float, none_type** | | [optional] **source** | **str** | | [optional] diff --git a/generated/docs/WebhookAction.md b/generated/docs/WebhookAction.md index ad224e7c..a1f6cf2b 100644 --- a/generated/docs/WebhookAction.md +++ b/generated/docs/WebhookAction.md @@ -5,7 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **url** | **str** | | -**include_image** | **bool, none_type** | | [optional] +**include_image** | **bool** | | [optional] +**payload_template** | **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/WebhookActionRequest.md b/generated/docs/WebhookActionRequest.md index 411d192d..e3b1c59e 100644 --- a/generated/docs/WebhookActionRequest.md +++ b/generated/docs/WebhookActionRequest.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **url** | **str** | | **include_image** | **bool** | | [optional] +**payload_template** | **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/groundlight_openapi_client/api/detectors_api.py b/generated/groundlight_openapi_client/api/detectors_api.py index 1a838d3e..eca18f45 100644 --- a/generated/groundlight_openapi_client/api/detectors_api.py +++ b/generated/groundlight_openapi_client/api/detectors_api.py @@ -498,7 +498,7 @@ def get_detector(self, id, **kwargs): def get_detector_evaluation(self, id, **kwargs): """get_detector_evaluation # noqa: E501 - Get Detector evaluation results Is null if there isn't enough ground truth data to evaluate the detector.returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds # noqa: E501 + Get Detector evaluation results. The result is null if there isn't enough ground truth data to evaluate the detector. Returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True diff --git a/generated/groundlight_openapi_client/model/payload_template.py b/generated/groundlight_openapi_client/model/payload_template.py new file mode 100644 index 00000000..2cf74e03 --- /dev/null +++ b/generated/groundlight_openapi_client/model/payload_template.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.18.2 + 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 PayloadTemplate(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 { + "template": (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "template": "template", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, template, *args, **kwargs): # noqa: E501 + """PayloadTemplate - a model defined in OpenAPI + + Args: + template (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.template = template + 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, template, *args, **kwargs): # noqa: E501 + """PayloadTemplate - a model defined in OpenAPI + + Args: + template (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.template = template + 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/payload_template_request.py b/generated/groundlight_openapi_client/model/payload_template_request.py new file mode 100644 index 00000000..7e34645e --- /dev/null +++ b/generated/groundlight_openapi_client/model/payload_template_request.py @@ -0,0 +1,278 @@ +""" + 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.18.2 + 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 PayloadTemplateRequest(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 = { + ("template",): { + "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 { + "template": (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + "template": "template", # noqa: E501 + } + + read_only_vars = {} + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, template, *args, **kwargs): # noqa: E501 + """PayloadTemplateRequest - a model defined in OpenAPI + + Args: + template (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.template = template + 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, template, *args, **kwargs): # noqa: E501 + """PayloadTemplateRequest - a model defined in OpenAPI + + Args: + template (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.template = template + 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/text_recognition_result.py b/generated/groundlight_openapi_client/model/text_recognition_result.py index cddca732..ca44ff65 100644 --- a/generated/groundlight_openapi_client/model/text_recognition_result.py +++ b/generated/groundlight_openapi_client/model/text_recognition_result.py @@ -101,10 +101,7 @@ def openapi_types(): and the value is attribute type. """ return { - "text": ( - str, - none_type, - ), # noqa: E501 + "text": (str,), # noqa: E501 "truncated": (bool,), # noqa: E501 "confidence": ( float, @@ -134,7 +131,7 @@ def _from_openapi_data(cls, text, truncated, *args, **kwargs): # noqa: E501 """TextRecognitionResult - a model defined in OpenAPI Args: - text (str, none_type): + text (str): truncated (bool): Keyword Args: @@ -226,7 +223,7 @@ def __init__(self, text, truncated, *args, **kwargs): # noqa: E501 """TextRecognitionResult - a model defined in OpenAPI Args: - text (str, none_type): + text (str): truncated (bool): Keyword Args: diff --git a/generated/groundlight_openapi_client/model/webhook_action.py b/generated/groundlight_openapi_client/model/webhook_action.py index 20ae3007..d272aad8 100644 --- a/generated/groundlight_openapi_client/model/webhook_action.py +++ b/generated/groundlight_openapi_client/model/webhook_action.py @@ -29,6 +29,12 @@ from groundlight_openapi_client.exceptions import ApiAttributeError +def lazy_import(): + from groundlight_openapi_client.model.payload_template import PayloadTemplate + + globals()["PayloadTemplate"] = PayloadTemplate + + class WebhookAction(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -67,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, @@ -91,10 +98,19 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ + lazy_import() return { "url": (str,), # noqa: E501 - "include_image": ( + "include_image": (bool,), # noqa: E501 + "payload_template": ( bool, + date, + datetime, + dict, + float, + int, + list, + str, none_type, ), # noqa: E501 } @@ -106,6 +122,7 @@ def discriminator(): attribute_map = { "url": "url", # noqa: E501 "include_image": "include_image", # noqa: E501 + "payload_template": "payload_template", # noqa: E501 } read_only_vars = {} @@ -151,7 +168,8 @@ def _from_openapi_data(cls, url, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - include_image (bool, none_type): [optional] # noqa: E501 + include_image (bool): [optional] # noqa: E501 + payload_template (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -240,7 +258,8 @@ def __init__(self, url, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - include_image (bool, none_type): [optional] # noqa: E501 + include_image (bool): [optional] # noqa: E501 + payload_template (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/webhook_action_request.py b/generated/groundlight_openapi_client/model/webhook_action_request.py index 9990e3e0..053d1a77 100644 --- a/generated/groundlight_openapi_client/model/webhook_action_request.py +++ b/generated/groundlight_openapi_client/model/webhook_action_request.py @@ -29,6 +29,12 @@ from groundlight_openapi_client.exceptions import ApiAttributeError +def lazy_import(): + from groundlight_openapi_client.model.payload_template_request import PayloadTemplateRequest + + globals()["PayloadTemplateRequest"] = PayloadTemplateRequest + + class WebhookActionRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -68,6 +74,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,9 +99,21 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ + lazy_import() return { "url": (str,), # noqa: E501 "include_image": (bool,), # noqa: E501 + "payload_template": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + none_type, + ), # noqa: E501 } @cached_property @@ -104,6 +123,7 @@ def discriminator(): attribute_map = { "url": "url", # noqa: E501 "include_image": "include_image", # noqa: E501 + "payload_template": "payload_template", # noqa: E501 } read_only_vars = {} @@ -150,6 +170,7 @@ def _from_openapi_data(cls, url, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) include_image (bool): [optional] # noqa: E501 + payload_template (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop("_check_type", True) @@ -239,6 +260,7 @@ def __init__(self, url, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) include_image (bool): [optional] # noqa: E501 + payload_template (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/models/__init__.py b/generated/groundlight_openapi_client/models/__init__.py index 4abd7eb2..6f7e77be 100644 --- a/generated/groundlight_openapi_client/models/__init__.py +++ b/generated/groundlight_openapi_client/models/__init__.py @@ -48,6 +48,8 @@ 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.patched_detector_request import PatchedDetectorRequest +from groundlight_openapi_client.model.payload_template import PayloadTemplate +from groundlight_openapi_client.model.payload_template_request import PayloadTemplateRequest 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 diff --git a/generated/model.py b/generated/model.py index 6d8fbb5b..fed5dfdf 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2025-02-22T00:43:40+00:00 +# timestamp: 2025-02-24T22:54:15+00:00 from __future__ import annotations @@ -109,6 +109,14 @@ class NoteRequest(BaseModel): image: Optional[bytes] = None +class PayloadTemplate(BaseModel): + template: str + + +class PayloadTemplateRequest(BaseModel): + template: constr(min_length=1) + + class ROI(BaseModel): """ Mixin for serializers to handle data in the StrictBaseModel format @@ -198,11 +206,13 @@ class VerbEnum(str, Enum): class WebhookAction(BaseModel): url: AnyUrl include_image: Optional[bool] = None + payload_template: Optional[PayloadTemplate] = None class WebhookActionRequest(BaseModel): url: AnyUrl include_image: Optional[bool] = None + payload_template: Optional[PayloadTemplateRequest] = None class Source(str, Enum): @@ -241,7 +251,7 @@ class MultiClassificationResult(BaseModel): class TextRecognitionResult(BaseModel): confidence: Optional[confloat(ge=0.0, le=1.0)] = None source: Optional[Source] = None - text: Optional[str] = Field(...) + text: str truncated: bool diff --git a/generated/test/test_payload_template.py b/generated/test/test_payload_template.py new file mode 100644 index 00000000..7d4af2fd --- /dev/null +++ b/generated/test/test_payload_template.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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.payload_template import PayloadTemplate + + +class TestPayloadTemplate(unittest.TestCase): + """PayloadTemplate unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testPayloadTemplate(self): + """Test PayloadTemplate""" + # FIXME: construct object with mandatory attributes with example values + # model = PayloadTemplate() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_payload_template_request.py b/generated/test/test_payload_template_request.py new file mode 100644 index 00000000..312fc15c --- /dev/null +++ b/generated/test/test_payload_template_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.18.2 + Contact: support@groundlight.ai + Generated by: https://openapi-generator.tech +""" + +import sys +import unittest + +import groundlight_openapi_client +from groundlight_openapi_client.model.payload_template_request import PayloadTemplateRequest + + +class TestPayloadTemplateRequest(unittest.TestCase): + """PayloadTemplateRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testPayloadTemplateRequest(self): + """Test PayloadTemplateRequest""" + # FIXME: construct object with mandatory attributes with example values + # model = PayloadTemplateRequest() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/spec/public-api.yaml b/spec/public-api.yaml index 556f1d81..771b2077 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -371,10 +371,10 @@ paths: /v1/detectors/{id}/evaluation: get: operationId: get detector evaluation - description: Get Detector evaluation results Is null if there isn't enough ground - truth data to evaluate the detector.returns the time of the evaulation, total - ground truth labels, the ml based kfold accuracies, and the system accuracies - at different confidence thresholds + description: Get Detector evaluation results. The result is null if there isn't + enough ground truth data to evaluate the detector. Returns the time of the + evaulation, total ground truth labels, the ml based kfold accuracies, and + the system accuracies at different confidence thresholds parameters: - in: path name: id @@ -1338,6 +1338,21 @@ components: * `STANDARD` - STANDARD * `NO_HUMAN_LABELING` - NO_HUMAN_LABELING x-internal: true + PayloadTemplate: + type: object + properties: + template: + type: string + required: + - template + PayloadTemplateRequest: + type: object + properties: + template: + type: string + minLength: 1 + required: + - template ROI: type: object description: Mixin for serializers to handle data in the StrictBaseModel format @@ -1522,6 +1537,9 @@ components: maxLength: 200 include_image: type: boolean + payload_template: + allOf: + - $ref: '#/components/schemas/PayloadTemplate' nullable: true required: - url @@ -1535,6 +1553,10 @@ components: maxLength: 200 include_image: type: boolean + payload_template: + allOf: + - $ref: '#/components/schemas/PayloadTemplateRequest' + nullable: true required: - url BinaryClassificationResult: @@ -1606,7 +1628,6 @@ components: - ALGORITHM label: type: string - nullable: false required: - label TextRecognitionResult: @@ -1628,7 +1649,6 @@ components: - ALGORITHM text: type: string - nullable: true truncated: type: boolean required: @@ -1644,7 +1664,6 @@ components: nullable: false class_name: type: string - nullable: false required: - class_name MultiClassModeConfiguration: @@ -1654,7 +1673,6 @@ components: type: array items: type: string - nullable: false num_classes: type: integer nullable: false diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 071835d1..f0761bbc 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -1004,9 +1004,8 @@ def get_detector_evaluation(self, detector: Union[str, Detector]) -> dict: Get a specific evaluation for a detector :param detector: the detector to get the evaluation for - :param evaluation_id: the evaluation id to get - :return: The DetectorEvaluation object + :return: a dictionary containing the evaluation results """ if isinstance(detector, Detector): detector = detector.id @@ -1019,7 +1018,7 @@ def get_detector_metrics(self, detector: Union[str, Detector]) -> dict: :param detector: the detector to get the metrics for - :return: The DetectorMetrics object + :return: a dictionary containing the metrics for the detector """ if isinstance(detector, Detector): detector = detector.id From 407d0847fb7d1089e173dc2340f2956e7dd5bea8 Mon Sep 17 00:00:00 2001 From: brandon Date: Tue, 25 Feb 2025 11:10:49 -0800 Subject: [PATCH 6/9] mark test as slow --- test/unit/test_metrics_and_evaluation.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/unit/test_metrics_and_evaluation.py b/test/unit/test_metrics_and_evaluation.py index 3d05b100..0471175e 100644 --- a/test/unit/test_metrics_and_evaluation.py +++ b/test/unit/test_metrics_and_evaluation.py @@ -1,12 +1,15 @@ from datetime import datetime +import time -from groundlight import ExperimentalApi +import pytest +from groundlight import ExperimentalApi +@pytest.mark.skip(reason="Slow") def test_metrics_and_evaluation(gl_experimental: ExperimentalApi): name = f"Test metrics and evaluation {datetime.utcnow()}" det = gl_experimental.create_detector(name, "test_query") - for i in range(6): + for i in range(10): iq = gl_experimental.submit_image_query( det, "test/assets/cat.jpeg", wait=0, patience_time=10, human_review="NEVER" ) @@ -15,6 +18,9 @@ def test_metrics_and_evaluation(gl_experimental: ExperimentalApi): det, "test/assets/cat.jpeg", wait=0, patience_time=10, human_review="NEVER" ) gl_experimental.add_label(iq, "NO") + + time.sleep(120) # Wait for the metrics to be updated + metrics = gl_experimental.get_detector_metrics(det.id) assert metrics["summary"] is not None assert metrics["summary"]["num_ground_truth"] is not None From 373754631bfa032dd170ee3255bebb3c7204962d Mon Sep 17 00:00:00 2001 From: Auto-format Bot Date: Tue, 25 Feb 2025 19:11:41 +0000 Subject: [PATCH 7/9] Automatically reformatting code --- test/unit/test_metrics_and_evaluation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/test_metrics_and_evaluation.py b/test/unit/test_metrics_and_evaluation.py index 0471175e..99924aa7 100644 --- a/test/unit/test_metrics_and_evaluation.py +++ b/test/unit/test_metrics_and_evaluation.py @@ -1,10 +1,10 @@ -from datetime import datetime import time +from datetime import datetime import pytest - from groundlight import ExperimentalApi + @pytest.mark.skip(reason="Slow") def test_metrics_and_evaluation(gl_experimental: ExperimentalApi): name = f"Test metrics and evaluation {datetime.utcnow()}" From 629cdf034003bd43bed4123ba4f0125b27c728eb Mon Sep 17 00:00:00 2001 From: brandon Date: Tue, 25 Feb 2025 11:14:36 -0800 Subject: [PATCH 8/9] sort imports --- test/unit/test_metrics_and_evaluation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/test_metrics_and_evaluation.py b/test/unit/test_metrics_and_evaluation.py index 99924aa7..b61510e4 100644 --- a/test/unit/test_metrics_and_evaluation.py +++ b/test/unit/test_metrics_and_evaluation.py @@ -1,7 +1,7 @@ import time from datetime import datetime - import pytest + from groundlight import ExperimentalApi From 50442f85f59cff83a1cfee7a0de5ac7ff382a0c4 Mon Sep 17 00:00:00 2001 From: Auto-format Bot Date: Tue, 25 Feb 2025 19:15:24 +0000 Subject: [PATCH 9/9] Automatically reformatting code --- test/unit/test_metrics_and_evaluation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/test_metrics_and_evaluation.py b/test/unit/test_metrics_and_evaluation.py index b61510e4..99924aa7 100644 --- a/test/unit/test_metrics_and_evaluation.py +++ b/test/unit/test_metrics_and_evaluation.py @@ -1,7 +1,7 @@ import time from datetime import datetime -import pytest +import pytest from groundlight import ExperimentalApi