datarobot-moderations 11.1.13__py3-none-any.whl → 11.1.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datarobot_dome/async_http_client.py +1 -1
- datarobot_dome/constants.py +2 -3
- datarobot_dome/drum_integration.py +7 -8
- datarobot_dome/guard_executor.py +17 -7
- {datarobot_moderations-11.1.13.dist-info → datarobot_moderations-11.1.14.dist-info}/METADATA +6 -2
- {datarobot_moderations-11.1.13.dist-info → datarobot_moderations-11.1.14.dist-info}/RECORD +7 -7
- {datarobot_moderations-11.1.13.dist-info → datarobot_moderations-11.1.14.dist-info}/WHEEL +0 -0
|
@@ -230,7 +230,7 @@ class AsyncHTTPClient:
|
|
|
230
230
|
response = await self.session.post(url, json=payload, headers=self.json_headers)
|
|
231
231
|
if response.status != HTTPStatus.ACCEPTED:
|
|
232
232
|
raise Exception(
|
|
233
|
-
f"Error uploading custom metrics: Status Code: {response.
|
|
233
|
+
f"Error uploading custom metrics: Status Code: {response.status}"
|
|
234
234
|
f"Message: {response.text}"
|
|
235
235
|
)
|
|
236
236
|
self._logger.info("Successfully uploaded custom metrics")
|
datarobot_dome/constants.py
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
# https://www.datarobot.com/wp-content/uploads/2021/07/DataRobot-Tool-and-Utility-Agreement.pdf.
|
|
11
11
|
# ---------------------------------------------------------------------------------
|
|
12
12
|
from enum import Enum
|
|
13
|
-
from typing import Self
|
|
14
13
|
|
|
15
14
|
__GUARD_ASSOCIATION_IDS_COLUMN_NAME__ = "datarobot_guard_association_id"
|
|
16
15
|
|
|
@@ -86,11 +85,11 @@ class TargetType(str, Enum):
|
|
|
86
85
|
AGENTIC_WORKFLOW = "agenticworkflow"
|
|
87
86
|
|
|
88
87
|
@staticmethod
|
|
89
|
-
def guards()
|
|
88
|
+
def guards():
|
|
90
89
|
return [TargetType.TEXT_GENERATION, TargetType.AGENTIC_WORKFLOW]
|
|
91
90
|
|
|
92
91
|
@staticmethod
|
|
93
|
-
def vdb()
|
|
92
|
+
def vdb():
|
|
94
93
|
return [TargetType.VECTOR_DATABASE]
|
|
95
94
|
|
|
96
95
|
|
|
@@ -504,11 +504,11 @@ def build_predictions_df_from_completion(data, pipeline, chat_completion):
|
|
|
504
504
|
predictions_df = add_token_count_columns_to_df(
|
|
505
505
|
pipeline, predictions_df, usage=chat_completion.usage
|
|
506
506
|
)
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
chat_completion, AGENTIC_PIPELINE_INTERACTIONS_ATTR, None
|
|
510
|
-
)
|
|
507
|
+
pipeline_interactions = getattr(chat_completion, AGENTIC_PIPELINE_INTERACTIONS_ATTR, None)
|
|
508
|
+
if pipeline_interactions:
|
|
511
509
|
predictions_df[AGENTIC_PIPELINE_INTERACTIONS_ATTR] = pipeline_interactions
|
|
510
|
+
else:
|
|
511
|
+
predictions_df[AGENTIC_PIPELINE_INTERACTIONS_ATTR] = [np.nan] * len(predictions_df)
|
|
512
512
|
|
|
513
513
|
source_object = chat_completion
|
|
514
514
|
elif isinstance(chat_completion, Iterable):
|
|
@@ -549,10 +549,9 @@ def build_predictions_df_from_completion(data, pipeline, chat_completion):
|
|
|
549
549
|
USAGE_ATTR,
|
|
550
550
|
]
|
|
551
551
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
)
|
|
552
|
+
extra_attributes[AGENTIC_PIPELINE_INTERACTIONS_ATTR] = getattr(
|
|
553
|
+
source_object, AGENTIC_PIPELINE_INTERACTIONS_ATTR, None
|
|
554
|
+
)
|
|
556
555
|
return predictions_df, extra_attributes
|
|
557
556
|
|
|
558
557
|
|
datarobot_dome/guard_executor.py
CHANGED
|
@@ -19,6 +19,7 @@ import traceback
|
|
|
19
19
|
import nest_asyncio
|
|
20
20
|
import pandas as pd
|
|
21
21
|
import requests.exceptions
|
|
22
|
+
from opentelemetry import trace
|
|
22
23
|
|
|
23
24
|
from datarobot_dome.constants import AGENTIC_PIPELINE_INTERACTIONS_ATTR
|
|
24
25
|
from datarobot_dome.constants import LOGGER_NAME_PREFIX
|
|
@@ -49,6 +50,8 @@ from datarobot_dome.guard_helpers import get_token_count
|
|
|
49
50
|
from datarobot_dome.guard_helpers import nemo_response_stage_input_formatter
|
|
50
51
|
from datarobot_dome.guard_helpers import nemo_response_stage_output_formatter
|
|
51
52
|
|
|
53
|
+
tracer = trace.get_tracer(__name__)
|
|
54
|
+
|
|
52
55
|
|
|
53
56
|
def get_operator_comparator(comparator): # noqa: PLR0911
|
|
54
57
|
if comparator == GuardOperatorType.GREATER_THAN:
|
|
@@ -96,13 +99,20 @@ class AsyncGuardExecutor:
|
|
|
96
99
|
|
|
97
100
|
async def run_guard(self, guard, copy_df, stage):
|
|
98
101
|
start_time = time.time()
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
self.
|
|
102
|
+
with tracer.start_as_current_span(f"DataRobot Guard: {guard.name}") as span:
|
|
103
|
+
span.set_attribute("datarobot.moderation.guard.name", guard.name)
|
|
104
|
+
span.set_attribute("datarobot.moderation.guard.type", guard.type)
|
|
105
|
+
span.set_attribute("datarobot.moderation.guard.description", guard.description)
|
|
106
|
+
span.set_attribute("datarobot.moderation.guard.stage", stage)
|
|
107
|
+
|
|
108
|
+
executor = getattr(self, self.guard_executor_map[guard.type])
|
|
109
|
+
df = await executor(guard, copy_df, stage)
|
|
110
|
+
end_time = time.time()
|
|
111
|
+
|
|
112
|
+
latency = end_time - start_time
|
|
113
|
+
span.set_attribute("datarobot.moderation.guard.latency", latency)
|
|
114
|
+
if guard.has_latency_custom_metric():
|
|
115
|
+
self.pipeline.report_guard_latency(guard, latency)
|
|
106
116
|
|
|
107
117
|
return df, latency
|
|
108
118
|
|
{datarobot_moderations-11.1.13.dist-info → datarobot_moderations-11.1.14.dist-info}/METADATA
RENAMED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: datarobot-moderations
|
|
3
|
-
Version: 11.1.
|
|
3
|
+
Version: 11.1.14
|
|
4
4
|
Summary: DataRobot Monitoring and Moderation framework
|
|
5
5
|
License: DataRobot Tool and Utility Agreement
|
|
6
6
|
Author: DataRobot
|
|
7
7
|
Author-email: support@datarobot.com
|
|
8
|
-
Requires-Python: >=3.
|
|
8
|
+
Requires-Python: >=3.10,<3.13
|
|
9
9
|
Classifier: License :: Other/Proprietary License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
14
|
Requires-Dist: aiohttp (>=3.9.5)
|
|
13
15
|
Requires-Dist: asyncio (>=3.4.3)
|
|
@@ -28,6 +30,8 @@ Requires-Dist: nemoguardrails (>=0.9.0)
|
|
|
28
30
|
Requires-Dist: nest-asyncio (>=1.6.0)
|
|
29
31
|
Requires-Dist: numpy (>=1.25.0)
|
|
30
32
|
Requires-Dist: openai (>=1.14.3)
|
|
33
|
+
Requires-Dist: opentelemetry-api (>=1.16.0)
|
|
34
|
+
Requires-Dist: opentelemetry-sdk (>=1.16.0)
|
|
31
35
|
Requires-Dist: pandas (>=2.0.3)
|
|
32
36
|
Requires-Dist: ragas (>=0.2.15)
|
|
33
37
|
Requires-Dist: rouge-score (>=0.1.2)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
datarobot_dome/__init__.py,sha256=B5Rx8_CNCNsOpxBbRj27XOXCfRZmvmrAR-NzlzIKnDw,583
|
|
2
|
-
datarobot_dome/async_http_client.py,sha256=
|
|
2
|
+
datarobot_dome/async_http_client.py,sha256=wkB4irwvnchNGzO1bk2C_HWM-GOSB3AUn5TXKl-X0ZI,9649
|
|
3
3
|
datarobot_dome/chat_helper.py,sha256=BzvtUyZSZxzOqq-5a2wQKhHhr2kMlcP1MFrHaDAeD_o,9671
|
|
4
|
-
datarobot_dome/constants.py,sha256=
|
|
5
|
-
datarobot_dome/drum_integration.py,sha256=
|
|
4
|
+
datarobot_dome/constants.py,sha256=vDU7En5Nd1bbfRIr02ReFtzZDqEg4RGCT7gdw3P0LO0,9007
|
|
5
|
+
datarobot_dome/drum_integration.py,sha256=gRn2sQCmRs0RH0tVOdHX6amxGEX1R6WqEtOF2zdBtC4,40693
|
|
6
6
|
datarobot_dome/guard.py,sha256=afcJSSo509aHHvM6nm-QTKzQjuWE7VzgpihenDaAf3w,29921
|
|
7
|
-
datarobot_dome/guard_executor.py,sha256=
|
|
7
|
+
datarobot_dome/guard_executor.py,sha256=9SuefqQRpJ_4fFm62YOPixg0Fi9z-mzR5eMPeknBT2Y,34642
|
|
8
8
|
datarobot_dome/guard_helpers.py,sha256=VkNaoMAWAEggodpl7KmWZTM6H9H6e9Ny3Rl2HBXZnfM,16353
|
|
9
9
|
datarobot_dome/guards/__init__.py,sha256=B5Rx8_CNCNsOpxBbRj27XOXCfRZmvmrAR-NzlzIKnDw,583
|
|
10
10
|
datarobot_dome/guards/guard_llm_mixin.py,sha256=ON-zuVL3xhQmXv0rFkalWrW_Q67Wwya2IQerHO8WkKU,10694
|
|
@@ -18,6 +18,6 @@ datarobot_dome/pipeline/llm_pipeline.py,sha256=fOp_OJnQMDUJH-LKv12kEqli-EqfHjAiS
|
|
|
18
18
|
datarobot_dome/pipeline/pipeline.py,sha256=_pZ_4K2LMnfYCYj_ur9EwJzo3T-pbO6lFYz1O-_3uQ4,16491
|
|
19
19
|
datarobot_dome/pipeline/vdb_pipeline.py,sha256=WTOGn1qe_ZvEcdlvHgeXxl2xTqp7GjfL13c6S-FmAfM,5146
|
|
20
20
|
datarobot_dome/streaming.py,sha256=6nYvh6SoxPRLfO6GGdEoHsQuyLP9oX1lDMe8IeGo4lw,17801
|
|
21
|
-
datarobot_moderations-11.1.
|
|
22
|
-
datarobot_moderations-11.1.
|
|
23
|
-
datarobot_moderations-11.1.
|
|
21
|
+
datarobot_moderations-11.1.14.dist-info/METADATA,sha256=39J7-G34lxk7ULqxroi3K0RekSNmaiCnPW5OvvMzWDk,4827
|
|
22
|
+
datarobot_moderations-11.1.14.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
23
|
+
datarobot_moderations-11.1.14.dist-info/RECORD,,
|
|
File without changes
|