MLOps event

class datarobot.mlops.events.MLOpsEvent

An MLOps Event Object: An object representing an important MLOps activity that happened. For example, health, service issues with the DataRobot deployment or a prediction environment or a particular phase in a long operation (like creation of deployment or processing training data) is completed or errored.

This class allows the client to report such event to the DataRobot service.

Notes

DataRobot backend support lots of events and all these events are categorized into different categories. This class does not yet support ALL events, but we will gradually add support for them

Supported Event Categories:
  • moderation

classmethod report_moderation_event(event_type, timestamp=None, title=None, message=None, deployment_id=None, org_id=None, guard_name=None, metric_name=None)

Reports a moderation event

Parameters:
  • event_type (str) – The type of the moderation event.

  • timestamp (Optional[str]) – The timestamp of the event, datetime, or string in RFC3339 format. If the datetime provided does not have a timezone, DataRobot assumes it is UTC.

  • title (Optional[str]) – The title of the moderation event.

  • message (Optional[str]) – A description of the moderation event.

  • deployment_id (Optional[str]) – The ID of the deployment associated with the event.

  • org_id (Optional[str]) – The ID of the organization associated with the event.

  • guard_name (Optional[str]) – The name or label of the guard.

  • metric_name (Optional[str]) – The name or label of the metric.

Return type:

None

Raises:

ValueError – If event_type is not one of the moderation event types. If fails to create the event.

Examples

>>> from datarobot.mlops.events import MLOpsEvent
>>> MLOpsEvent.report_moderation_event(
...     event_type="moderationMetricCreationError",
...     title="Failed to create moderation metric",
...     message="Maximum number of custom metrics reached",
...     deployment_id="5c939e08962d741e34f609f0",
...     metric_name="Blocked Prompts",
... )