Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/groundlight/experimental_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,3 +1094,30 @@ def make_generic_api_request( # noqa: PLR0913 # pylint: disable=too-many-argume
auth_settings=["ApiToken"],
_preload_content=False, # This returns the urllib3 response rather than trying any type of processing
)

def update_detector(
self,
detector: Union[str, Detector],
confidence_threshold: Optional[float] = None,
cloud_labeling_active: Optional[bool] = None,
) -> None:
"""
Updates the detector with the given id.

:param detector: The detector to update
:param confidence_threshold: The new confidence threshold for the detector
:param cloud_labeling_active: Whether cloud labeling is active for the detector
"""
if cloud_labeling_active:
escalation_type = "STANDARD"
else:
escalation_type = "NO_HUMAN_LABELING"
if isinstance(detector, Detector):
detector = detector.id
self.detectors_api.update_detector(
detector,
patched_detector_request=PatchedDetectorRequest(
confidence_threshold=confidence_threshold,
escalation_type=escalation_type,
),
)