forked from phoenix/litellm-mirror
feat - use safe safe_deep_copy
This commit is contained in:
parent
992c273bf7
commit
c7545be275
1 changed files with 9 additions and 1 deletions
|
@ -64,6 +64,14 @@ def print_verbose(print_statement):
|
||||||
print(f"LiteLLM Proxy: {print_statement}") # noqa
|
print(f"LiteLLM Proxy: {print_statement}") # noqa
|
||||||
|
|
||||||
|
|
||||||
|
def safe_deep_copy(data):
|
||||||
|
if isinstance(data, dict):
|
||||||
|
# remove litellm_parent_otel_span since this is not picklable
|
||||||
|
data.pop("litellm_parent_otel_span", None)
|
||||||
|
new_data = copy.deepcopy(data)
|
||||||
|
return new_data
|
||||||
|
|
||||||
|
|
||||||
def log_to_opentelemetry(func):
|
def log_to_opentelemetry(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
async def wrapper(*args, **kwargs):
|
async def wrapper(*args, **kwargs):
|
||||||
|
@ -312,7 +320,7 @@ class ProxyLogging:
|
||||||
"""
|
"""
|
||||||
Runs the CustomLogger's async_moderation_hook()
|
Runs the CustomLogger's async_moderation_hook()
|
||||||
"""
|
"""
|
||||||
new_data = copy.deepcopy(data)
|
new_data = safe_deep_copy(data)
|
||||||
for callback in litellm.callbacks:
|
for callback in litellm.callbacks:
|
||||||
try:
|
try:
|
||||||
if isinstance(callback, CustomLogger):
|
if isinstance(callback, CustomLogger):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue