mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
refactor(batch): read the row body without a mutable fallback literal
`(entry.get("body") or {})` counts as mutable-collection construction
(LIT002), and main has since lowered that ceiling. Check the body is a dict
instead; behaviour is unchanged.
This commit is contained in:
parent
8197b319e7
commit
c8c9ef2690
1 changed files with 4 additions and 1 deletions
|
|
@ -981,7 +981,10 @@ class _PROXY_BatchRateLimiter(CustomLogger):
|
|||
# estimate; floor it there again so a row carrying a
|
||||
# large base64 audio payload cannot slide the batch
|
||||
# under the TPM limit.
|
||||
if messages_contain_input_audio_content_blocks((entry.get("body") or {}).get("messages")):
|
||||
entry_body = entry.get("body") if isinstance(entry, dict) else None
|
||||
if isinstance(entry_body, dict) and messages_contain_input_audio_content_blocks(
|
||||
entry_body.get("messages")
|
||||
):
|
||||
entry_total_tokens = max(entry_total_tokens, _estimate_batch_entry_tokens(raw_line))
|
||||
except Exception:
|
||||
entry_total_tokens = _estimate_batch_entry_tokens(raw_line)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue