mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
feat(lasso): send source.type=litellm for Used By attribution (#33090)
Co-authored-by: Or Gershoni <org@lasso.security>
This commit is contained in:
parent
8936d07be8
commit
78e5c43301
2 changed files with 10 additions and 1 deletions
|
|
@ -772,7 +772,13 @@ class LassoGuardrail(CustomGuardrail):
|
|||
data: Request data (used for conversation_id generation and tools extraction)
|
||||
cache: Cache instance for storing conversation_id (optional for post-call)
|
||||
"""
|
||||
payload: Dict[str, Any] = {"messages": messages, "messageType": message_type}
|
||||
payload: Dict[str, Any] = {
|
||||
"messages": messages,
|
||||
"messageType": message_type,
|
||||
# Drives the "Used By" badge on Lasso Application API Keys: every call from this
|
||||
# integration is attributed as "litellm" on the keys list.
|
||||
"source": {"type": "litellm"},
|
||||
}
|
||||
|
||||
# Add optional parameters if available
|
||||
if self.user_id:
|
||||
|
|
|
|||
|
|
@ -693,6 +693,8 @@ class TestLassoGuardrail:
|
|||
assert prompt_payload["messages"] == messages
|
||||
assert prompt_payload["userId"] == "test-user"
|
||||
assert prompt_payload["sessionId"] == "test-conversation"
|
||||
# Every call is attributed to the "litellm" integration for the "Used By" badge.
|
||||
assert prompt_payload["source"] == {"type": "litellm"}
|
||||
|
||||
# Test COMPLETION payload
|
||||
completion_messages = [{"role": "assistant", "content": "Test response"}]
|
||||
|
|
@ -703,6 +705,7 @@ class TestLassoGuardrail:
|
|||
assert completion_payload["messages"] == completion_messages
|
||||
assert completion_payload["userId"] == "test-user"
|
||||
assert completion_payload["sessionId"] == "test-conversation"
|
||||
assert completion_payload["source"] == {"type": "litellm"}
|
||||
|
||||
def test_header_preparation(self):
|
||||
"""Test header preparation."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue