Merge pull request #4669 from BerriAI/litellm_logging_only_masking

Flag for PII masking on Logging only
This commit is contained in:
Krish Dholakia 2024-07-11 22:03:37 -07:00 committed by GitHub
commit 35a17b7d99
11 changed files with 379 additions and 81 deletions

View file

@ -2,7 +2,7 @@
# On success, logs events to Promptlayer
import os
import traceback
from typing import Literal, Optional, Union
from typing import Any, Literal, Optional, Tuple, Union
import dotenv
from pydantic import BaseModel
@ -117,6 +117,18 @@ class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callbac
):
pass
async def async_logging_hook(
self, kwargs: dict, result: Any, call_type: str
) -> Tuple[dict, Any]:
"""For masking logged request/response. Return a modified version of the request/result."""
return kwargs, result
def logging_hook(
self, kwargs: dict, result: Any, call_type: str
) -> Tuple[dict, Any]:
"""For masking logged request/response. Return a modified version of the request/result."""
return kwargs, result
async def async_moderation_hook(
self,
data: dict,