mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
litellm_fix(router): use safe_deep_copy in _get_silent_experiment_kwargs (#20170)
**Regression introduced in:** PR #19544 (feat: add feature to make silent calls) Fixes check_code_and_doc_quality CI failure. Line 1332 used copy.deepcopy(kwargs) which violates ban_copy_deepcopy_kwargs check. kwargs can contain non-serializable objects like OTEL spans. Changed to safe_deep_copy(kwargs) which handles these correctly.
This commit is contained in:
parent
df042f7545
commit
244c80a7de
1 changed files with 4 additions and 2 deletions
|
|
@ -1328,8 +1328,10 @@ class Router:
|
|||
"""
|
||||
Prepare kwargs for a silent experiment by ensuring isolation from the primary call.
|
||||
"""
|
||||
# Copy kwargs to ensure isolation
|
||||
silent_kwargs = copy.deepcopy(kwargs)
|
||||
# Copy kwargs to ensure isolation (use safe_deep_copy to handle non-serializable objects like OTEL spans)
|
||||
from litellm.litellm_core_utils.core_helpers import safe_deep_copy
|
||||
|
||||
silent_kwargs = safe_deep_copy(kwargs)
|
||||
if "metadata" not in silent_kwargs:
|
||||
silent_kwargs["metadata"] = {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue