mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
test(guardrails): assert the scanned texts in the serialized tool output cases
Co-authored-by: feng.tsai <fengtsai@berri.ai> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
c63bae89db
commit
f47b978dfc
1 changed files with 9 additions and 0 deletions
|
|
@ -7249,6 +7249,9 @@ async def test_during_call_hook_chat_tool_output_attachment_scans_as_text():
|
|||
)
|
||||
|
||||
mock_post.assert_called_once()
|
||||
sent_body = json.loads(mock_post.call_args.kwargs["data"])
|
||||
sent_texts = [item["text"]["text"] for item in sent_body["content"] if "text" in item]
|
||||
assert tool_output in sent_texts
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
@ -7640,6 +7643,9 @@ async def test_during_call_hook_chat_tool_output_metadata_members_scan_as_text(m
|
|||
)
|
||||
|
||||
mock_post.assert_called_once()
|
||||
sent_body = json.loads(mock_post.call_args.kwargs["data"])
|
||||
sent_texts = [item["text"]["text"] for item in sent_body["content"] if "text" in item]
|
||||
assert json.dumps([member]) in sent_texts
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
@ -7687,6 +7693,9 @@ async def test_during_call_hook_responses_tool_output_metadata_members_scan_as_t
|
|||
)
|
||||
|
||||
mock_post.assert_called_once()
|
||||
sent_body = json.loads(mock_post.call_args.kwargs["data"])
|
||||
sent_texts = [item["text"]["text"] for item in sent_body["content"] if "text" in item]
|
||||
assert any(str(member.get("id", "")) in text or str(member.get("name", "")) in text for text in sent_texts)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue