@@ -123,7 +123,7 @@ def _language_predictor_with_mlops_params_dr_api_access(self):
123123
124124 @pytest .fixture
125125 def mock_dr_client (self ):
126- with patch .object (dr , "Client" ) as _ :
126+ with patch .object (dr , "Client" ) as m :
127127 yield
128128
129129 def test_mlops_init (self , language_predictor_with_mlops , mock_mlops ):
@@ -271,7 +271,10 @@ def test_association_id(self, language_predictor_with_mlops, mock_mlops):
271271 mock_chat .assert_called_once_with (ANY , association_id )
272272 hasattr (completion , "datarobot_association_id" )
273273
274- def test_prompt_column_name (self , chat_python_model_adapter , mock_mlops , mock_dr_client ):
274+ @pytest .mark .parametrize ("row_storage_enabled" , [False , True ])
275+ def test_prompt_column_name (
276+ self , chat_python_model_adapter , mock_mlops , mock_dr_client , row_storage_enabled
277+ ):
275278 language_predictor = TestLanguagePredictor ()
276279 language_predictor_with_mlops_params = (
277280 self ._language_predictor_with_mlops_params_dr_api_access ()
@@ -282,6 +285,13 @@ def test_prompt_column_name(self, chat_python_model_adapter, mock_mlops, mock_dr
282285 deployment_instance .return_value .get_champion_model_package .return_value = Mock ()
283286 mock_deployment .get .return_value = deployment_instance
284287
288+ deployment_instance .get_drift_tracking_settings .return_value = {
289+ "target_drift" : {"enabled" : False },
290+ "feature_drift" : {"enabled" : False },
291+ }
292+ deployment_instance .get_predictions_data_collection_settings .return_value = {
293+ "enabled" : row_storage_enabled
294+ }
285295 language_predictor .configure (language_predictor_with_mlops_params )
286296
287297 def chat_hook (completion_request ):
@@ -298,16 +308,19 @@ def chat_hook(completion_request):
298308 }
299309 )
300310
301- mock_mlops .report_predictions_data .assert_called_once_with (
302- ANY ,
303- ["How are you" ],
304- association_ids = ANY ,
305- )
306- # Compare features dataframe separately as this doesn't play nice with assert_called
307- assert (
308- mock_mlops .report_predictions_data .call_args .args [0 ]["newPromptName" ].values [0 ]
309- == "Hello!"
310- )
311+ if row_storage_enabled :
312+ mock_mlops .report_predictions_data .assert_called_once_with (
313+ ANY ,
314+ ["How are you" ],
315+ association_ids = ANY ,
316+ )
317+ # Compare features dataframe separately as this doesn't play nice with assert_called
318+ assert (
319+ mock_mlops .report_predictions_data .call_args .args [0 ]["newPromptName" ].values [0 ]
320+ == "Hello!"
321+ )
322+ else :
323+ mock_mlops .report_predictions_data .assert_not_called ()
311324
312325 @pytest .mark .parametrize ("stream" , [False , True ])
313326 def test_failing_hook_with_mlops (self , language_predictor_with_mlops , mock_mlops , stream ):
0 commit comments