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(fireworks_ai/): fix global disable flag with transform messages helper (#7847)
Krish Dholakia4b88635372df
diff --git a/litellm/llms/fireworks_ai/chat/transformation.py b/litellm/llms/fireworks_ai/chat/transformation.pyindex ab0555920d2..30de3c3ed08 100644--- a/litellm/llms/fireworks_ai/chat/transformation.py+++ b/litellm/llms/fireworks_ai/chat/transformation.py@@ -143,10 +143,8 @@ class FireworksAIConfig(OpenAIGPTConfig):"""disable_add_transform_inline_image_block = cast(Optional[bool],- litellm_params.get(- "disable_add_transform_inline_image_block",- litellm.disable_add_transform_inline_image_block,- ),+ litellm_params.get("disable_add_transform_inline_image_block")+ or litellm.disable_add_transform_inline_image_block,)for message in messages:if message["role"] == "user":diff --git a/tests/llm_translation/test_fireworks_ai_translation.py b/tests/llm_translation/test_fireworks_ai_translation.pyindex 9a0926abd2a..5e1a1c05120 100644--- a/tests/llm_translation/test_fireworks_ai_translation.py+++ b/tests/llm_translation/test_fireworks_ai_translation.py@@ -196,3 +196,48 @@ def test_global_disable_flag(model, is_disabled, expected_url):)assert result["image_url"] == expected_urllitellm.disable_add_transform_inline_image_block = False # Reset for other tests+++def test_global_disable_flag_with_transform_messages_helper(monkeypatch):+ from openai import OpenAI+ from unittest.mock import patch+ from litellm import completion++ monkeypatch.setattr(litellm, "disable_add_transform_inline_image_block", True)++ client = OpenAI()++ with patch.object(+ client.chat.completions.with_raw_response,+ "create",+ ) as mock_post:+ try:+ completion(+ model="fireworks_ai/accounts/fireworks/models/llama-v3p3-70b-instruct",+ messages=[+ {+ "role": "user",+ "content": [+ {"type": "text", "text": "What's in this image?"},+ {+ "type": "image_url",+ "image_url": {+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"+ },+ },+ ],+ }+ ],+ client=client,+ )+ except Exception as e:+ print(e)++ mock_post.assert_called_once()+ print(mock_post.call_args.kwargs)+ assert (+ "#transform=inline"+ not in mock_post.call_args.kwargs["messages"][0]["content"][1]["image_url"][+ "url"+ ]+ )