From c039e505baa1b27a07de1df409c3d5fd68ed8c06 Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Sat, 21 Feb 2026 14:47:09 -0800 Subject: [PATCH] docs: add inline comment clarifying intentional falsy id behavior --- .../llm_response_utils/convert_dict_to_response.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py b/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py index a4a68255e80..0f7779e8b5c 100644 --- a/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py +++ b/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py @@ -628,6 +628,8 @@ def convert_to_model_response_object( # noqa: PLR0915 ) if "id" in response_object: + # Preserve the auto-generated id from ModelResponse.__init__ + # when the provider returns a falsy id (None, "") model_response_object.id = response_object["id"] or model_response_object.id if "system_fingerprint" in response_object: