From a0f1c8a18aa9b9c8d8014e9ea556bda79f3d8412 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 12 Mar 2026 23:51:35 +0000 Subject: [PATCH] fix(mypy): sync route_type Literals, fix BFL params and signatures Task 1: Sync route_type Literal definitions in common_request_processing.py - Make base_process_llm_request and common_processing_pre_call_logic Literals identical - Add missing vector store CRUD route types to base_process_llm_request - Fix data dict type annotation in vector_store_endpoints/endpoints.py Task 2: Add BFL provider-specific params to OpenAIImageGenerationOptionalParams - Add seed, safety_tolerance, prompt_upsampling, raw, num_images, image_url, image_prompt_strength, aspect_ratio Task 3: Fix BFL override signatures to match base class - image_generation: Replace **kwargs with explicit params - image_edit: Make prompt and image Optional to match superclass Co-authored-by: yuneng-jiang --- .../image_edit/transformation.py | 4 +-- .../image_generation/transformation.py | 7 ++++- litellm/proxy/common_request_processing.py | 28 +++++++++++++++++-- .../proxy/vector_store_endpoints/endpoints.py | 2 +- litellm/types/llms/openai.py | 8 ++++++ 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/litellm/llms/black_forest_labs/image_edit/transformation.py b/litellm/llms/black_forest_labs/image_edit/transformation.py index d12a0808d4..63413787c0 100644 --- a/litellm/llms/black_forest_labs/image_edit/transformation.py +++ b/litellm/llms/black_forest_labs/image_edit/transformation.py @@ -230,8 +230,8 @@ class BlackForestLabsImageEditConfig(BaseImageEditConfig): def transform_image_edit_request( self, model: str, - prompt: str, - image: FileTypes, + prompt: Optional[str], + image: Optional[FileTypes], image_edit_optional_request_params: Dict, litellm_params: GenericLiteLLMParams, headers: dict, diff --git a/litellm/llms/black_forest_labs/image_generation/transformation.py b/litellm/llms/black_forest_labs/image_generation/transformation.py index a6ed77f535..18c7c17330 100644 --- a/litellm/llms/black_forest_labs/image_generation/transformation.py +++ b/litellm/llms/black_forest_labs/image_generation/transformation.py @@ -259,7 +259,12 @@ class BlackForestLabsImageGenerationConfig(BaseImageGenerationConfig): raw_response: httpx.Response, model_response: ImageResponse, logging_obj: LiteLLMLoggingObj, - **kwargs, + request_data: dict, + optional_params: dict, + litellm_params: dict, + encoding: Any, + api_key: Optional[str] = None, + json_mode: Optional[bool] = None, ) -> ImageResponse: """ Transform Black Forest Labs response to OpenAI-compatible ImageResponse. diff --git a/litellm/proxy/common_request_processing.py b/litellm/proxy/common_request_processing.py index 7b9e0a4373..41fa437962 100644 --- a/litellm/proxy/common_request_processing.py +++ b/litellm/proxy/common_request_processing.py @@ -530,6 +530,8 @@ class ProxyBaseLLMRequestProcessing: "aresponses", "_arealtime", "_aresponses_websocket", + "acreate_realtime_client_secret", + "arealtime_calls", "aget_responses", "adelete_responses", "acancel_responses", @@ -553,6 +555,10 @@ class ProxyBaseLLMRequestProcessing: "allm_passthrough_route", "avector_store_search", "avector_store_create", + "avector_store_retrieve", + "avector_store_list", + "avector_store_update", + "avector_store_delete", "avector_store_file_create", "avector_store_file_list", "avector_store_file_retrieve", @@ -774,20 +780,36 @@ class ProxyBaseLLMRequestProcessing: "aembedding", "aresponses", "_arealtime", + "_aresponses_websocket", "acreate_realtime_client_secret", "arealtime_calls", "aget_responses", "adelete_responses", "acancel_responses", "acompact_responses", + "acreate_batch", + "aretrieve_batch", + "alist_batches", + "acancel_batch", + "afile_content", + "afile_retrieve", + "afile_delete", "atext_completion", - "aimage_edit", + "acreate_fine_tuning_job", + "acancel_fine_tuning_job", + "alist_fine_tuning_jobs", + "aretrieve_fine_tuning_job", "alist_input_items", + "aimage_edit", "agenerate_content", "agenerate_content_stream", "allm_passthrough_route", "avector_store_search", "avector_store_create", + "avector_store_retrieve", + "avector_store_list", + "avector_store_update", + "avector_store_delete", "avector_store_file_create", "avector_store_file_list", "avector_store_file_retrieve", @@ -815,8 +837,8 @@ class ProxyBaseLLMRequestProcessing: "aget_interaction", "adelete_interaction", "acancel_interaction", - "acancel_batch", - "afile_delete", + "asend_message", + "call_mcp_tool", "acreate_eval", "alist_evals", "aget_eval", diff --git a/litellm/proxy/vector_store_endpoints/endpoints.py b/litellm/proxy/vector_store_endpoints/endpoints.py index 63ce5c104d..d4594fb2fd 100644 --- a/litellm/proxy/vector_store_endpoints/endpoints.py +++ b/litellm/proxy/vector_store_endpoints/endpoints.py @@ -386,7 +386,7 @@ async def vector_store_list( version, ) - data = {} + data: dict = {} if after is not None: data["after"] = after if before is not None: diff --git a/litellm/types/llms/openai.py b/litellm/types/llms/openai.py index 0ca48611e1..0184919b54 100644 --- a/litellm/types/llms/openai.py +++ b/litellm/types/llms/openai.py @@ -1052,6 +1052,14 @@ OpenAIImageGenerationOptionalParams = Literal[ "size", "style", "user", + "seed", + "safety_tolerance", + "prompt_upsampling", + "raw", + "num_images", + "image_url", + "image_prompt_strength", + "aspect_ratio", ] OpenAIImageEditOptionalParams = Literal[