From c54ff38646bf8e6ec1156d86145ecf8337a6d3f3 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Mon, 27 Apr 2026 18:59:15 -0700 Subject: [PATCH] fix(deepseek): move _ensure_reasoning_content before @overload stubs to fix mypy errors --- litellm/llms/deepseek/chat/transformation.py | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/litellm/llms/deepseek/chat/transformation.py b/litellm/llms/deepseek/chat/transformation.py index 4e885edbb3f..2456c5eddbd 100644 --- a/litellm/llms/deepseek/chat/transformation.py +++ b/litellm/llms/deepseek/chat/transformation.py @@ -62,19 +62,6 @@ class DeepSeekChatConfig(OpenAIGPTConfig): return optional_params - @overload - def _transform_messages( - self, messages: List[AllMessageValues], model: str, is_async: Literal[True] - ) -> Coroutine[Any, Any, List[AllMessageValues]]: ... - - @overload - def _transform_messages( - self, - messages: List[AllMessageValues], - model: str, - is_async: Literal[False] = False, - ) -> List[AllMessageValues]: ... - def _ensure_reasoning_content_on_assistant_messages( self, messages: List[AllMessageValues] ) -> List[AllMessageValues]: @@ -99,6 +86,19 @@ class DeepSeekChatConfig(OpenAIGPTConfig): message["reasoning_content"] = "" # type: ignore[typeddict-unknown-key] return messages + @overload + def _transform_messages( + self, messages: List[AllMessageValues], model: str, is_async: Literal[True] + ) -> Coroutine[Any, Any, List[AllMessageValues]]: ... + + @overload + def _transform_messages( + self, + messages: List[AllMessageValues], + model: str, + is_async: Literal[False] = False, + ) -> List[AllMessageValues]: ... + def _transform_messages( self, messages: List[AllMessageValues], model: str, is_async: bool = False ) -> Union[List[AllMessageValues], Coroutine[Any, Any, List[AllMessageValues]]]: