From be17f93fd4b1130bf213873c0505a435d28bf876 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sat, 14 Mar 2026 00:32:11 +0000 Subject: [PATCH 1/2] first pass --- .../docs/DetectorCreationInputRequest.md | 1 + generated/docs/DetectorsApi.md | 1 + .../model/detector_creation_input_request.py | 10 +++++++ generated/model.py | 9 ++++++- package-lock.json | 6 +---- spec/public-api.yaml | 6 +++++ src/groundlight/client.py | 26 +++++++++++++++++++ src/groundlight/experimental_api.py | 4 +++ 8 files changed, 57 insertions(+), 6 deletions(-) diff --git a/generated/docs/DetectorCreationInputRequest.md b/generated/docs/DetectorCreationInputRequest.md index 630aca57..d435afc8 100644 --- a/generated/docs/DetectorCreationInputRequest.md +++ b/generated/docs/DetectorCreationInputRequest.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **confidence_threshold** | **float** | If the detector's prediction is below this confidence threshold, send the image query for human review. | [optional] if omitted the server will use the default value of 0.9 **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] +**edge_pipeline_config** | **str, none_type** | (Advanced usage) Configuration for the edge inference pipeline. If not specified, the mode's default edge pipeline is used. | [optional] **metadata** | **str** | Base64-encoded metadata for the detector. This should be a JSON object with string keys. The size after encoding should not exceed 1362 bytes, corresponding to 1KiB before encoding. | [optional] **mode** | **bool, date, datetime, dict, float, int, list, str, none_type** | Mode in which this detector will work. * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS * `TEXT` - TEXT * `BOUNDING_BOX` - BOUNDING_BOX | [optional] **mode_configuration** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] diff --git a/generated/docs/DetectorsApi.md b/generated/docs/DetectorsApi.md index acd3761b..bd3fde48 100644 --- a/generated/docs/DetectorsApi.md +++ b/generated/docs/DetectorsApi.md @@ -59,6 +59,7 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client: confidence_threshold=0.9, patience_time=30.0, pipeline_config="pipeline_config_example", + edge_pipeline_config="edge_pipeline_config_example", metadata="metadata_example", mode=None, mode_configuration=None, 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 ce1cbcec..8d6997ae 100644 --- a/generated/groundlight_openapi_client/model/detector_creation_input_request.py +++ b/generated/groundlight_openapi_client/model/detector_creation_input_request.py @@ -93,6 +93,9 @@ class DetectorCreationInputRequest(ModelNormal): ("pipeline_config",): { "max_length": 100, }, + ("edge_pipeline_config",): { + "max_length": 100, + }, ("metadata",): { "max_length": 1362, "min_length": 1, @@ -145,6 +148,10 @@ def openapi_types(): str, none_type, ), # noqa: E501 + "edge_pipeline_config": ( + str, + none_type, + ), # noqa: E501 "metadata": (str,), # noqa: E501 "mode": ( bool, @@ -185,6 +192,7 @@ def discriminator(): "confidence_threshold": "confidence_threshold", # noqa: E501 "patience_time": "patience_time", # noqa: E501 "pipeline_config": "pipeline_config", # noqa: E501 + "edge_pipeline_config": "edge_pipeline_config", # noqa: E501 "metadata": "metadata", # noqa: E501 "mode": "mode", # noqa: E501 "mode_configuration": "mode_configuration", # noqa: E501 @@ -239,6 +247,7 @@ def _from_openapi_data(cls, name, query, *args, **kwargs): # noqa: E501 confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501 patience_time (float): How long Groundlight will attempt to generate a confident prediction. [optional] if omitted the server will use the default value of 30.0 # noqa: E501 pipeline_config (str, none_type): (Advanced usage) Configuration needed to instantiate a prediction pipeline.. [optional] # noqa: E501 + edge_pipeline_config (str, none_type): (Advanced usage) Configuration for the edge inference pipeline. If not specified, the mode's default edge pipeline is used.. [optional] # noqa: E501 metadata (str): Base64-encoded metadata for the detector. This should be a JSON object with string keys. The size after encoding should not exceed 1362 bytes, corresponding to 1KiB before encoding.. [optional] # noqa: E501 mode (bool, date, datetime, dict, float, int, list, str, none_type): Mode in which this detector will work. * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS * `TEXT` - TEXT * `BOUNDING_BOX` - BOUNDING_BOX. [optional] # noqa: E501 mode_configuration (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 @@ -337,6 +346,7 @@ def __init__(self, name, query, *args, **kwargs): # noqa: E501 confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501 patience_time (float): How long Groundlight will attempt to generate a confident prediction. [optional] if omitted the server will use the default value of 30.0 # noqa: E501 pipeline_config (str, none_type): (Advanced usage) Configuration needed to instantiate a prediction pipeline.. [optional] # noqa: E501 + edge_pipeline_config (str, none_type): (Advanced usage) Configuration for the edge inference pipeline. If not specified, the mode's default edge pipeline is used.. [optional] # noqa: E501 metadata (str): Base64-encoded metadata for the detector. This should be a JSON object with string keys. The size after encoding should not exceed 1362 bytes, corresponding to 1KiB before encoding.. [optional] # noqa: E501 mode (bool, date, datetime, dict, float, int, list, str, none_type): Mode in which this detector will work. * `BINARY` - BINARY * `COUNT` - COUNT * `MULTI_CLASS` - MULTI_CLASS * `TEXT` - TEXT * `BOUNDING_BOX` - BOUNDING_BOX. [optional] # noqa: E501 mode_configuration (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 diff --git a/generated/model.py b/generated/model.py index 726a0548..70275f95 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2026-03-10T18:06:07+00:00 +# timestamp: 2026-03-14T00:27:37+00:00 from __future__ import annotations @@ -412,6 +412,13 @@ class DetectorCreationInputRequest(BaseModel): pipeline_config: Optional[constr(max_length=100)] = Field( None, description="(Advanced usage) Configuration needed to instantiate a prediction pipeline." ) + edge_pipeline_config: Optional[constr(max_length=100)] = Field( + None, + description=( + "(Advanced usage) Configuration for the edge inference pipeline. If not specified, the mode's default edge" + " pipeline is used." + ), + ) metadata: Optional[constr(min_length=1, max_length=1362)] = Field( None, description=( diff --git a/package-lock.json b/package-lock.json index 51c40fa1..7db9430a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -184,7 +184,6 @@ "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-11.1.6.tgz", "integrity": "sha512-krKwLLcFmeuKDqngG2N/RuZHCs2ycsKcxWIDgcm7i1lf3sQ0iG03ci+DsP/r3FcT/eJDFsIHnKtNta2LIi7PzQ==", "license": "MIT", - "peer": true, "dependencies": { "file-type": "21.0.0", "iterare": "1.2.1", @@ -474,7 +473,6 @@ "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz", "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==", "license": "MIT", - "peer": true, "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.4", @@ -2571,8 +2569,7 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", - "license": "Apache-2.0", - "peer": true + "license": "Apache-2.0" }, "node_modules/rehype-katex": { "version": "7.0.1", @@ -2651,7 +2648,6 @@ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", "license": "Apache-2.0", - "peer": true, "dependencies": { "tslib": "^2.1.0" } diff --git a/spec/public-api.yaml b/spec/public-api.yaml index c60e03b0..a905c1aa 100644 --- a/spec/public-api.yaml +++ b/spec/public-api.yaml @@ -1058,6 +1058,12 @@ components: description: (Advanced usage) Configuration needed to instantiate a prediction pipeline. maxLength: 100 + edge_pipeline_config: + type: string + nullable: true + description: (Advanced usage) Configuration for the edge inference pipeline. + If not specified, the mode's default edge pipeline is used. + maxLength: 100 metadata: type: string minLength: 1 diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 38e9df29..c18ac01f 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -352,6 +352,7 @@ def _prep_create_detector( # noqa: PLR0913 # pylint: disable=too-many-arguments confidence_threshold: Optional[float] = None, patience_time: Optional[float] = None, pipeline_config: Optional[str] = None, + edge_pipeline_config: Optional[str] = None, metadata: Union[dict, str, None] = None, priming_group_id: Optional[str] = None, ) -> Detector: @@ -363,6 +364,7 @@ def _prep_create_detector( # noqa: PLR0913 # pylint: disable=too-many-arguments name=name, query=query, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, ) if group_name is not None: detector_creation_input.group_name = group_name @@ -388,6 +390,7 @@ def create_detector( # noqa: PLR0913 confidence_threshold: Optional[float] = None, patience_time: Optional[float] = None, pipeline_config: Optional[str] = None, + edge_pipeline_config: Optional[str] = None, metadata: Union[dict, str, None] = None, class_names: Optional[Union[List[str], str]] = None, priming_group_id: Optional[str] = None, @@ -441,6 +444,8 @@ def create_detector( # noqa: PLR0913 confident prediction before falling back to human review. Defaults to 30 seconds. :param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific prediction pipeline for this detector. + :param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline. + If not specified, the mode's default edge pipeline is used. :param metadata: A dictionary or JSON string containing custom key/value pairs to associate with the detector (limited to 1KB). This metadata can be used to store additional information like location, purpose, or related system IDs. You can retrieve this @@ -464,6 +469,7 @@ def create_detector( # noqa: PLR0913 confidence_threshold=confidence_threshold, patience_time=patience_time, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, metadata=metadata, priming_group_id=priming_group_id, ) @@ -480,6 +486,7 @@ def create_detector( # noqa: PLR0913 confidence_threshold=confidence_threshold, patience_time=patience_time, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, metadata=metadata, priming_group_id=priming_group_id, ) @@ -496,6 +503,7 @@ def create_detector( # noqa: PLR0913 confidence_threshold=confidence_threshold, patience_time=patience_time, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, metadata=metadata, priming_group_id=priming_group_id, ) @@ -511,6 +519,7 @@ def get_or_create_detector( # noqa: PLR0913 group_name: Optional[str] = None, confidence_threshold: Optional[float] = None, pipeline_config: Optional[str] = None, + edge_pipeline_config: Optional[str] = None, metadata: Union[dict, str, None] = None, ) -> Detector: """ @@ -541,6 +550,8 @@ def get_or_create_detector( # noqa: PLR0913 the query may be sent for human review. :param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific prediction pipeline for this detector. + :param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline. + If not specified, the mode's default edge pipeline is used. :param metadata: A dictionary or JSON string containing custom key/value pairs to associate with the detector (limited to 1KB). This metadata can be used to store additional information like location, purpose, or related system IDs. You can retrieve this @@ -567,6 +578,7 @@ def get_or_create_detector( # noqa: PLR0913 group_name=group_name, confidence_threshold=confidence_threshold, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, metadata=metadata, ) @@ -1566,6 +1578,7 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume confidence_threshold: Optional[float] = None, patience_time: Optional[float] = None, pipeline_config: Optional[str] = None, + edge_pipeline_config: Optional[str] = None, metadata: Union[dict, str, None] = None, priming_group_id: Optional[str] = None, ) -> Detector: @@ -1602,6 +1615,8 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume confident prediction before falling back to human review. Defaults to 30 seconds. :param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific prediction pipeline for this detector. + :param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline. + If not specified, the mode's default edge pipeline is used. :param metadata: A dictionary or JSON string containing custom key/value pairs to associate with the detector (limited to 1KB). This metadata can be used to store additional information like location, purpose, or related system IDs. You can retrieve this @@ -1620,6 +1635,7 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume confidence_threshold=confidence_threshold, patience_time=patience_time, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, metadata=metadata, priming_group_id=priming_group_id, ) @@ -1643,6 +1659,7 @@ def create_binary_detector( # noqa: PLR0913 # pylint: disable=too-many-argument confidence_threshold: Optional[float] = None, patience_time: Optional[float] = None, pipeline_config: Optional[str] = None, + edge_pipeline_config: Optional[str] = None, metadata: Union[dict, str, None] = None, priming_group_id: Optional[str] = None, ) -> Detector: @@ -1671,6 +1688,7 @@ def create_binary_detector( # noqa: PLR0913 # pylint: disable=too-many-argument confidence_threshold=confidence_threshold, patience_time=patience_time, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, metadata=metadata, priming_group_id=priming_group_id, ) @@ -1687,6 +1705,7 @@ def create_multiclass_detector( # noqa: PLR0913 # pylint: disable=too-many-argu confidence_threshold: Optional[float] = None, patience_time: Optional[float] = None, pipeline_config: Optional[str] = None, + edge_pipeline_config: Optional[str] = None, metadata: Union[dict, str, None] = None, priming_group_id: Optional[str] = None, ) -> Detector: @@ -1719,6 +1738,8 @@ def create_multiclass_detector( # noqa: PLR0913 # pylint: disable=too-many-argu confident prediction before falling back to human review. Defaults to 30 seconds. :param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific prediction pipeline for this detector. + :param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline. + If not specified, the mode's default edge pipeline is used. :param metadata: A dictionary or JSON string containing custom key/value pairs to associate with the detector (limited to 1KB). This metadata can be used to store additional information like location, purpose, or related system IDs. You can retrieve this @@ -1737,6 +1758,7 @@ def create_multiclass_detector( # noqa: PLR0913 # pylint: disable=too-many-argu confidence_threshold=confidence_threshold, patience_time=patience_time, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, metadata=metadata, priming_group_id=priming_group_id, ) @@ -1757,6 +1779,7 @@ def create_bounding_box_detector( # noqa: PLR0913 # pylint: disable=too-many-ar confidence_threshold: Optional[float] = None, patience_time: Optional[float] = None, pipeline_config: Optional[str] = None, + edge_pipeline_config: Optional[str] = None, metadata: Union[dict, str, None] = None, priming_group_id: Optional[str] = None, ) -> Detector: @@ -1795,6 +1818,8 @@ def create_bounding_box_detector( # noqa: PLR0913 # pylint: disable=too-many-ar confident prediction before falling back to human review. Defaults to 30 seconds. :param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific prediction pipeline for this detector. + :param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline. + If not specified, the mode's default edge pipeline is used. :param metadata: A dictionary or JSON string containing custom key/value pairs to associate with the detector (limited to 1KB). This metadata can be used to store additional information like location, purpose, or related system IDs. You can retrieve this @@ -1813,6 +1838,7 @@ def create_bounding_box_detector( # noqa: PLR0913 # pylint: disable=too-many-ar confidence_threshold=confidence_threshold, patience_time=patience_time, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, metadata=metadata, priming_group_id=priming_group_id, ) diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index b50d7fb0..67bc6648 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -640,6 +640,7 @@ def create_text_recognition_detector( # noqa: PLR0913 # pylint: disable=too-man confidence_threshold: Optional[float] = None, patience_time: Optional[float] = None, pipeline_config: Optional[str] = None, + edge_pipeline_config: Optional[str] = None, metadata: Union[dict, str, None] = None, priming_group_id: Optional[str] = None, ) -> Detector: @@ -665,6 +666,8 @@ def create_text_recognition_detector( # noqa: PLR0913 # pylint: disable=too-man confident prediction before falling back to human review. Defaults to 30 seconds. :param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific prediction pipeline for this detector. + :param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline. + If not specified, the mode's default edge pipeline is used. :param metadata: A dictionary or JSON string containing custom key/value pairs to associate with the detector (limited to 1KB). This metadata can be used to store additional information like location, purpose, or related system IDs. You can retrieve this @@ -683,6 +686,7 @@ def create_text_recognition_detector( # noqa: PLR0913 # pylint: disable=too-man confidence_threshold=confidence_threshold, patience_time=patience_time, pipeline_config=pipeline_config, + edge_pipeline_config=edge_pipeline_config, metadata=metadata, priming_group_id=priming_group_id, ) From 4170099e119fd16cfec57960b2f6469af00a26c0 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sat, 14 Mar 2026 00:45:55 +0000 Subject: [PATCH 2/2] adding a test --- test/integration/test_groundlight.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/integration/test_groundlight.py b/test/integration/test_groundlight.py index 8f06251a..5d48c1cd 100644 --- a/test/integration/test_groundlight.py +++ b/test/integration/test_groundlight.py @@ -128,6 +128,19 @@ def test_create_detector_with_pipeline_config(gl: Groundlight): assert isinstance(_detector, Detector) +def test_create_detector_with_edge_pipeline_config(gl: Groundlight): + name = f"Test edge-pipeline-config {datetime.utcnow()}" + query = "Is there a dog (edge-config)?" + _detector = gl.create_detector( + name=name, + query=query, + pipeline_config="never-review", + edge_pipeline_config="generic-cached-timm-efficientnetv2s-knn", + ) + assert str(_detector) + assert isinstance(_detector, Detector) + + def test_create_detector_with_confidence_threshold(gl: Groundlight): # "never-review" is a special model that always returns the same result with 100% confidence. # It's useful for testing.