feat(litellm_logging.py): support logging model price information to s3 logs

This commit is contained in:
Krrish Dholakia 2024-08-16 16:21:34 -07:00
parent 9c3124c5a7
commit 178139f18d
9 changed files with 97 additions and 26 deletions

View file

@ -1171,7 +1171,8 @@ def test_turn_off_message_logging():
##### VALID JSON ######
def test_standard_logging_payload():
@pytest.mark.parametrize("model", ["gpt-3.5-turbo", "azure/chatgpt-v-2"])
def test_standard_logging_payload(model):
"""
Ensure valid standard_logging_payload is passed for logging calls to s3
@ -1187,9 +1188,9 @@ def test_standard_logging_payload():
customHandler, "log_success_event", new=MagicMock()
) as mock_client:
_ = litellm.completion(
model="gpt-3.5-turbo",
model=model,
messages=[{"role": "user", "content": "Hey, how's it going?"}],
mock_response="Going well!",
# mock_response="Going well!",
)
time.sleep(2)
@ -1226,3 +1227,9 @@ def test_standard_logging_payload():
]
> 0
)
assert (
mock_client.call_args.kwargs["kwargs"]["standard_logging_object"][
"model_map_information"
]["model_map_value"]
is not None
)