mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
Add recursion depth to convert_anyof_null_to_nullable, constants.py. Fix recursive_detector.py raise error state
This commit is contained in:
parent
e7181395ff
commit
1f2bbda11d
7 changed files with 62 additions and 17 deletions
|
@ -1,8 +1,9 @@
|
|||
import json
|
||||
from typing import Any, Union
|
||||
from litellm.constants import DEFAULT_MAX_RECURSE_DEPTH
|
||||
|
||||
|
||||
def safe_dumps(data: Any, max_depth: int = 10) -> str:
|
||||
def safe_dumps(data: Any, max_depth: int = DEFAULT_MAX_RECURSE_DEPTH) -> str:
|
||||
"""
|
||||
Recursively serialize data while detecting circular references.
|
||||
If a circular reference is detected then a marker string is returned.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Any, Dict, Optional, Set
|
||||
from litellm.constants import DEFAULT_MAX_RECURSE_DEPTH
|
||||
|
||||
|
||||
class SensitiveDataMasker:
|
||||
|
@ -39,7 +40,7 @@ class SensitiveDataMasker:
|
|||
return result
|
||||
|
||||
def mask_dict(
|
||||
self, data: Dict[str, Any], depth: int = 0, max_depth: int = 10
|
||||
self, data: Dict[str, Any], depth: int = 0, max_depth: int = DEFAULT_MAX_RECURSE_DEPTH
|
||||
) -> Dict[str, Any]:
|
||||
if depth >= max_depth:
|
||||
return data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue