diff --git a/src/deepgram/helpers/text_builder.py b/src/deepgram/helpers/text_builder.py
index 8886aeba..2f93c4ff 100644
--- a/src/deepgram/helpers/text_builder.py
+++ b/src/deepgram/helpers/text_builder.py
@@ -273,7 +273,7 @@ def ssml_to_deepgram(ssml_text: str) -> str:
speak_pattern = r"]*>(.*?)"
speak_match = re.search(speak_pattern, ssml_text, re.DOTALL)
if speak_match:
- ssml_text = speak_match.group(1)
+ ssml_text = re.sub(speak_pattern, r"\1", ssml_text, flags=re.DOTALL)
# Process the SSML text
# Parse XML fragments manually to handle mixed content
diff --git a/tests/custom/test_text_builder.py b/tests/custom/test_text_builder.py
index 5f1f3083..5e07d251 100644
--- a/tests/custom/test_text_builder.py
+++ b/tests/custom/test_text_builder.py
@@ -318,6 +318,13 @@ def test_speak_wrapper(self):
result = ssml_to_deepgram(ssml)
assert result == "Hello world"
+
+ def test_speak_wrapper_preserves_surrounding_text(self):
+ """Text outside a wrapper must not be discarded."""
+ ssml = "Before Inside after"
+ result = ssml_to_deepgram(ssml)
+
+ assert result == "Before Inside after"
def test_complex_ssml_rejects_mixed_controls(self):
"""Flux batch cannot combine SSML phoneme and break controls."""