The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(headroom): format protected index assignment
jesuse390dfbb6416
diff --git a/litellm/compression/compress.py b/litellm/compression/compress.pyindex 99410a533f9..0af9618382f 100644--- a/litellm/compression/compress.py+++ b/litellm/compression/compress.py@@ -238,7 +238,9 @@ def get_protected_indices(messages: Sequence[Mapping[str, object]]) -> tuple[int"""system_indices: Final = tuple(index for index, msg in enumerate(messages) if msg.get("role", "") == "system")last_user: Final = tuple(index for index, msg in enumerate(messages) if msg.get("role", "") == "user")[-1:]- last_assistant: Final = tuple(index for index, msg in enumerate(messages) if msg.get("role", "") == "assistant")[-1:]+ last_assistant: Final = tuple(index for index, msg in enumerate(messages) if msg.get("role", "") == "assistant")[+ -1:+ ]return tuple(dict.fromkeys(system_indices + last_user + last_assistant + _cached_prefix_indices(messages)))