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(managed_files): match provider-format ids against model_object_id and flat_model_file_ids

yassin2f958f218729
diff --git a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py
index d5f75783a62..6496fcf2fd9 100644
--- a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py
+++ b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py
@@ -438,7 +438,7 @@ class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints):
return
managed_object = (
await self.prisma_client.db.litellm_managedobjecttable.find_first(
- where={"unified_object_id": object_id}
+ where={"OR": [{"unified_object_id": object_id}, {"model_object_id": object_id}]}
)
)
if managed_object is None:
@@ -466,7 +466,7 @@ class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints):
return
managed_file = (
await self.prisma_client.db.litellm_managedfiletable.find_first(
- where={"unified_file_id": file_id}
+ where={"OR": [{"unified_file_id": file_id}, {"flat_model_file_ids": {"has": file_id}}]}
)
)
if managed_file is None:
diff --git a/tests/enterprise/litellm_enterprise/proxy/hooks/test_managed_files.py b/tests/enterprise/litellm_enterprise/proxy/hooks/test_managed_files.py
index e3025255518..57394f1cebe 100644
--- a/tests/enterprise/litellm_enterprise/proxy/hooks/test_managed_files.py
+++ b/tests/enterprise/litellm_enterprise/proxy/hooks/test_managed_files.py
@@ -3227,7 +3227,7 @@ async def test_team_b_cannot_access_team_a_provider_format_batch(
assert exc_info.value.status_code == 403
prisma_client.db.litellm_managedobjecttable.find_first.assert_awaited_once_with(
- where={"unified_object_id": batch_id}
+ where={"OR": [{"unified_object_id": batch_id}, {"model_object_id": batch_id}]}
)
@@ -3360,7 +3360,7 @@ async def test_team_b_cannot_access_team_a_provider_format_file(
assert exc_info.value.status_code == 403
prisma_client.db.litellm_managedfiletable.find_first.assert_awaited_once_with(
- where={"unified_file_id": file_id}
+ where={"OR": [{"unified_file_id": file_id}, {"flat_model_file_ids": {"has": file_id}}]}
)