aloof-sugar-91719
06/06/2025, 9:30 AMon_user_turn_completed method is called with empty transcript content. why is there no transcript in that event, even though it is added to ai's chat context perfectly fine?tall-airline-16756
06/06/2025, 9:30 AMtall-airline-16756
06/06/2025, 9:30 AMon_user_turn_completed method may be called with an empty transcript if the user has not provided any meaningful input. To handle this scenario, you can modify the method to check for empty transcript content and prevent the agent from generating a response when there is no meaningful content.
Here is an example of how you can handle this:
async def on_user_turn_completed(self, turn_ctx: ChatContext, new_message: ChatMessage) -> None:
# callback before generating a reply after user turn committed
if not new_message.text_content:
# for example, raise StopResponse to stop the agent from generating a reply
<http://logger.info|logger.info>("ignore empty user turn")
raise StopResponse()
This code checks if the user’s message has any text content. If not, it raises a StopResponse() exception to abort the generation entirely, ensuring the agent does not respond to empty input. This is particularly useful in push-to-talk interfaces where users might accidentally trigger the microphone without speaking.
Sources: Tree View: | dse-workbench | Voice pipeline nodes | LiveKit Docsaloof-sugar-91719
06/06/2025, 9:31 AMtall-airline-16756
06/06/2025, 9:31 AMaloof-sugar-91719
06/06/2025, 9:33 AM2025-06-06 15:02:45,335 - INFO root - on user turn completed: id='item_390244575016' type='message' role='user' content=[''] interrupted=False hash=None {"user_id": 5, "pid": 280418, "job_id": "AJ_okkcpxZTo3fT"}
2025-06-06 15:02:45,336 - INFO root - ignore empty user turn: id='item_390244575016' type='message' role='user' content=[''] interrupted=False hash=None {"user_id": 5, "pid": 280418, "job_id": "AJ_okkcpxZTo3fT"}
2025-06-06 15:02:46,764 - DEBUG root - Conversation item Added : type='conversation_item_added' item=ChatMessage(id='item_BfNjItzO4H1JNpQvJbbIP', type='message', role='user', content=['Hello.\n'], interrupted=False, hash=None) {"user_id": 5, "pid": 280418, "job_id": "AJ_okkcpxZTo3fT"}