forked from phoenix/litellm-mirror
test_langfuse_masked_input_output
This commit is contained in:
parent
a5df4f1a81
commit
aa051f644b
1 changed files with 6 additions and 17 deletions
|
@ -320,20 +320,9 @@ async def test_langfuse_masked_input_output(langfuse_client):
|
||||||
mock_response="This is a test response",
|
mock_response="This is a test response",
|
||||||
)
|
)
|
||||||
print(response)
|
print(response)
|
||||||
expected_input = (
|
expected_input = "redacted-by-litellm" if mask_value else "This is a test"
|
||||||
"redacted-by-litellm"
|
|
||||||
if mask_value
|
|
||||||
else {"messages": [{"content": "This is a test", "role": "user"}]}
|
|
||||||
)
|
|
||||||
expected_output = (
|
expected_output = (
|
||||||
"redacted-by-litellm"
|
"redacted-by-litellm" if mask_value else "This is a test response"
|
||||||
if mask_value
|
|
||||||
else {
|
|
||||||
"content": "This is a test response",
|
|
||||||
"role": "assistant",
|
|
||||||
"function_call": None,
|
|
||||||
"tool_calls": None,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
langfuse_client.flush()
|
langfuse_client.flush()
|
||||||
await asyncio.sleep(30)
|
await asyncio.sleep(30)
|
||||||
|
@ -345,11 +334,11 @@ async def test_langfuse_masked_input_output(langfuse_client):
|
||||||
reversed(langfuse_client.get_generations(trace_id=_unique_trace_name).data)
|
reversed(langfuse_client.get_generations(trace_id=_unique_trace_name).data)
|
||||||
)
|
)
|
||||||
|
|
||||||
assert trace.input == expected_input
|
assert expected_input in trace.input
|
||||||
assert trace.output == expected_output
|
assert expected_output in trace.output
|
||||||
if len(generations) > 0:
|
if len(generations) > 0:
|
||||||
assert generations[0].input == expected_input
|
assert expected_input in generations[0].input
|
||||||
assert generations[0].output == expected_output
|
assert expected_output in generations[0].output
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue