datarobot-moderations 11.2.7__py3-none-any.whl → 11.2.8__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.
@@ -18,6 +18,7 @@ import time
18
18
  import traceback
19
19
  import uuid
20
20
  from collections.abc import Iterable
21
+ from inspect import signature
21
22
  from typing import Optional
22
23
 
23
24
  import numpy as np
@@ -483,7 +484,15 @@ def run_user_chat_function(completion_create_params, model, pipeline, drum_chat_
483
484
  start_time = time.time()
484
485
 
485
486
  try:
486
- chat_completion = drum_chat_fn(completion_create_params, model, **kwargs)
487
+ # the standard chat hook takes only the first 2 parameters
488
+ # if so, passing in extra (such as headers=headers) will trigger a TypeError
489
+ # same logic is in DRUM PythonModelAdapter.chat()
490
+ chat_fn_params = signature(drum_chat_fn).parameters
491
+ if len(chat_fn_params) > 2:
492
+ chat_completion = drum_chat_fn(completion_create_params, model, **kwargs)
493
+ else:
494
+ _logger.debug("run_user_chat_function: chat hook takes 2 args; kwargs are discarded")
495
+ chat_completion = drum_chat_fn(completion_create_params, model)
487
496
  except Exception as e:
488
497
  _logger.error(f"Failed to execute user chat function: {e}")
489
498
  raise
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datarobot-moderations
3
- Version: 11.2.7
3
+ Version: 11.2.8
4
4
  Summary: DataRobot Monitoring and Moderation framework
5
5
  License: DataRobot Tool and Utility Agreement
6
6
  Author: DataRobot
@@ -2,7 +2,7 @@ datarobot_dome/__init__.py,sha256=B5Rx8_CNCNsOpxBbRj27XOXCfRZmvmrAR-NzlzIKnDw,58
2
2
  datarobot_dome/async_http_client.py,sha256=YVkzSSP7ItOEwEskjH0MAs1kJW0jXfbvJWkF_52K7CE,9863
3
3
  datarobot_dome/chat_helper.py,sha256=BzvtUyZSZxzOqq-5a2wQKhHhr2kMlcP1MFrHaDAeD_o,9671
4
4
  datarobot_dome/constants.py,sha256=jvgpHa3Wh_nZVZmfU-6ab8FHnKNW3KxOPYIIEb_oS6U,10662
5
- datarobot_dome/drum_integration.py,sha256=SLKpK-0pI9Dsi6iMBVhPv_w-SF0rqs2of-OYF3_KSPk,45983
5
+ datarobot_dome/drum_integration.py,sha256=XcQRaUKQWCGCX9WwiViQQnUy4ZGMzS_FKpkVygg3W1M,46511
6
6
  datarobot_dome/guard.py,sha256=xJds9hcbUaS-KD5nC1mn0GiPdBrileFUu6BuTAjDNuY,34668
7
7
  datarobot_dome/guard_executor.py,sha256=ox5_jOHcqMaxaaagIYJJHhCwEI7Wg-rUEiu5rutsfVU,35363
8
8
  datarobot_dome/guard_helpers.py,sha256=jfu8JTWCcxu4WD1MKxeP1n53DeebY3SSuP-t5sWyV1U,17187
@@ -19,6 +19,6 @@ datarobot_dome/pipeline/pipeline.py,sha256=vCcP8dgu4TE-af6wUt7RqD4Xg7MzfwfK8njjC
19
19
  datarobot_dome/pipeline/vdb_pipeline.py,sha256=zt5d_41oJjdT8qOtvpgz-l5uvImwKE9f6pQsAU_TdR4,9866
20
20
  datarobot_dome/runtime.py,sha256=FD8wXOweqoQVzbZMh-mucL66xT2kGxPsJUGAcJBgwxw,1468
21
21
  datarobot_dome/streaming.py,sha256=DkvKEH0yN0aPEWMTAjMFJB3Kx4iLGdjUMQU1pAplbeg,17751
22
- datarobot_moderations-11.2.7.dist-info/METADATA,sha256=RqNHfInWAiYqI346wVcJEwZj2sTvJ3qvC9FXZEEKLAE,4741
23
- datarobot_moderations-11.2.7.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
24
- datarobot_moderations-11.2.7.dist-info/RECORD,,
22
+ datarobot_moderations-11.2.8.dist-info/METADATA,sha256=WDKeoX2WMqkNUzqirtogVxJ4R5ItpPSA33Gp7I1q86c,4741
23
+ datarobot_moderations-11.2.8.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
24
+ datarobot_moderations-11.2.8.dist-info/RECORD,,