mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-17 12:17:35 +00:00
fix(adaptive_router/signals): rename 'args' to 'call_args' in _signature
The prevent_key_leaks_in_exceptions CI check forbids '{args}' in
f-strings because it's a common shape for accidental API key leaks
in exception messages. _signature() uses an entirely local variable
named 'args' for tool-call arguments (loop-detection signatures, no
exception path), but the grep is substring-based. Rename to 'call_args'.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
f1da202d9e
commit
37fc6f623b
@@ -179,12 +179,14 @@ def _detect_failure(tool_results: List[Dict[str, Any]]) -> bool:
|
||||
def _signature(call: Dict[str, Any]) -> str:
|
||||
"""Stable signature for loop detection: name + sorted JSON-ish args."""
|
||||
name = call.get("name") or call.get("function", {}).get("name", "")
|
||||
args = call.get("arguments")
|
||||
if args is None:
|
||||
args = call.get("function", {}).get("arguments", "")
|
||||
if isinstance(args, dict):
|
||||
args = ",".join(f"{k}={args[k]}" for k in sorted(args.keys()))
|
||||
return f"{name}({args})"
|
||||
call_args = call.get("arguments")
|
||||
if call_args is None:
|
||||
call_args = call.get("function", {}).get("arguments", "")
|
||||
if isinstance(call_args, dict):
|
||||
call_args = ",".join(
|
||||
f"{k}={call_args[k]}" for k in sorted(call_args.keys())
|
||||
)
|
||||
return f"{name}({call_args})"
|
||||
|
||||
|
||||
def _detect_loop(history: List[str], new_calls: List[Dict[str, Any]]) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user