some-breakfast-27057
07/31/2025, 1:58 AMtall-airline-16756
07/31/2025, 1:58 AMtall-airline-16756
07/31/2025, 1:59 AM// Delete a specific conversation item by ID
session.conversation.item.delete(itemId);
◦ Python: # Update chat context (this can include removing items)
await session.update_chat_ctx(new_chat_ctx)
• Clearing Input Audio Buffer:
◦ JavaScript/TypeScript: // Clear the input audio buffer
session.inputAudioBuffer.clear();
◦ Python: # Clear the input audio buffer
session.clear_audio()
• Truncating Conversation Items:
◦ JavaScript/TypeScript: // Truncate a conversation item
session.conversation.item.truncate(itemId, contentIndex, audioEnd);
◦ Python: # Truncate a conversation item
session.truncate(message_id=message_id, audio_end_ms=audio_end_ms)
• Complete Context Reset:
◦ To completely reset the conversation context, delete all existing conversation items and optionally provide a new chat context. In Python, this can be achieved by calling update_chat_ctx with an empty or new ChatContext.
Let me know if you need further details on any of these methods!
Sources: plugins/openai/src/realtime/api_proto.ts | ConversationItemDeleteEvent | LiveKit Agents | examples/voice_agents/realtime_load_chat_history.py | InputAudioBufferClearEvent | LiveKit Agents | ConversationItemTruncateEvent | LiveKit Agentssome-breakfast-27057
07/31/2025, 2:01 AMtall-airline-16756
07/31/2025, 2:01 AM