Skip to content

Commit

Permalink
Detector groups (#227)
Browse files Browse the repository at this point in the history
* Support for detector groups

* docstring + rerun tests

* Updating after the detector group endpoint fix

---------

Co-authored-by: Auto-format Bot <[email protected]>
  • Loading branch information
brandon-groundlight and Auto-format Bot authored Jul 30, 2024
1 parent a795f4b commit af19a50
Show file tree
Hide file tree
Showing 32 changed files with 3,630 additions and 18 deletions.
6 changes: 6 additions & 0 deletions generated/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ docs/ConditionRequest.md
docs/CountingResult.md
docs/Detector.md
docs/DetectorCreationInputRequest.md
docs/DetectorGroup.md
docs/DetectorGroupRequest.md
docs/DetectorGroupsApi.md
docs/DetectorTypeEnum.md
docs/DetectorsApi.md
docs/ImageQueriesApi.md
Expand All @@ -36,6 +39,7 @@ git_push.sh
groundlight_openapi_client/__init__.py
groundlight_openapi_client/api/__init__.py
groundlight_openapi_client/api/actions_api.py
groundlight_openapi_client/api/detector_groups_api.py
groundlight_openapi_client/api/detectors_api.py
groundlight_openapi_client/api/image_queries_api.py
groundlight_openapi_client/api/notes_api.py
Expand All @@ -55,6 +59,8 @@ groundlight_openapi_client/model/condition_request.py
groundlight_openapi_client/model/counting_result.py
groundlight_openapi_client/model/detector.py
groundlight_openapi_client/model/detector_creation_input_request.py
groundlight_openapi_client/model/detector_group.py
groundlight_openapi_client/model/detector_group_request.py
groundlight_openapi_client/model/detector_type_enum.py
groundlight_openapi_client/model/image_query.py
groundlight_openapi_client/model/image_query_type_enum.py
Expand Down
4 changes: 4 additions & 0 deletions generated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ Class | Method | HTTP request | Description
*ActionsApi* | [**get_rule**](docs/ActionsApi.md#get_rule) | **GET** /v1/actions/rules/{id} |
*ActionsApi* | [**list_detector_rules**](docs/ActionsApi.md#list_detector_rules) | **GET** /v1/actions/detector/{detector_id}/rules |
*ActionsApi* | [**list_rules**](docs/ActionsApi.md#list_rules) | **GET** /v1/actions/rules |
*DetectorGroupsApi* | [**create_detector_group**](docs/DetectorGroupsApi.md#create_detector_group) | **POST** /v1/detector-groups |
*DetectorGroupsApi* | [**get_detector_groups**](docs/DetectorGroupsApi.md#get_detector_groups) | **GET** /v1/detector-groups |
*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} |
Expand All @@ -139,6 +141,8 @@ Class | Method | HTTP request | Description
- [CountingResult](docs/CountingResult.md)
- [Detector](docs/Detector.md)
- [DetectorCreationInputRequest](docs/DetectorCreationInputRequest.md)
- [DetectorGroup](docs/DetectorGroup.md)
- [DetectorGroupRequest](docs/DetectorGroupRequest.md)
- [DetectorTypeEnum](docs/DetectorTypeEnum.md)
- [ImageQuery](docs/ImageQuery.md)
- [ImageQueryTypeEnum](docs/ImageQueryTypeEnum.md)
Expand Down
5 changes: 3 additions & 2 deletions generated/docs/ClassificationResult.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# ClassificationResult

Our classification result. This result can come from the detector, or a human reviewer.

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**confidence** | **float** | |
**label** | **str** | |
**label** | **str** | What is the predicted label? |
**confidence** | **float, none_type** | On a scale of 0 to 1, how confident are we in the predicted label? | [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)
Expand Down
2 changes: 1 addition & 1 deletion generated/docs/DetectorCreationInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Name | Type | Description | Notes
**name** | **str** | A short, descriptive name for the detector. |
**query** | **str** | A question about the image. |
**group_name** | **str** | Which group should this detector be part of? | [optional]
**confidence_threshold** | **float** | If the detector&#39;s prediction is below this confidence threshold, send the image query for human review. | [optional] if omitted the server will use the default value of 0.75
**confidence_threshold** | **float** | If the detector&#39;s prediction is below this confidence threshold, send the image query for human review. | [optional] if omitted the server will use the default value of 0.9
**pipeline_config** | **str, none_type** | (Advanced usage) Configuration to instantiate a specific prediction pipeline. | [optional]
**metadata** | **str, none_type** | A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded as a URL-safe, base64-encoded JSON string. | [optional]
**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]
Expand Down
2 changes: 1 addition & 1 deletion generated/docs/DetectorCreationInputRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Name | Type | Description | Notes
**patience_time** | **float** | How long Groundlight will attempt to generate a confident prediction | [optional] if omitted the server will use the default value of 30.0
**pipeline_config** | **str, none_type** | (Advanced usage) Configuration needed to instantiate a prediction pipeline. | [optional]
**metadata** | **str** | Base64-encoded metadata for the detector. This should be a JSON object with string keys. The size after encoding should not exceed 1362 bytes, corresponding to 1KiB before encoding. | [optional]
**mode** | **bool, date, datetime, dict, float, int, list, str, none_type** | Mode in which this detector will work. * &#x60;BINARY&#x60; - BINARY * &#x60;COUNT&#x60; - COUNT | [optional]
**mode** | **bool, date, datetime, dict, float, int, list, str, none_type** | Mode in which this detector will work. * &#x60;BINARY&#x60; - BINARY * &#x60;COUNT&#x60; - COUNT * &#x60;MULTI_CLASS&#x60; - MULTI_CLASS | [optional]
**mode_configuration** | **bool, date, datetime, dict, float, int, list, str, none_type** | Configuration for each detector mode. | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

Expand Down
13 changes: 13 additions & 0 deletions generated/docs/DetectorGroup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# DetectorGroup


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **str** | | [readonly]
**name** | **str** | |
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


12 changes: 12 additions & 0 deletions generated/docs/DetectorGroupRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DetectorGroupRequest


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | |
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


163 changes: 163 additions & 0 deletions generated/docs/DetectorGroupsApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# groundlight_openapi_client.DetectorGroupsApi

All URIs are relative to *https://api.groundlight.ai/device-api*

Method | HTTP request | Description
------------- | ------------- | -------------
[**create_detector_group**](DetectorGroupsApi.md#create_detector_group) | **POST** /v1/detector-groups |
[**get_detector_groups**](DetectorGroupsApi.md#get_detector_groups) | **GET** /v1/detector-groups |


# **create_detector_group**
> DetectorGroup create_detector_group(detector_group_request)


Create a new detector group POST data: Required: - name (str) - name of the predictor set

### Example

* Api Key Authentication (ApiToken):

```python
import time
import groundlight_openapi_client
from groundlight_openapi_client.api import detector_groups_api
from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest
from groundlight_openapi_client.model.detector_group import DetectorGroup
from pprint import pprint
# Defining the host is optional and defaults to https://api.groundlight.ai/device-api
# See configuration.py for a list of all supported configuration parameters.
configuration = groundlight_openapi_client.Configuration(
host = "https://api.groundlight.ai/device-api"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiToken
configuration.api_key['ApiToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiToken'] = 'Bearer'

# Enter a context with an instance of the API client
with groundlight_openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = detector_groups_api.DetectorGroupsApi(api_client)
detector_group_request = DetectorGroupRequest(
name="name_example",
) # DetectorGroupRequest |

# example passing only required values which don't have defaults set
try:
api_response = api_instance.create_detector_group(detector_group_request)
pprint(api_response)
except groundlight_openapi_client.ApiException as e:
print("Exception when calling DetectorGroupsApi->create_detector_group: %s\n" % e)
```


### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**detector_group_request** | [**DetectorGroupRequest**](DetectorGroupRequest.md)| |

### Return type

[**DetectorGroup**](DetectorGroup.md)

### Authorization

[ApiToken](../README.md#ApiToken)

### HTTP request headers

- **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data
- **Accept**: application/json


### HTTP response details

| Status code | Description | Response headers |
|-------------|-------------|------------------|
**201** | | - |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **get_detector_groups**
> [DetectorGroup] get_detector_groups()


List all detector groups

### Example

* Api Key Authentication (ApiToken):

```python
import time
import groundlight_openapi_client
from groundlight_openapi_client.api import detector_groups_api
from groundlight_openapi_client.model.detector_group import DetectorGroup
from pprint import pprint
# Defining the host is optional and defaults to https://api.groundlight.ai/device-api
# See configuration.py for a list of all supported configuration parameters.
configuration = groundlight_openapi_client.Configuration(
host = "https://api.groundlight.ai/device-api"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiToken
configuration.api_key['ApiToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiToken'] = 'Bearer'

# Enter a context with an instance of the API client
with groundlight_openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = detector_groups_api.DetectorGroupsApi(api_client)

# example, this endpoint has no required or optional parameters
try:
api_response = api_instance.get_detector_groups()
pprint(api_response)
except groundlight_openapi_client.ApiException as e:
print("Exception when calling DetectorGroupsApi->get_detector_groups: %s\n" % e)
```


### Parameters
This endpoint does not need any parameter.

### Return type

[**[DetectorGroup]**](DetectorGroup.md)

### Authorization

[ApiToken](../README.md#ApiToken)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json


### HTTP response details

| Status code | Description | Response headers |
|-------------|-------------|------------------|
**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)

4 changes: 2 additions & 2 deletions generated/docs/ModeEnum.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# ModeEnum

* `BINARY` - BINARY * `COUNT` - COUNT
* `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | * &#x60;BINARY&#x60; - BINARY * &#x60;COUNT&#x60; - COUNT | must be one of ["BINARY", "COUNT", ]
**value** | **str** | * &#x60;BINARY&#x60; - BINARY * &#x60;COUNT&#x60; - COUNT * &#x60;MULTI_CLASS&#x60; - MULTI_CLASS | must be one of ["BINARY", "COUNT", "MULTI_CLASS", ]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
Loading

0 comments on commit af19a50

Please sign in to comment.