diff --git a/tests/test_litellm/llms/sap/chat/test_sap_chat_calls.py b/tests/test_litellm/llms/sap/chat/test_sap_chat_calls.py index 90b4b39582b..ee9589966a1 100644 --- a/tests/test_litellm/llms/sap/chat/test_sap_chat_calls.py +++ b/tests/test_litellm/llms/sap/chat/test_sap_chat_calls.py @@ -315,3 +315,10 @@ def test_to_openai_chunk_from_orchestration_result(): assert chunk is not None assert chunk.choices[0].delta.content == "Hello " assert chunk.choices[0].logprobs is None + + +def test_to_openai_chunk_ignores_non_dict_final_result(): + from litellm.llms.sap.chat.handler import _StreamParser + + assert _StreamParser.to_openai_chunk({"final_result": None}) is None + assert _StreamParser.to_openai_chunk({"final_result": "not-a-chunk"}) is None