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(managed-files): skip rows without file objects
Rithvik Mysore Suresh3596dee1447d
diff --git a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py b/enterprise/litellm_enterprise/proxy/hooks/managed_files.pyindex 8821736d0ff..b8c97dd2bb5 100644--- a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py+++ b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py@@ -382,7 +382,11 @@ class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints):"flat_model_file_ids": {"hasSome": model_object_ids},})- return [OpenAIFileObject(**file_object.file_object) for file_object in file_ids]+ return [+ OpenAIFileObject(**file_object.file_object)+ for file_object in file_ids+ if file_object.file_object is not None+ ]async def check_managed_file_id_access(self, data: Dict, user_api_key_dict: UserAPIKeyAuthdiff --git a/tests/test_litellm/enterprise/proxy/test_managed_files_hook.py b/tests/test_litellm/enterprise/proxy/test_managed_files_hook.pyindex 2580197d6d2..4a4aa7aa5ea 100644--- a/tests/test_litellm/enterprise/proxy/test_managed_files_hook.py+++ b/tests/test_litellm/enterprise/proxy/test_managed_files_hook.py@@ -137,6 +137,23 @@ async def test_should_pass_credentials_to_afile_retrieve():)+async def test_get_user_created_file_ids_skips_rows_without_file_object():+ managed_files = _make_managed_files_instance()+ managed_files.prisma_client.db.litellm_managedfiletable.find_many = AsyncMock(+ return_value=[+ MagicMock(file_object=_make_file_object().model_dump()),+ MagicMock(file_object=None),+ ]+ )++ files = await managed_files.get_user_created_file_ids(+ _make_user_api_key_dict(), ["file-output-abc"]+ )++ assert [file.id for file in files] == ["file-output-abc"]++@pytest.mark.asyncioasync def test_should_fallback_when_no_router():"""