perf: skip dict copy for non-compression auxiliary calls

_compression_fast_lane_controls unconditionally did body = dict(extra_body)
before the early-return guard. Move the copy below the guard so non-
compression auxiliary calls (vision, title_generation, etc.) return the
original extra_body reference without a shallow copy.
This commit is contained in:
kshitijk4poor
2026-08-28 12:24:21 +05:30
committed by kshitij
parent 1f781365ac
commit 699bfcd026

View File

@@ -8531,9 +8531,9 @@ def _compression_fast_lane_controls(
extra_body: Dict[str, Any],
) -> tuple[int | None, Dict[str, Any]]:
"""Apply the certified compression controls to one resolved route."""
body = dict(extra_body)
if task != "compression" or max_tokens is not None:
return max_tokens, body
return max_tokens, extra_body
body = dict(extra_body)
lane = resolve_compression_fast_lane(
actual_provider,
actual_model,