From 1bda6d35d6941bcaff85cd5fc915d4350508d3a2 Mon Sep 17 00:00:00 2001 From: brandon Date: Fri, 6 Dec 2024 16:57:18 -0800 Subject: [PATCH] Revert "require class_name for count mode detectors" This reverts commit 4ed96940ecac444ff18c28e7afe5c800131c3f0b. --- generated/docs/CountModeConfiguration.md | 1 - generated/docs/ImageQueriesApi.md | 4 +- .../api/image_queries_api.py | 16 +- .../model/count_mode_configuration.py | 14 +- .../model/counting_result.py | 3 - generated/model.py | 5 +- spec/public-api.yaml | 908 +++++++++--------- src/groundlight/experimental_api.py | 5 +- 8 files changed, 453 insertions(+), 503 deletions(-) diff --git a/generated/docs/CountModeConfiguration.md b/generated/docs/CountModeConfiguration.md index 0262ae0a..b576a6d8 100644 --- a/generated/docs/CountModeConfiguration.md +++ b/generated/docs/CountModeConfiguration.md @@ -4,7 +4,6 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**class_name** | **str** | | **max_count** | **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] diff --git a/generated/docs/ImageQueriesApi.md b/generated/docs/ImageQueriesApi.md index 7f39a4da..3d6cd5b8 100644 --- a/generated/docs/ImageQueriesApi.md +++ b/generated/docs/ImageQueriesApi.md @@ -282,7 +282,6 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = image_queries_api.ImageQueriesApi(api_client) detector_id = "detector_id_example" # str | Choose a detector by its ID. - confidence_threshold = 0 # float | The confidence threshold for the image query. (optional) human_review = "human_review_example" # str | If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. (optional) image_query_id = "image_query_id_example" # str | The ID to assign to the created image query. (optional) inspection_id = "inspection_id_example" # str | Associate the image query with an inspection. (optional) @@ -301,7 +300,7 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: # example passing only required values which don't have defaults set # and optional values try: - api_response = api_instance.submit_image_query(detector_id, confidence_threshold=confidence_threshold, human_review=human_review, image_query_id=image_query_id, inspection_id=inspection_id, metadata=metadata, patience_time=patience_time, want_async=want_async, body=body) + api_response = api_instance.submit_image_query(detector_id, human_review=human_review, image_query_id=image_query_id, inspection_id=inspection_id, metadata=metadata, patience_time=patience_time, want_async=want_async, body=body) pprint(api_response) except groundlight_openapi_client.ApiException as e: print("Exception when calling ImageQueriesApi->submit_image_query: %s\n" % e) @@ -313,7 +312,6 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **detector_id** | **str**| Choose a detector by its ID. | - **confidence_threshold** | **float**| The confidence threshold for the image query. | [optional] **human_review** | **str**| If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. | [optional] **image_query_id** | **str**| The ID to assign to the created image query. | [optional] **inspection_id** | **str**| Associate the image query with an inspection. | [optional] diff --git a/generated/groundlight_openapi_client/api/image_queries_api.py b/generated/groundlight_openapi_client/api/image_queries_api.py index cd8d0577..d9925f9d 100644 --- a/generated/groundlight_openapi_client/api/image_queries_api.py +++ b/generated/groundlight_openapi_client/api/image_queries_api.py @@ -170,7 +170,6 @@ def __init__(self, api_client=None): params_map={ "all": [ "detector_id", - "confidence_threshold", "human_review", "image_query_id", "inspection_id", @@ -184,21 +183,13 @@ def __init__(self, api_client=None): ], "nullable": [], "enum": [], - "validation": [ - "confidence_threshold", - ], + "validation": [], }, root_map={ - "validations": { - ("confidence_threshold",): { - "inclusive_maximum": 1, - "inclusive_minimum": 0, - }, - }, + "validations": {}, "allowed_values": {}, "openapi_types": { "detector_id": (str,), - "confidence_threshold": (float,), "human_review": (str,), "image_query_id": (str,), "inspection_id": (str,), @@ -209,7 +200,6 @@ def __init__(self, api_client=None): }, "attribute_map": { "detector_id": "detector_id", - "confidence_threshold": "confidence_threshold", "human_review": "human_review", "image_query_id": "image_query_id", "inspection_id": "inspection_id", @@ -219,7 +209,6 @@ def __init__(self, api_client=None): }, "location_map": { "detector_id": "query", - "confidence_threshold": "query", "human_review": "query", "image_query_id": "query", "inspection_id": "query", @@ -432,7 +421,6 @@ def submit_image_query(self, detector_id, **kwargs): detector_id (str): Choose a detector by its ID. Keyword Args: - confidence_threshold (float): The confidence threshold for the image query.. [optional] human_review (str): If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident.. [optional] image_query_id (str): The ID to assign to the created image query.. [optional] inspection_id (str): Associate the image query with an inspection.. [optional] diff --git a/generated/groundlight_openapi_client/model/count_mode_configuration.py b/generated/groundlight_openapi_client/model/count_mode_configuration.py index 9c2d3be9..25e7539d 100644 --- a/generated/groundlight_openapi_client/model/count_mode_configuration.py +++ b/generated/groundlight_openapi_client/model/count_mode_configuration.py @@ -93,7 +93,6 @@ def openapi_types(): and the value is attribute type. """ return { - "class_name": (str,), # noqa: E501 "max_count": (int,), # noqa: E501 } @@ -102,7 +101,6 @@ def discriminator(): return None attribute_map = { - "class_name": "class_name", # noqa: E501 "max_count": "max_count", # noqa: E501 } @@ -112,12 +110,9 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, class_name, *args, **kwargs): # noqa: E501 + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 """CountModeConfiguration - a model defined in OpenAPI - Args: - class_name (str): - Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be @@ -178,7 +173,6 @@ def _from_openapi_data(cls, class_name, *args, **kwargs): # noqa: E501 self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.class_name = class_name for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map @@ -201,12 +195,9 @@ def _from_openapi_data(cls, class_name, *args, **kwargs): # noqa: E501 ]) @convert_js_args_to_python_args - def __init__(self, class_name, *args, **kwargs): # noqa: E501 + def __init__(self, *args, **kwargs): # noqa: E501 """CountModeConfiguration - a model defined in OpenAPI - Args: - class_name (str): - Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be @@ -265,7 +256,6 @@ def __init__(self, class_name, *args, **kwargs): # noqa: E501 self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.class_name = class_name for var_name, var_value in kwargs.items(): if ( var_name not in self.attribute_map diff --git a/generated/groundlight_openapi_client/model/counting_result.py b/generated/groundlight_openapi_client/model/counting_result.py index 774cabce..1bc61441 100644 --- a/generated/groundlight_openapi_client/model/counting_result.py +++ b/generated/groundlight_openapi_client/model/counting_result.py @@ -64,9 +64,6 @@ class CountingResult(ModelNormal): } validations = { - ("count",): { - "inclusive_minimum": 0, - }, ("confidence",): { "inclusive_maximum": 1.0, "inclusive_minimum": 0.0, diff --git a/generated/model.py b/generated/model.py index dab8884e..a6de6439 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2024-12-07T00:51:02+00:00 +# timestamp: 2024-12-05T21:27:07+00:00 from __future__ import annotations @@ -200,7 +200,7 @@ class BinaryClassificationResult(BaseModel): class CountingResult(BaseModel): confidence: Optional[confloat(ge=0.0, le=1.0)] = None source: Optional[Source] = None - count: conint(ge=0) + count: int greater_than_max: Optional[bool] = None @@ -212,7 +212,6 @@ class MultiClassificationResult(BaseModel): class CountModeConfiguration(BaseModel): max_count: Optional[conint(ge=1, le=50)] = None - class_name: str class MultiClassModeConfiguration(BaseModel): diff --git a/spec/public-api.yaml b/spec/public-api.yaml index c803df06..b227293d 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -2,8 +2,7 @@ openapi: 3.0.3 info: title: Groundlight API version: 0.18.2 - description: - Groundlight makes it simple to understand images. You can easily create + description: Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. contact: @@ -15,136 +14,136 @@ paths: operationId: List detector rules description: List all rules for a detector parameters: - - in: path - name: detector_id - schema: - type: string - required: true + - in: path + name: detector_id + schema: + type: string + required: true tags: - - actions + - actions security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: - $ref: "#/components/schemas/PaginatedRuleList" - description: "" + $ref: '#/components/schemas/PaginatedRuleList' + description: '' post: operationId: Create rule description: Create a new rule for a detector parameters: - - in: path - name: detector_id - schema: - type: string - required: true + - in: path + name: detector_id + schema: + type: string + required: true tags: - - actions + - actions requestBody: content: application/json: schema: - $ref: "#/components/schemas/RuleRequest" + $ref: '#/components/schemas/RuleRequest' application/x-www-form-urlencoded: schema: - $ref: "#/components/schemas/RuleRequest" + $ref: '#/components/schemas/RuleRequest' multipart/form-data: schema: - $ref: "#/components/schemas/RuleRequest" + $ref: '#/components/schemas/RuleRequest' required: true security: - - ApiToken: [] + - ApiToken: [] responses: - "201": + '201': content: application/json: schema: - $ref: "#/components/schemas/Rule" - description: "" + $ref: '#/components/schemas/Rule' + description: '' /v1/actions/rules: get: operationId: List rules description: Lists all rules over all detectors owned by the requester. parameters: - - name: page - required: false - in: query - description: A page number within the paginated result set. - schema: - type: integer - - name: page_size - required: false - in: query - description: Number of results to return per page. - schema: - type: integer + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - name: page_size + required: false + in: query + description: Number of results to return per page. + schema: + type: integer tags: - - actions + - actions security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: - $ref: "#/components/schemas/PaginatedRuleList" - description: "" + $ref: '#/components/schemas/PaginatedRuleList' + description: '' /v1/actions/rules/{id}: get: operationId: Get rule description: Retrieve a rule parameters: - - in: path - name: id - schema: - type: integer - required: true + - in: path + name: id + schema: + type: integer + required: true tags: - - actions + - actions security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: - $ref: "#/components/schemas/Rule" - description: "" + $ref: '#/components/schemas/Rule' + description: '' delete: operationId: Delete rule description: Delete a rule parameters: - - in: path - name: id - schema: - type: integer - required: true + - in: path + name: id + schema: + type: integer + required: true tags: - - actions + - actions security: - - ApiToken: [] + - ApiToken: [] responses: - "204": + '204': description: No response body /v1/detector-groups: get: operationId: Get Detector Groups description: List all detector groups tags: - - detector-groups + - detector-groups security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: type: array items: - $ref: "#/components/schemas/DetectorGroup" - description: "" + $ref: '#/components/schemas/DetectorGroup' + description: '' post: operationId: Create Detector Group description: |- @@ -154,187 +153,187 @@ paths: Required: - name (str) - name of the predictor set tags: - - detector-groups + - detector-groups requestBody: content: application/json: schema: - $ref: "#/components/schemas/DetectorGroupRequest" + $ref: '#/components/schemas/DetectorGroupRequest' application/x-www-form-urlencoded: schema: - $ref: "#/components/schemas/DetectorGroupRequest" + $ref: '#/components/schemas/DetectorGroupRequest' multipart/form-data: schema: - $ref: "#/components/schemas/DetectorGroupRequest" + $ref: '#/components/schemas/DetectorGroupRequest' required: true security: - - ApiToken: [] + - ApiToken: [] responses: - "201": + '201': content: application/json: schema: - $ref: "#/components/schemas/DetectorGroup" - description: "" + $ref: '#/components/schemas/DetectorGroup' + description: '' /v1/detector-reset/{id}: delete: operationId: Reset detector description: Deletes all image queries on the detector parameters: - - in: path - name: id - schema: - type: string - required: true + - in: path + name: id + schema: + type: string + required: true tags: - - detector-reset + - detector-reset security: - - ApiToken: [] + - ApiToken: [] responses: - "204": + '204': description: No response body /v1/detectors: get: operationId: List detectors description: Retrieve a list of detectors. parameters: - - in: query - name: page - schema: - type: integer - description: A page number within the paginated result set. - - in: query - name: page_size - schema: - type: integer - description: Number of items to return per page. + - in: query + name: page + schema: + type: integer + description: A page number within the paginated result set. + - in: query + name: page_size + schema: + type: integer + description: Number of items to return per page. tags: - - detectors + - detectors security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: - $ref: "#/components/schemas/PaginatedDetectorList" - description: "" + $ref: '#/components/schemas/PaginatedDetectorList' + description: '' post: operationId: Create detector description: Create a new detector. tags: - - detectors + - detectors requestBody: content: application/json: schema: - $ref: "#/components/schemas/DetectorCreationInputRequest" + $ref: '#/components/schemas/DetectorCreationInputRequest' required: true security: - - ApiToken: [] + - ApiToken: [] responses: - "201": + '201': content: application/json: schema: - $ref: "#/components/schemas/Detector" - description: "" + $ref: '#/components/schemas/Detector' + description: '' /v1/detectors/{id}: get: operationId: Get detector description: Retrieve a detector by its ID. parameters: - - in: path - name: id - schema: - type: string - description: Choose a detector by its ID. - required: true + - in: path + name: id + schema: + type: string + description: Choose a detector by its ID. + required: true tags: - - detectors + - detectors security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: - $ref: "#/components/schemas/Detector" - description: "" + $ref: '#/components/schemas/Detector' + description: '' patch: operationId: Update detector description: Update a detector parameters: - - in: path - name: id - schema: - type: string - required: true + - in: path + name: id + schema: + type: string + required: true tags: - - detectors + - detectors requestBody: content: application/json: schema: - $ref: "#/components/schemas/PatchedDetectorRequest" + $ref: '#/components/schemas/PatchedDetectorRequest' application/x-www-form-urlencoded: schema: - $ref: "#/components/schemas/PatchedDetectorRequest" + $ref: '#/components/schemas/PatchedDetectorRequest' multipart/form-data: schema: - $ref: "#/components/schemas/PatchedDetectorRequest" + $ref: '#/components/schemas/PatchedDetectorRequest' security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: - $ref: "#/components/schemas/Detector" - description: "" + $ref: '#/components/schemas/Detector' + description: '' delete: operationId: Delete detector description: Delete a detector by its ID. parameters: - - in: path - name: id - schema: - type: string - description: Choose a detector by its ID. - required: true + - in: path + name: id + schema: + type: string + description: Choose a detector by its ID. + required: true tags: - - detectors + - detectors security: - - ApiToken: [] + - ApiToken: [] responses: - "204": + '204': description: No response body /v1/image-queries: get: operationId: List image queries description: Retrieve a list of image-queries. parameters: - - in: query - name: page - schema: - type: integer - description: A page number within the paginated result set. - - in: query - name: page_size - schema: - type: integer - description: Number of items to return per page. + - in: query + name: page + schema: + type: integer + description: A page number within the paginated result set. + - in: query + name: page_size + schema: + type: integer + description: Number of items to return per page. tags: - - image-queries + - image-queries security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: - $ref: "#/components/schemas/PaginatedImageQueryList" - description: "" + $ref: '#/components/schemas/PaginatedImageQueryList' + description: '' post: operationId: Submit image query description: |2 @@ -348,61 +347,51 @@ paths: --data-binary @path/to/filename.jpeg ``` parameters: - - in: query - name: confidence_threshold - schema: - type: number - format: float - minimum: 0 - maximum: 1 - description: The confidence threshold for the image query. - - in: query - name: detector_id - schema: - type: string - description: Choose a detector by its ID. - required: true - - in: query - name: human_review - schema: - type: string - description: |- - If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). - If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. - If set to `NEVER`, never send the image query for human review even if the ML model is not confident. - - in: query - name: image_query_id - schema: - type: string - description: The ID to assign to the created image query. - - in: query - name: inspection_id - schema: - type: string - description: Associate the image query with an inspection. - - in: query - name: metadata - schema: - type: string - description: - A dictionary of custom key/value metadata to associate with the - image query (limited to 1KB). - - in: query - name: patience_time - schema: - type: number - format: float - description: How long to wait for a confident response. - - in: query - name: want_async - schema: - type: string - description: - If "true" then submitting an image query returns immediately - without a result. The result will be computed asynchronously and can be - retrieved later. + - in: query + name: detector_id + schema: + type: string + description: Choose a detector by its ID. + required: true + - in: query + name: human_review + schema: + type: string + description: |- + If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). + If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. + If set to `NEVER`, never send the image query for human review even if the ML model is not confident. + - in: query + name: image_query_id + schema: + type: string + description: The ID to assign to the created image query. + - in: query + name: inspection_id + schema: + type: string + description: Associate the image query with an inspection. + - in: query + name: metadata + schema: + type: string + description: A dictionary of custom key/value metadata to associate with the + image query (limited to 1KB). + - in: query + name: patience_time + schema: + type: number + format: float + description: How long to wait for a confident response. + - in: query + name: want_async + schema: + type: string + description: If "true" then submitting an image query returns immediately + without a result. The result will be computed asynchronously and can be + retrieved later. tags: - - image-queries + - image-queries requestBody: content: image/jpeg: @@ -434,59 +423,59 @@ paths: type: string format: binary security: - - ApiToken: [] + - ApiToken: [] responses: - "201": + '201': content: application/json: schema: - $ref: "#/components/schemas/ImageQuery" - description: "" + $ref: '#/components/schemas/ImageQuery' + description: '' /v1/image-queries/{id}: get: operationId: Get image query description: Retrieve an image-query by its ID. parameters: - - in: path - name: id - schema: - type: string - description: Choose an image query by its ID. - required: true + - in: path + name: id + schema: + type: string + description: Choose an image query by its ID. + required: true tags: - - image-queries + - image-queries security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: - $ref: "#/components/schemas/ImageQuery" - description: "" + $ref: '#/components/schemas/ImageQuery' + description: '' /v1/image-queries/{id}/image: get: operationId: Get image description: Retrieve an image by its ID. parameters: - - in: path - name: id - schema: - type: string - description: Retrieve the image associated with the image query ID. - required: true + - in: path + name: id + schema: + type: string + description: Retrieve the image associated with the image query ID. + required: true tags: - - image-queries + - image-queries security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: image/jpeg: schema: type: string format: binary - description: "" + description: '' /v1/labels: post: operationId: create label @@ -494,38 +483,38 @@ paths: Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. tags: - - labels + - labels requestBody: content: application/json: schema: - $ref: "#/components/schemas/LabelValueRequest" + $ref: '#/components/schemas/LabelValueRequest' application/x-www-form-urlencoded: schema: - $ref: "#/components/schemas/LabelValueRequest" + $ref: '#/components/schemas/LabelValueRequest' multipart/form-data: schema: - $ref: "#/components/schemas/LabelValueRequest" + $ref: '#/components/schemas/LabelValueRequest' required: true security: - - ApiToken: [] + - ApiToken: [] responses: - "201": + '201': content: application/json: schema: - $ref: "#/components/schemas/LabelValue" - description: "" + $ref: '#/components/schemas/LabelValue' + description: '' /v1/me: get: operationId: Who am I description: Retrieve the current user. tags: - - user + - user security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: @@ -534,59 +523,58 @@ paths: username: type: string description: The user's username - description: "" + description: '' /v1/notes: get: operationId: get notes - description: - Get all the notes from a given detector and return the answer in + description: Get all the notes from a given detector and return the answer in lists, one for each note_category parameters: - - in: query - name: detector_id - schema: - type: string - description: the detector whose notes to retrieve - required: true + - in: query + name: detector_id + schema: + type: string + description: the detector whose notes to retrieve + required: true tags: - - notes + - notes security: - - ApiToken: [] + - ApiToken: [] responses: - "200": + '200': content: application/json: schema: - $ref: "#/components/schemas/AllNotes" - description: "" + $ref: '#/components/schemas/AllNotes' + description: '' post: operationId: Create note description: Create a new note parameters: - - in: query - name: detector_id - schema: - type: string - description: the detector to associate the new note with - required: true + - in: query + name: detector_id + schema: + type: string + description: the detector to associate the new note with + required: true tags: - - notes + - notes requestBody: content: application/json: schema: - $ref: "#/components/schemas/NoteRequest" + $ref: '#/components/schemas/NoteRequest' application/x-www-form-urlencoded: schema: - $ref: "#/components/schemas/NoteRequest" + $ref: '#/components/schemas/NoteRequest' multipart/form-data: schema: - $ref: "#/components/schemas/NoteRequest" + $ref: '#/components/schemas/NoteRequest' required: true security: - - ApiToken: [] + - ApiToken: [] responses: - "204": + '204': description: No response body components: schemas: @@ -599,18 +587,18 @@ components: CUSTOMER: type: array items: - $ref: "#/components/schemas/Note" + $ref: '#/components/schemas/Note' GL: type: array items: - $ref: "#/components/schemas/Note" + $ref: '#/components/schemas/Note' required: - - CUSTOMER - - GL + - CUSTOMER + - GL AnnotationsRequestedEnum: enum: - - BINARY_CLASSIFICATION - - BOUNDING_BOXES + - BINARY_CLASSIFICATION + - BOUNDING_BOXES type: string description: |- * `BINARY_CLASSIFICATION` - Binary Classification @@ -640,12 +628,12 @@ components: format: double readOnly: true required: - - bottom - - left - - right - - top - - x - - y + - bottom + - left + - right + - top + - x + - y BBoxGeometryRequest: type: object description: Mixin for serializers to handle data in the StrictBaseModel format @@ -663,35 +651,35 @@ components: type: number format: double required: - - bottom - - left - - right - - top + - bottom + - left + - right + - top BlankEnum: enum: - - "" + - '' Condition: type: object properties: verb: - $ref: "#/components/schemas/VerbEnum" + $ref: '#/components/schemas/VerbEnum' parameters: type: object additionalProperties: {} required: - - parameters - - verb + - parameters + - verb ConditionRequest: type: object properties: verb: - $ref: "#/components/schemas/VerbEnum" + $ref: '#/components/schemas/VerbEnum' parameters: type: object additionalProperties: {} required: - - parameters - - verb + - parameters + - verb Detector: type: object description: Spec for serializing a detector object in the public API. @@ -702,7 +690,7 @@ components: description: A unique ID for this object. type: allOf: - - $ref: "#/components/schemas/DetectorTypeEnum" + - $ref: '#/components/schemas/DetectorTypeEnum' readOnly: true description: The type of this object. created_at: @@ -728,8 +716,7 @@ components: maximum: 1.0 minimum: 0.0 default: 0.9 - description: - If the detector's prediction is below this confidence threshold, + description: If the detector's prediction is below this confidence threshold, send the image query for human review. patience_time: type: number @@ -746,7 +733,7 @@ components: description: Metadata about the detector. mode: allOf: - - $ref: "#/components/schemas/ModeEnum" + - $ref: '#/components/schemas/ModeEnum' readOnly: true mode_configuration: type: object @@ -755,26 +742,26 @@ components: readOnly: true status: oneOf: - - $ref: "#/components/schemas/StatusEnum" - - $ref: "#/components/schemas/BlankEnum" + - $ref: '#/components/schemas/StatusEnum' + - $ref: '#/components/schemas/BlankEnum' escalation_type: allOf: - - $ref: "#/components/schemas/EscalationTypeEnum" + - $ref: '#/components/schemas/EscalationTypeEnum' description: |- Category that define internal proccess for labeling image queries * `STANDARD` - STANDARD * `NO_HUMAN_LABELING` - NO_HUMAN_LABELING required: - - created_at - - group_name - - id - - metadata - - mode - - mode_configuration - - name - - query - - type + - created_at + - group_name + - id + - metadata + - mode + - mode_configuration + - name + - query + - type x-internal: true DetectorCreationInputRequest: type: object @@ -801,8 +788,7 @@ components: maximum: 1.0 minimum: 0.0 default: 0.9 - description: - If the detector's prediction is below this confidence threshold, + description: If the detector's prediction is below this confidence threshold, send the image query for human review. patience_time: type: number @@ -814,21 +800,19 @@ components: pipeline_config: type: string nullable: true - description: - (Advanced usage) Configuration needed to instantiate a prediction + description: (Advanced usage) Configuration needed to instantiate a prediction pipeline. maxLength: 100 metadata: type: string minLength: 1 - description: - Base64-encoded metadata for the detector. This should be a + description: 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. maxLength: 1362 mode: allOf: - - $ref: "#/components/schemas/ModeEnum" + - $ref: '#/components/schemas/ModeEnum' default: BINARY description: |- Mode in which this detector will work. @@ -838,12 +822,12 @@ components: * `MULTI_CLASS` - MULTI_CLASS mode_configuration: oneOf: - - $ref: "#/components/schemas/CountModeConfiguration" - - $ref: "#/components/schemas/MultiClassModeConfiguration" + - $ref: '#/components/schemas/CountModeConfiguration' + - $ref: '#/components/schemas/MultiClassModeConfiguration' nullable: true required: - - name - - query + - name + - query x-internal: true DetectorGroup: type: object @@ -855,8 +839,8 @@ components: type: string maxLength: 100 required: - - id - - name + - id + - name DetectorGroupRequest: type: object properties: @@ -865,15 +849,15 @@ components: minLength: 1 maxLength: 100 required: - - name + - name DetectorTypeEnum: enum: - - detector + - detector type: string EscalationTypeEnum: enum: - - STANDARD - - NO_HUMAN_LABELING + - STANDARD + - NO_HUMAN_LABELING type: string description: |- * `STANDARD` - STANDARD @@ -894,7 +878,7 @@ components: description: A unique ID for this object. type: allOf: - - $ref: "#/components/schemas/ImageQueryTypeEnum" + - $ref: '#/components/schemas/ImageQueryTypeEnum' readOnly: true description: The type of this object. created_at: @@ -912,14 +896,14 @@ components: description: Which detector was used on this image query? result_type: allOf: - - $ref: "#/components/schemas/ResultTypeEnum" + - $ref: '#/components/schemas/ResultTypeEnum' readOnly: true description: What type of result are we returning? result: oneOf: - - $ref: "#/components/schemas/BinaryClassificationResult" - - $ref: "#/components/schemas/CountingResult" - - $ref: "#/components/schemas/MultiClassificationResult" + - $ref: '#/components/schemas/BinaryClassificationResult' + - $ref: '#/components/schemas/CountingResult' + - $ref: '#/components/schemas/MultiClassificationResult' nullable: true patience_time: type: number @@ -934,11 +918,10 @@ components: rois: type: array items: - $ref: "#/components/schemas/ROI" + $ref: '#/components/schemas/ROI' readOnly: true nullable: true - description: - An array of regions of interest (bounding boxes) collected + description: An array of regions of interest (bounding boxes) collected on image text: type: string @@ -946,22 +929,22 @@ components: readOnly: true description: A text field on image query. required: - - confidence_threshold - - created_at - - detector_id - - id - - metadata - - patience_time - - query - - result - - result_type - - rois - - text - - type + - confidence_threshold + - created_at + - detector_id + - id + - metadata + - patience_time + - query + - result + - result_type + - rois + - text + - type x-internal: true ImageQueryTypeEnum: enum: - - image_query + - image_query type: string LabelValue: type: object @@ -979,13 +962,13 @@ components: rois: type: array items: - $ref: "#/components/schemas/ROI" + $ref: '#/components/schemas/ROI' nullable: true annotations_requested: type: array items: allOf: - - $ref: "#/components/schemas/AnnotationsRequestedEnum" + - $ref: '#/components/schemas/AnnotationsRequestedEnum' description: |- The type of annotation requested @@ -1002,7 +985,7 @@ components: readOnly: true source: allOf: - - $ref: "#/components/schemas/SourceEnum" + - $ref: '#/components/schemas/SourceEnum' readOnly: true text: type: string @@ -1010,13 +993,13 @@ components: nullable: true description: Text annotations required: - - annotations_requested - - class_name - - confidence - - created_at - - detector_id - - source - - text + - annotations_requested + - class_name + - confidence + - created_at + - detector_id + - source + - text LabelValueRequest: type: object properties: @@ -1031,16 +1014,16 @@ components: rois: type: array items: - $ref: "#/components/schemas/ROIRequest" + $ref: '#/components/schemas/ROIRequest' nullable: true required: - - image_query_id - - label + - image_query_id + - label ModeEnum: enum: - - BINARY - - COUNT - - MULTI_CLASS + - BINARY + - COUNT + - MULTI_CLASS type: string Note: type: object @@ -1052,8 +1035,8 @@ components: type: string description: Text content of the note. required: - - content - - detector_id + - content + - detector_id NoteRequest: type: object properties: @@ -1067,12 +1050,12 @@ components: writeOnly: true nullable: true required: - - content + - content PaginatedDetectorList: type: object required: - - count - - results + - count + - results properties: count: type: integer @@ -1090,12 +1073,12 @@ components: results: type: array items: - $ref: "#/components/schemas/Detector" + $ref: '#/components/schemas/Detector' PaginatedImageQueryList: type: object required: - - count - - results + - count + - results properties: count: type: integer @@ -1113,12 +1096,12 @@ components: results: type: array items: - $ref: "#/components/schemas/ImageQuery" + $ref: '#/components/schemas/ImageQuery' PaginatedRuleList: type: object required: - - count - - results + - count + - results properties: count: type: integer @@ -1136,7 +1119,7 @@ components: results: type: array items: - $ref: "#/components/schemas/Rule" + $ref: '#/components/schemas/Rule' PatchedDetectorRequest: type: object description: Spec for serializing a detector object in the public API. @@ -1152,8 +1135,7 @@ components: maximum: 1.0 minimum: 0.0 default: 0.9 - description: - If the detector's prediction is below this confidence threshold, + description: If the detector's prediction is below this confidence threshold, send the image query for human review. patience_time: type: number @@ -1164,11 +1146,11 @@ components: description: How long Groundlight will attempt to generate a confident prediction status: oneOf: - - $ref: "#/components/schemas/StatusEnum" - - $ref: "#/components/schemas/BlankEnum" + - $ref: '#/components/schemas/StatusEnum' + - $ref: '#/components/schemas/BlankEnum' escalation_type: allOf: - - $ref: "#/components/schemas/EscalationTypeEnum" + - $ref: '#/components/schemas/EscalationTypeEnum' description: |- Category that define internal proccess for labeling image queries @@ -1188,11 +1170,11 @@ components: readOnly: true description: The confidence of the bounding box. geometry: - $ref: "#/components/schemas/BBoxGeometry" + $ref: '#/components/schemas/BBoxGeometry' required: - - geometry - - label - - score + - geometry + - label + - score ROIRequest: type: object description: Mixin for serializers to handle data in the StrictBaseModel format @@ -1202,15 +1184,15 @@ components: minLength: 1 description: The label of the bounding box. geometry: - $ref: "#/components/schemas/BBoxGeometryRequest" + $ref: '#/components/schemas/BBoxGeometryRequest' required: - - geometry - - label + - geometry + - label ResultTypeEnum: enum: - - binary_classification - - counting - - multi_classification + - binary_classification + - counting + - multi_classification type: string Rule: type: object @@ -1239,24 +1221,24 @@ components: default: 0 snooze_time_unit: allOf: - - $ref: "#/components/schemas/SnoozeTimeUnitEnum" + - $ref: '#/components/schemas/SnoozeTimeUnitEnum' default: DAYS human_review_required: type: boolean default: false condition: - $ref: "#/components/schemas/Condition" + $ref: '#/components/schemas/Condition' action: oneOf: - - $ref: "#/components/schemas/Action" - - $ref: "#/components/schemas/ActionList" + - $ref: '#/components/schemas/Action' + - $ref: '#/components/schemas/ActionList' required: - - action - - condition - - detector_id - - detector_name - - id - - name + - action + - condition + - detector_id + - detector_name + - id + - name RuleRequest: type: object properties: @@ -1276,27 +1258,27 @@ components: default: 0 snooze_time_unit: allOf: - - $ref: "#/components/schemas/SnoozeTimeUnitEnum" + - $ref: '#/components/schemas/SnoozeTimeUnitEnum' default: DAYS human_review_required: type: boolean default: false condition: - $ref: "#/components/schemas/ConditionRequest" + $ref: '#/components/schemas/ConditionRequest' action: oneOf: - - $ref: "#/components/schemas/Action" - - $ref: "#/components/schemas/ActionList" + - $ref: '#/components/schemas/Action' + - $ref: '#/components/schemas/ActionList' required: - - action - - condition - - name + - action + - condition + - name SnoozeTimeUnitEnum: enum: - - DAYS - - HOURS - - MINUTES - - SECONDS + - DAYS + - HOURS + - MINUTES + - SECONDS type: string description: |- * `DAYS` - DAYS @@ -1305,13 +1287,13 @@ components: * `SECONDS` - SECONDS SourceEnum: enum: - - INITIAL_PLACEHOLDER - - CLOUD - - CUST - - HUMAN_CLOUD_ENSEMBLE - - ALG - - ALG_REC - - ALG_UNCLEAR + - INITIAL_PLACEHOLDER + - CLOUD + - CUST + - HUMAN_CLOUD_ENSEMBLE + - ALG + - ALG_REC + - ALG_UNCLEAR type: string description: |- * `INITIAL_PLACEHOLDER` - InitialPlaceholder @@ -1323,19 +1305,19 @@ components: * `ALG_UNCLEAR` - AlgorithmUnclear StatusEnum: enum: - - "ON" - - "OFF" + - 'ON' + - 'OFF' type: string description: |- * `ON` - ON * `OFF` - OFF VerbEnum: enum: - - ANSWERED_CONSECUTIVELY - - ANSWERED_WITHIN_TIME - - CHANGED_TO - - NO_CHANGE - - NO_QUERIES + - ANSWERED_CONSECUTIVELY + - ANSWERED_WITHIN_TIME + - CHANGED_TO + - NO_CHANGE + - NO_QUERIES type: string description: |- * `ANSWERED_CONSECUTIVELY` - ANSWERED_CONSECUTIVELY @@ -1354,19 +1336,19 @@ components: source: type: string enum: - - STILL_PROCESSING - - CLOUD - - USER - - CLOUD_ENSEMBLE - - ALGORITHM + - STILL_PROCESSING + - CLOUD + - USER + - CLOUD_ENSEMBLE + - ALGORITHM label: type: string enum: - - "YES" - - "NO" - - UNCLEAR + - 'YES' + - 'NO' + - UNCLEAR required: - - label + - label CountingResult: type: object properties: @@ -1378,18 +1360,19 @@ components: source: type: string enum: - - STILL_PROCESSING - - CLOUD - - USER - - CLOUD_ENSEMBLE - - ALGORITHM + - STILL_PROCESSING + - CLOUD + - USER + - CLOUD_ENSEMBLE + - ALGORITHM count: type: integer - minimum: 0 + minimum: null + maximum: null greater_than_max: type: boolean required: - - count + - count MultiClassificationResult: type: object properties: @@ -1401,15 +1384,15 @@ components: source: type: string enum: - - STILL_PROCESSING - - CLOUD - - USER - - CLOUD_ENSEMBLE - - ALGORITHM + - STILL_PROCESSING + - CLOUD + - USER + - CLOUD_ENSEMBLE + - ALGORITHM label: type: string required: - - label + - label CountModeConfiguration: type: object properties: @@ -1417,10 +1400,7 @@ components: type: integer minimum: 1 maximum: 50 - class_name: - type: string - required: - - class_name + required: [] MultiClassModeConfiguration: type: object properties: @@ -1430,41 +1410,43 @@ components: type: string num_classes: type: integer + minimum: null + maximum: null required: - - class_names + - class_names ChannelEnum: type: string enum: - - TEXT - - EMAIL + - TEXT + - EMAIL Action: type: object properties: channel: - $ref: "#/components/schemas/ChannelEnum" + $ref: '#/components/schemas/ChannelEnum' recipient: type: string include_image: type: boolean required: - - channel - - recipient - - include_image + - channel + - recipient + - include_image ActionList: type: array items: - $ref: "#/components/schemas/Action" + $ref: '#/components/schemas/Action' securitySchemes: ApiToken: name: x-api-token type: apiKey in: header servers: - - url: https://api.groundlight.ai/device-api - description: Prod - - url: https://api.integ.groundlight.ai/device-api - description: Integ - - url: https://device.positronix.ai/device-api - description: Device Prod - - url: https://device.integ.positronix.ai/device-api - description: Device Integ +- url: https://api.groundlight.ai/device-api + description: Prod +- url: https://api.integ.groundlight.ai/device-api + description: Integ +- 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 diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index d3d9721c..aac00fa5 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -687,7 +687,6 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume self, name: str, query: str, - class_name: str, *, max_count: Optional[int] = None, group_name: Optional[str] = None, @@ -707,7 +706,6 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume detector = gl.create_counting_detector( name="people_counter", query="How many people are in the image?", - class_name="person", max_count=5, confidence_threshold=0.9, patience_time=30.0 @@ -720,7 +718,6 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume :param name: A short, descriptive name for the detector. :param query: A question about the count of an object in the image. - :param class_name: The class name of the object to count. :param max_count: Maximum number of objects to count (default: 10) :param group_name: Optional name of a group to organize related detectors together. :param confidence_threshold: A value that sets the minimum confidence level required for the ML model's @@ -750,7 +747,7 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume # TODO: pull the BE defined default if max_count is None: max_count = 10 - mode_config = CountModeConfiguration(max_count=max_count, class_name=class_name) + mode_config = CountModeConfiguration(max_count=max_count) 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())