From ae86862e745572b3a360f4549ce7ee6c4fd5ca5f Mon Sep 17 00:00:00 2001 From: Lucas Sugi Date: Sun, 19 Oct 2025 02:01:14 -0300 Subject: [PATCH] fix: Add function responsible to call precall (#15636) * fix: Add function responsible to call precall * fix: Set correct route_type --- litellm/proxy/common_request_processing.py | 1 + .../proxy/openai_files_endpoints/files_endpoints.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/litellm/proxy/common_request_processing.py b/litellm/proxy/common_request_processing.py index 3f50d4fd056..a256eae0325 100644 --- a/litellm/proxy/common_request_processing.py +++ b/litellm/proxy/common_request_processing.py @@ -297,6 +297,7 @@ class ProxyBaseLLMRequestProcessing: "aretrieve_batch", "alist_batches", "afile_content", + "afile_retrieve", "atext_completion", "acreate_fine_tuning_job", "acancel_fine_tuning_job", diff --git a/litellm/proxy/openai_files_endpoints/files_endpoints.py b/litellm/proxy/openai_files_endpoints/files_endpoints.py index f5de78832bc..c53af3a67fe 100644 --- a/litellm/proxy/openai_files_endpoints/files_endpoints.py +++ b/litellm/proxy/openai_files_endpoints/files_endpoints.py @@ -583,7 +583,6 @@ async def get_file( ``` """ from litellm.proxy.proxy_server import ( - add_litellm_data_to_request, general_settings, proxy_config, proxy_logging_obj, @@ -592,20 +591,27 @@ async def get_file( data: Dict = {} try: + custom_llm_provider = ( provider or get_custom_llm_provider_from_request_query(request=request) or await get_custom_llm_provider_from_request_body(request=request) or "openai" ) + # Include original request and headers in the data - data = await add_litellm_data_to_request( - data=data, + base_llm_response_processor = ProxyBaseLLMRequestProcessing(data=data) + ( + data, + litellm_logging_obj, + ) = await base_llm_response_processor.common_processing_pre_call_logic( request=request, general_settings=general_settings, user_api_key_dict=user_api_key_dict, version=version, + proxy_logging_obj=proxy_logging_obj, proxy_config=proxy_config, + route_type="afile_retrieve", ) ## check if file_id is a litellm managed file