Skip to content

Commit 4e9f371

Browse files
timmarkhuffUbuntu
andauthored
Add edge_pipeline_config parameter to detector creation (#415)
## Summary Adds support for the `edge_pipeline_config` parameter when creating detectors, mirroring the existing `pipeline_config` parameter. This allows callers to specify which pipeline config to use for edge inference instead of always using the mode's default. Corresponds to the backend change in zuuul, PR #6056. ## Changes - Updated `spec/public-api.yaml` with the new `edge_pipeline_config` field on `DetectorCreationInputRequest` - Ran `make generate` to regenerate the OpenAPI client models - Added `edge_pipeline_config` parameter to all detector creation methods in `client.py` and `experimental_api.py`: - `_prep_create_detector` - `create_detector` - `get_or_create_detector` - `create_binary_detector` - `create_counting_detector` - `create_multiclass_detector` - `create_bounding_box_detector` - `create_text_recognition_detector` (ExperimentalApi) ## Testing Tested end-to-end against an eksdev environment running the zuuul branch from #6056: ```python from groundlight import Groundlight gl = Groundlight() det = gl.create_detector( name="edge-config-sdk-test", query="Is this image relevant?", pipeline_config="never-review", edge_pipeline_config="generic-cached-timm-efficientnetv2s-knn", ) print(f"Created detector: {det.id}") # Created detector: det_3AuicidzisgV5ja7fFhenB8RSIL ``` --------- Co-authored-by: Ubuntu <ubuntu@ip-10-45-0-232.us-west-2.compute.internal>
1 parent e69e087 commit 4e9f371

File tree

9 files changed

+70
-6
lines changed

9 files changed

+70
-6
lines changed

generated/docs/DetectorCreationInputRequest.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Name | Type | Description | Notes
1111
**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
1212
**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
1313
**pipeline_config** | **str, none_type** | (Advanced usage) Configuration needed to instantiate a prediction pipeline. | [optional]
14+
**edge_pipeline_config** | **str, none_type** | (Advanced usage) Configuration for the edge inference pipeline. If not specified, the mode&#39;s default edge pipeline is used. | [optional]
1415
**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]
1516
**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 * &#x60;TEXT&#x60; - TEXT * &#x60;BOUNDING_BOX&#x60; - BOUNDING_BOX | [optional]
1617
**mode_configuration** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional]

generated/docs/DetectorsApi.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ with groundlight_openapi_client.ApiClient(configuration) as api_client:
5959
confidence_threshold=0.9,
6060
patience_time=30.0,
6161
pipeline_config="pipeline_config_example",
62+
edge_pipeline_config="edge_pipeline_config_example",
6263
metadata="metadata_example",
6364
mode=None,
6465
mode_configuration=None,

generated/groundlight_openapi_client/model/detector_creation_input_request.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ class DetectorCreationInputRequest(ModelNormal):
9393
("pipeline_config",): {
9494
"max_length": 100,
9595
},
96+
("edge_pipeline_config",): {
97+
"max_length": 100,
98+
},
9699
("metadata",): {
97100
"max_length": 1362,
98101
"min_length": 1,
@@ -145,6 +148,10 @@ def openapi_types():
145148
str,
146149
none_type,
147150
), # noqa: E501
151+
"edge_pipeline_config": (
152+
str,
153+
none_type,
154+
), # noqa: E501
148155
"metadata": (str,), # noqa: E501
149156
"mode": (
150157
bool,
@@ -185,6 +192,7 @@ def discriminator():
185192
"confidence_threshold": "confidence_threshold", # noqa: E501
186193
"patience_time": "patience_time", # noqa: E501
187194
"pipeline_config": "pipeline_config", # noqa: E501
195+
"edge_pipeline_config": "edge_pipeline_config", # noqa: E501
188196
"metadata": "metadata", # noqa: E501
189197
"mode": "mode", # noqa: E501
190198
"mode_configuration": "mode_configuration", # noqa: E501
@@ -239,6 +247,7 @@ def _from_openapi_data(cls, name, query, *args, **kwargs): # noqa: E501
239247
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
240248
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
241249
pipeline_config (str, none_type): (Advanced usage) Configuration needed to instantiate a prediction pipeline.. [optional] # noqa: E501
250+
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
242251
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
243252
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
244253
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
337346
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
338347
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
339348
pipeline_config (str, none_type): (Advanced usage) Configuration needed to instantiate a prediction pipeline.. [optional] # noqa: E501
349+
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
340350
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
341351
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
342352
mode_configuration (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501

generated/model.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: public-api.yaml
3-
# timestamp: 2026-03-10T18:06:07+00:00
3+
# timestamp: 2026-03-14T00:27:37+00:00
44

55
from __future__ import annotations
66

@@ -412,6 +412,13 @@ class DetectorCreationInputRequest(BaseModel):
412412
pipeline_config: Optional[constr(max_length=100)] = Field(
413413
None, description="(Advanced usage) Configuration needed to instantiate a prediction pipeline."
414414
)
415+
edge_pipeline_config: Optional[constr(max_length=100)] = Field(
416+
None,
417+
description=(
418+
"(Advanced usage) Configuration for the edge inference pipeline. If not specified, the mode's default edge"
419+
" pipeline is used."
420+
),
421+
)
415422
metadata: Optional[constr(min_length=1, max_length=1362)] = Field(
416423
None,
417424
description=(

package-lock.json

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/public-api.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,12 @@ components:
10581058
description: (Advanced usage) Configuration needed to instantiate a prediction
10591059
pipeline.
10601060
maxLength: 100
1061+
edge_pipeline_config:
1062+
type: string
1063+
nullable: true
1064+
description: (Advanced usage) Configuration for the edge inference pipeline.
1065+
If not specified, the mode's default edge pipeline is used.
1066+
maxLength: 100
10611067
metadata:
10621068
type: string
10631069
minLength: 1

src/groundlight/client.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ def _prep_create_detector( # noqa: PLR0913 # pylint: disable=too-many-arguments
352352
confidence_threshold: Optional[float] = None,
353353
patience_time: Optional[float] = None,
354354
pipeline_config: Optional[str] = None,
355+
edge_pipeline_config: Optional[str] = None,
355356
metadata: Union[dict, str, None] = None,
356357
priming_group_id: Optional[str] = None,
357358
) -> Detector:
@@ -363,6 +364,7 @@ def _prep_create_detector( # noqa: PLR0913 # pylint: disable=too-many-arguments
363364
name=name,
364365
query=query,
365366
pipeline_config=pipeline_config,
367+
edge_pipeline_config=edge_pipeline_config,
366368
)
367369
if group_name is not None:
368370
detector_creation_input.group_name = group_name
@@ -388,6 +390,7 @@ def create_detector( # noqa: PLR0913
388390
confidence_threshold: Optional[float] = None,
389391
patience_time: Optional[float] = None,
390392
pipeline_config: Optional[str] = None,
393+
edge_pipeline_config: Optional[str] = None,
391394
metadata: Union[dict, str, None] = None,
392395
class_names: Optional[Union[List[str], str]] = None,
393396
priming_group_id: Optional[str] = None,
@@ -441,6 +444,8 @@ def create_detector( # noqa: PLR0913
441444
confident prediction before falling back to human review. Defaults to 30 seconds.
442445
:param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific
443446
prediction pipeline for this detector.
447+
:param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline.
448+
If not specified, the mode's default edge pipeline is used.
444449
:param metadata: A dictionary or JSON string containing custom key/value pairs to associate with
445450
the detector (limited to 1KB). This metadata can be used to store additional
446451
information like location, purpose, or related system IDs. You can retrieve this
@@ -464,6 +469,7 @@ def create_detector( # noqa: PLR0913
464469
confidence_threshold=confidence_threshold,
465470
patience_time=patience_time,
466471
pipeline_config=pipeline_config,
472+
edge_pipeline_config=edge_pipeline_config,
467473
metadata=metadata,
468474
priming_group_id=priming_group_id,
469475
)
@@ -480,6 +486,7 @@ def create_detector( # noqa: PLR0913
480486
confidence_threshold=confidence_threshold,
481487
patience_time=patience_time,
482488
pipeline_config=pipeline_config,
489+
edge_pipeline_config=edge_pipeline_config,
483490
metadata=metadata,
484491
priming_group_id=priming_group_id,
485492
)
@@ -496,6 +503,7 @@ def create_detector( # noqa: PLR0913
496503
confidence_threshold=confidence_threshold,
497504
patience_time=patience_time,
498505
pipeline_config=pipeline_config,
506+
edge_pipeline_config=edge_pipeline_config,
499507
metadata=metadata,
500508
priming_group_id=priming_group_id,
501509
)
@@ -511,6 +519,7 @@ def get_or_create_detector( # noqa: PLR0913
511519
group_name: Optional[str] = None,
512520
confidence_threshold: Optional[float] = None,
513521
pipeline_config: Optional[str] = None,
522+
edge_pipeline_config: Optional[str] = None,
514523
metadata: Union[dict, str, None] = None,
515524
) -> Detector:
516525
"""
@@ -541,6 +550,8 @@ def get_or_create_detector( # noqa: PLR0913
541550
the query may be sent for human review.
542551
:param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific
543552
prediction pipeline for this detector.
553+
:param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline.
554+
If not specified, the mode's default edge pipeline is used.
544555
:param metadata: A dictionary or JSON string containing custom key/value pairs to associate with
545556
the detector (limited to 1KB). This metadata can be used to store additional
546557
information like location, purpose, or related system IDs. You can retrieve this
@@ -567,6 +578,7 @@ def get_or_create_detector( # noqa: PLR0913
567578
group_name=group_name,
568579
confidence_threshold=confidence_threshold,
569580
pipeline_config=pipeline_config,
581+
edge_pipeline_config=edge_pipeline_config,
570582
metadata=metadata,
571583
)
572584

@@ -1566,6 +1578,7 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume
15661578
confidence_threshold: Optional[float] = None,
15671579
patience_time: Optional[float] = None,
15681580
pipeline_config: Optional[str] = None,
1581+
edge_pipeline_config: Optional[str] = None,
15691582
metadata: Union[dict, str, None] = None,
15701583
priming_group_id: Optional[str] = None,
15711584
) -> Detector:
@@ -1602,6 +1615,8 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume
16021615
confident prediction before falling back to human review. Defaults to 30 seconds.
16031616
:param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific
16041617
prediction pipeline for this detector.
1618+
:param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline.
1619+
If not specified, the mode's default edge pipeline is used.
16051620
:param metadata: A dictionary or JSON string containing custom key/value pairs to associate with
16061621
the detector (limited to 1KB). This metadata can be used to store additional
16071622
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
16201635
confidence_threshold=confidence_threshold,
16211636
patience_time=patience_time,
16221637
pipeline_config=pipeline_config,
1638+
edge_pipeline_config=edge_pipeline_config,
16231639
metadata=metadata,
16241640
priming_group_id=priming_group_id,
16251641
)
@@ -1643,6 +1659,7 @@ def create_binary_detector( # noqa: PLR0913 # pylint: disable=too-many-argument
16431659
confidence_threshold: Optional[float] = None,
16441660
patience_time: Optional[float] = None,
16451661
pipeline_config: Optional[str] = None,
1662+
edge_pipeline_config: Optional[str] = None,
16461663
metadata: Union[dict, str, None] = None,
16471664
priming_group_id: Optional[str] = None,
16481665
) -> Detector:
@@ -1671,6 +1688,7 @@ def create_binary_detector( # noqa: PLR0913 # pylint: disable=too-many-argument
16711688
confidence_threshold=confidence_threshold,
16721689
patience_time=patience_time,
16731690
pipeline_config=pipeline_config,
1691+
edge_pipeline_config=edge_pipeline_config,
16741692
metadata=metadata,
16751693
priming_group_id=priming_group_id,
16761694
)
@@ -1687,6 +1705,7 @@ def create_multiclass_detector( # noqa: PLR0913 # pylint: disable=too-many-argu
16871705
confidence_threshold: Optional[float] = None,
16881706
patience_time: Optional[float] = None,
16891707
pipeline_config: Optional[str] = None,
1708+
edge_pipeline_config: Optional[str] = None,
16901709
metadata: Union[dict, str, None] = None,
16911710
priming_group_id: Optional[str] = None,
16921711
) -> Detector:
@@ -1719,6 +1738,8 @@ def create_multiclass_detector( # noqa: PLR0913 # pylint: disable=too-many-argu
17191738
confident prediction before falling back to human review. Defaults to 30 seconds.
17201739
:param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific
17211740
prediction pipeline for this detector.
1741+
:param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline.
1742+
If not specified, the mode's default edge pipeline is used.
17221743
:param metadata: A dictionary or JSON string containing custom key/value pairs to associate with
17231744
the detector (limited to 1KB). This metadata can be used to store additional
17241745
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
17371758
confidence_threshold=confidence_threshold,
17381759
patience_time=patience_time,
17391760
pipeline_config=pipeline_config,
1761+
edge_pipeline_config=edge_pipeline_config,
17401762
metadata=metadata,
17411763
priming_group_id=priming_group_id,
17421764
)
@@ -1757,6 +1779,7 @@ def create_bounding_box_detector( # noqa: PLR0913 # pylint: disable=too-many-ar
17571779
confidence_threshold: Optional[float] = None,
17581780
patience_time: Optional[float] = None,
17591781
pipeline_config: Optional[str] = None,
1782+
edge_pipeline_config: Optional[str] = None,
17601783
metadata: Union[dict, str, None] = None,
17611784
priming_group_id: Optional[str] = None,
17621785
) -> Detector:
@@ -1795,6 +1818,8 @@ def create_bounding_box_detector( # noqa: PLR0913 # pylint: disable=too-many-ar
17951818
confident prediction before falling back to human review. Defaults to 30 seconds.
17961819
:param pipeline_config: Advanced usage only. Configuration string needed to instantiate a specific
17971820
prediction pipeline for this detector.
1821+
:param edge_pipeline_config: Advanced usage only. Configuration for the edge inference pipeline.
1822+
If not specified, the mode's default edge pipeline is used.
17981823
:param metadata: A dictionary or JSON string containing custom key/value pairs to associate with
17991824
the detector (limited to 1KB). This metadata can be used to store additional
18001825
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
18131838
confidence_threshold=confidence_threshold,
18141839
patience_time=patience_time,
18151840
pipeline_config=pipeline_config,
1841+
edge_pipeline_config=edge_pipeline_config,
18161842
metadata=metadata,
18171843
priming_group_id=priming_group_id,
18181844
)

0 commit comments

Comments
 (0)