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]

fix(fal_ai): carry fal response into content errors

kerryeaa6936f13d8
diff --git a/litellm/llms/fal_ai/videos/transformation.py b/litellm/llms/fal_ai/videos/transformation.py
index 597b265fbf9..f3e189c5672 100644
--- a/litellm/llms/fal_ai/videos/transformation.py
+++ b/litellm/llms/fal_ai/videos/transformation.py
@@ -543,6 +543,8 @@ class FalAIVideoConfig(BaseVideoConfig):
status_code=raw_response.status_code,
message=error,
headers=dict(raw_response.headers), # mutable-ok: exception headers require a mutable dictionary
+ request=raw_response.request,
+ response=raw_response,
)
video_url: Final[str] = self._extract_video_url(_response_data(raw_response))
httpx_client: Final[HTTPHandler] = _get_httpx_client()
@@ -559,6 +561,8 @@ class FalAIVideoConfig(BaseVideoConfig):
status_code=raw_response.status_code,
message=error,
headers=dict(raw_response.headers), # mutable-ok: exception headers require a mutable dictionary
+ request=raw_response.request,
+ response=raw_response,
)
video_url: Final[str] = self._extract_video_url(_response_data(raw_response))
async_httpx_client: Final[AsyncHTTPHandler] = get_async_httpx_client(llm_provider=LlmProviders.FAL_AI)
diff --git a/tests/test_litellm/llms/fal_ai/videos/test_fal_ai_video_transformation.py b/tests/test_litellm/llms/fal_ai/videos/test_fal_ai_video_transformation.py
index 570ff883eec..fe3ddc0516c 100644
--- a/tests/test_litellm/llms/fal_ai/videos/test_fal_ai_video_transformation.py
+++ b/tests/test_litellm/llms/fal_ai/videos/test_fal_ai_video_transformation.py
@@ -435,6 +435,7 @@ class TestFalAIVideoTransformation:
assert error.value.status_code == 422
assert "input.reference_image_urls: Failed to download the file" in error.value.message
+ assert "Failed to download the file" in error.value.response.text
def test_content_response_surfaces_string_detail_error(self):
response: Final = httpx.Response(
@@ -448,6 +449,7 @@ class TestFalAIVideoTransformation:
assert error.value.status_code == 400
assert error.value.message == "Request is still in progress"
+ assert "Request is still in progress" in error.value.response.text
@pytest.mark.asyncio
async def test_async_content_response_surfaces_list_detail_error(self):
@@ -469,6 +471,7 @@ class TestFalAIVideoTransformation:
assert error.value.status_code == 422
assert "input.reference_image_urls: Failed to download the file" in error.value.message
+ assert "Failed to download the file" in error.value.response.text
@pytest.mark.asyncio
async def test_async_content_response_surfaces_string_detail_error(self):
@@ -483,6 +486,7 @@ class TestFalAIVideoTransformation:
assert error.value.status_code == 400
assert error.value.message == "Request is still in progress"
+ assert "Request is still in progress" in error.value.response.text
def test_extract_video_url_surfaces_list_detail_error(self):
response: Final = Mock(spec=httpx.Response)