diff --git a/litellm/llms/sagemaker/common_utils.py b/litellm/llms/sagemaker/common_utils.py index 8e8f7ea61aa..0d5dd83c9ed 100644 --- a/litellm/llms/sagemaker/common_utils.py +++ b/litellm/llms/sagemaker/common_utils.py @@ -174,7 +174,11 @@ class AWSEventStreamDecoder: except Exception as e: verbose_logger.error("Error parsing message: %s. Attempting to combine with next event.", e) 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: