Skip to content

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]

Update litellm/litellm_core_utils/prompt_templates/common_utils.py

Sameer Kankute7e4ec1000718
diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.py
index 739c3119cc0..f5e3ffdb749 100644
--- a/litellm/litellm_core_utils/prompt_templates/common_utils.py
+++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py
@@ -299,9 +299,7 @@ def _insert_user_continue_message(
while i < len(result_messages):
curr_message = result_messages[i]
inserted_continue_message = False
- if (
- curr_message["role"] == "assistant"
- and _counts_for_alternation(curr_message)
+ if _counts_for_alternation(curr_message) and curr_message["role"] == "assistant":
):
j = i - 1
while j >= 0: