fix: use direct attribute access for enforce_openai_completion_token_invariant

Replace getattr() with direct attribute access so CodeQL can trace
the usage of the module-level variable.
This commit is contained in:
Krishna Chaitanya Balusu 2026-04-02 08:50:59 -07:00
parent 9b42f1eb1a
commit 02d55be891

View file

@ -728,7 +728,7 @@ class ChunkProcessor:
# Gate behind litellm.enforce_openai_completion_token_invariant so
# operators who rely on raw backend values can opt out.
if (
getattr(litellm, "enforce_openai_completion_token_invariant", True)
litellm.enforce_openai_completion_token_invariant
and returned_usage.completion_tokens_details is not None
and returned_usage.completion_tokens_details.reasoning_tokens is not None
and returned_usage.completion_tokens_details.reasoning_tokens