truncate method of chatcontext is not updating act...
# ask-ai
a
truncate method of chatcontext is not updating actual chatcontext next time when llm_node is called getting old chats in chatcontext
t
Thanks for reaching out, Namit. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The
truncate
method in the ChatContext class is designed to update the actual ChatContext object. It modifies the internal
_items
list in place using the line
self._items[:] = new_items
, ensuring that the context is updated with the truncated version. If you're still encountering issues where old chats appear in the ChatContext, it might be worth checking if the method is being called correctly or if there are other parts of the code reinitializing or overriding the ChatContext. Sources: GitHub::livekit::agents | livekit-agents/livekit/agents/llm/chat_context.py