fix(core): flip text content fields AGT-3103#6353
Conversation
| # only strip the <expr/> dialect, and only in assistant messages | ||
| if strip_markup and item.role == "assistant": | ||
| from ..tts._provider_format import strip_all_markup | ||
| from ..tts._provider_format import strip_expr_markup | ||
|
|
||
| item.content = [ | ||
| strip_all_markup(c) if isinstance(c, str) else c for c in item.content | ||
| strip_expr_markup(c) if isinstance(c, str) else c for c in item.content | ||
| ] |
There was a problem hiding this comment.
🔍 Narrowed scope of strip_markup in to_dict serialization
The to_dict(strip_markup=True) method at livekit-agents/livekit/agents/llm/chat_context.py:629 now calls strip_expr_markup instead of the previous strip_all_markup. This means provider-native tags (e.g. <break time="1s"/>, <emotion value="happy"/>, [laugh]) will now survive serialization when strip_markup=True. Any downstream consumer (frontend, logging pipeline, analytics) that previously received fully-stripped text will now see these provider-native tags. The new test at tests/test_expr_markup.py:347-354 explicitly validates this narrower behavior, confirming it's intentional.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
This is intentional. Provider markup doesn't survive outside TTS scope.
Before:
text_contentraw content, with expressive tags and bracket tags;plain_text_contentclean content, without any tags;Now:
text_contentclean content, without any expressive-only tagsexprraw_text_contentraw content withexprtags