forked from phoenix/litellm-mirror
fix(llm_guard.py): await moderation check
This commit is contained in:
parent
d7b502bf64
commit
b5457beba6
1 changed files with 2 additions and 2 deletions
|
@ -73,7 +73,7 @@ class _ENTERPRISE_LLMGuard(CustomLogger):
|
||||||
if redacted_text is not None:
|
if redacted_text is not None:
|
||||||
if (
|
if (
|
||||||
redacted_text.get("is_valid", None) is not None
|
redacted_text.get("is_valid", None) is not None
|
||||||
and redacted_text["is_valid"] == "True"
|
and redacted_text["is_valid"] != True
|
||||||
):
|
):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=400,
|
status_code=400,
|
||||||
|
@ -120,7 +120,7 @@ class _ENTERPRISE_LLMGuard(CustomLogger):
|
||||||
|
|
||||||
formatted_prompt = get_formatted_prompt(data=data, call_type=call_type) # type: ignore
|
formatted_prompt = get_formatted_prompt(data=data, call_type=call_type) # type: ignore
|
||||||
self.print_verbose(f"LLM Guard, formatted_prompt: {formatted_prompt}")
|
self.print_verbose(f"LLM Guard, formatted_prompt: {formatted_prompt}")
|
||||||
return self.moderation_check(text=formatted_prompt)
|
return await 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