You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add PrimingGroup and MLPipeline SDK methods (#420)
## Summary
Adds SDK methods for the new PrimingGroup public API. Priming Groups are
groupings of detectors that share a common semantic query and can
utilize a common base model. In the future, priming groups may allow for
cross detector learning and other multi-task and meta-learning
techniques.
In introducing priming groups, we also expose MLPipelines. Every
detector has one active MLPipeline but constantly runs multiple
MLPipelines under the hood that are compared against the top performing
active model. Whenever Groundlight determines that there is a better
performing model, we will switch that model to be the active model.
Currently, a priming group can be created from an existing and trained
MLPipeline, which one can get given an active detector. The new
PrimingGroup will use a frozen version of the MLPipeline for the first
inference on a new detector created using the PrimingGroups. If shadow
pipelines are disallowed on the PrimingGroup, that frozen model will be
used indefinitely by the detector. Otherwise, the frozen model will be
used until one of the other MLPipelines on the detector is evaluated to
be a better fit.
We add the following methods in this PR
- `list_detector_pipelines(detector)` — list all MLPipelines for a
detector
- `create_priming_group(name, source_ml_pipeline_id, ...)` — create a
PrimingGroup seeded from an existing trained model
- `list_priming_groups()` — list all priming groups owned by this
account
- `get_priming_group(priming_group_id)` — retrieve by ID
- `delete_priming_group(priming_group_id)` — soft-delete
We also add new pydantic models: `MLPipeline`, `PrimingGroup` in
`generated/model.py`.
## Usage
\`\`\`python
gl = Groundlight()
pipelines = gl.list_detector_pipelines(detector)
active = next(p for p in pipelines if p.is_active_pipeline)
pg = gl.create_priming_group(
name="door-detector-primer",
source_ml_pipeline_id=active.id,
canonical_query="Is the door open?",
disable_shadow_pipelines=True,
)
new_detector = gl.create_detector(
name="new-door-detector",
query="Is the door open?",
priming_group_id=pg.id,
)
\`\`\`
---------
Co-authored-by: Auto-format Bot <autoformatbot@groundlight.ai>
Co-authored-by: brandon <brandon@axon.com>
@@ -401,6 +402,99 @@ Name | Type | Description | Notes
401
402
-**Accept**: application/json
402
403
403
404
405
+
### HTTP response details
406
+
407
+
| Status code | Description | Response headers |
408
+
|-------------|-------------|------------------|
409
+
**200** | | - |
410
+
411
+
[[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)
**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]
18
+
19
+
[[Back to Model list]](../README.md#documentation-for-models)[[Back to API list]](../README.md#documentation-for-api-endpoints)[[Back to README]](../README.md)
**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]
12
+
13
+
[[Back to Model list]](../README.md#documentation-for-models)[[Back to API list]](../README.md#documentation-for-api-endpoints)[[Back to README]](../README.md)
**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]
12
+
13
+
[[Back to Model list]](../README.md#documentation-for-models)[[Back to API list]](../README.md#documentation-for-api-endpoints)[[Back to README]](../README.md)
**is_global** | **bool** | If True, this priming group is shared to all Groundlight users. Can only be set by Groundlight admins. | [readonly]
11
+
**created_at** | **datetime** | | [readonly]
12
+
**canonical_query** | **str, none_type** | Canonical semantic query for this priming group | [optional]
13
+
**active_pipeline_config** | **str, none_type** | Active pipeline config override for new detectors created in this priming group. If set, this overrides the default active pipeline config at creation time.Can be either a pipeline name or full config string. | [optional]
14
+
**priming_group_specific_shadow_pipeline_configs** | **bool, date, datetime, dict, float, int, list, str, none_type** | Configs for shadow pipelines to create for detectors in this priming group. These are added to the default shadow pipeline configs for a detector of the given mode. Each entry is either a pipeline name or full config string. | [optional]
15
+
**disable_shadow_pipelines** | **bool** | If True, new detectors added to this priming group will not receive the mode-specific default shadow pipelines from INITIAL_SHADOW_PIPELINE_CONFIG_SET. Priming-group-specific shadow configs still apply. Use this to guarantee the primed active MLBinary is never switched off by a shadow pipeline being promoted. | [optional]
16
+
**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]
17
+
18
+
[[Back to Model list]](../README.md#documentation-for-models)[[Back to API list]](../README.md#documentation-for-api-endpoints)[[Back to README]](../README.md)
**disable_shadow_pipelines** | **bool** | If true, new detectors added to this priming group will not receive the default shadow pipelines. This guarantees the primed active model is never switched off. | [optional] if omitted the server will use the default value of False
12
+
**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]
13
+
14
+
[[Back to Model list]](../README.md#documentation-for-models)[[Back to API list]](../README.md#documentation-for-api-endpoints)[[Back to README]](../README.md)
0 commit comments