test_moderations_api_logging

This commit is contained in:
Ishaan Jaff 2025-04-28 15:29:02 -07:00
parent 8e2dacaf4f
commit 5a9001f04c

View file

@ -13,8 +13,6 @@ import os
import time
import json
# this file is to test litellm/proxy
sys.path.insert(
0, os.path.abspath("../..")
) # Adds the parent directory to the system path
@ -53,9 +51,9 @@ async def test_moderations_api_logging(model):
custom_logger = TestCustomLogger()
litellm.logging_callback_manager.add_litellm_callback(custom_logger)
input_content = "Hello, how are you?"
response = await litellm.amoderation(
input="Hello, how are you?",
input=input_content,
model=model,
)
@ -72,6 +70,9 @@ async def test_moderations_api_logging(model):
assert standard_logging_payload["custom_llm_provider"] == litellm.LlmProviders.OPENAI.value
# assert the logged input == input
assert standard_logging_payload["messages"][0]["content"] == input_content
# assert the logged response == response user received client side
assert dict(standard_logging_payload["response"]) == response.model_dump()