forked from phoenix/litellm-mirror
fix(llm_guard.py): more logging for llm guard.py
This commit is contained in:
parent
550c9508d3
commit
c4dad3f34f
1 changed files with 18 additions and 1 deletions
|
@ -103,8 +103,25 @@ class _ENTERPRISE_LLMGuard(CustomLogger):
|
||||||
- Use the sanitized prompt returned
|
- Use the sanitized prompt returned
|
||||||
- LLM Guard can handle things like PII Masking, etc.
|
- LLM Guard can handle things like PII Masking, etc.
|
||||||
"""
|
"""
|
||||||
|
self.print_verbose(f"Inside LLM Guard Pre-Call Hook")
|
||||||
|
try:
|
||||||
|
assert call_type in [
|
||||||
|
"completion",
|
||||||
|
"embeddings",
|
||||||
|
"image_generation",
|
||||||
|
"moderation",
|
||||||
|
"audio_transcription",
|
||||||
|
]
|
||||||
|
except Exception as e:
|
||||||
|
self.print_verbose(
|
||||||
|
f"Call Type - {call_type}, not in accepted list - ['completion','embeddings','image_generation','moderation','audio_transcription']"
|
||||||
|
)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
formatted_prompt = get_formatted_prompt(data=data, call_type=call_type) # type: ignore
|
||||||
|
self.print_verbose(f"LLM Guard, formatted_prompt: {formatted_prompt}")
|
||||||
|
return self.moderation_check(text=formatted_prompt)
|
||||||
|
|
||||||
async def async_post_call_streaming_hook(
|
async def async_post_call_streaming_hook(
|
||||||
self, user_api_key_dict: UserAPIKeyAuth, response: str
|
self, user_api_key_dict: UserAPIKeyAuth, response: str
|
||||||
):
|
):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue