From 9cffbdb1bab34297cb0c210797913b054974479a Mon Sep 17 00:00:00 2001 From: Thomas Werkmeister Date: Mon, 29 Jun 2026 12:07:55 +0200 Subject: [PATCH] Fix log spamming for custom sagemaker [DONE] chunk in streams --- litellm/llms/sagemaker/common_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/llms/sagemaker/common_utils.py b/litellm/llms/sagemaker/common_utils.py index 2fddde291f4..e4479c49d7a 100644 --- a/litellm/llms/sagemaker/common_utils.py +++ b/litellm/llms/sagemaker/common_utils.py @@ -173,7 +173,11 @@ class AWSEventStreamDecoder: except Exception as e: verbose_logger.error(f"Error parsing message: {e}. Attempting to combine with next event.") continue - + + # remove custom sagemaker [DONE] message in stream + if accumulated_json.endswith("[DONE]"): + accumulated_json = accumulated_json[:-6].strip() + # Handle any remaining data after the iterator is exhausted if accumulated_json: try: