File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1172,7 +1172,13 @@ def test_turn_off_message_logging():
1172
1172
1173
1173
1174
1174
@pytest .mark .parametrize ("model" , ["gpt-3.5-turbo" , "azure/chatgpt-v-2" ])
1175
- def test_standard_logging_payload (model ):
1175
+ @pytest .mark .parametrize (
1176
+ "turn_off_message_logging" ,
1177
+ [
1178
+ True ,
1179
+ ],
1180
+ ) # False
1181
+ def test_standard_logging_payload (model , turn_off_message_logging ):
1176
1182
"""
1177
1183
Ensure valid standard_logging_payload is passed for logging calls to s3
1178
1184
@@ -1184,6 +1190,8 @@ def test_standard_logging_payload(model):
1184
1190
customHandler = CompletionCustomHandler ()
1185
1191
litellm .callbacks = [customHandler ]
1186
1192
1193
+ litellm .turn_off_message_logging = turn_off_message_logging
1194
+
1187
1195
with patch .object (
1188
1196
customHandler , "log_success_event" , new = MagicMock ()
1189
1197
) as mock_client :
@@ -1237,3 +1245,10 @@ def test_standard_logging_payload(model):
1237
1245
]["model_map_value" ]
1238
1246
is not None
1239
1247
)
1248
+
1249
+ ## turn off message logging
1250
+ slobject : StandardLoggingPayload = mock_client .call_args .kwargs ["kwargs" ][
1251
+ "standard_logging_object"
1252
+ ]
1253
+ if turn_off_message_logging :
1254
+ assert "redacted-by-litellm" == slobject ["messages" ][0 ]["content" ]
You can’t perform that action at this time.
0 commit comments