from talk_box.conversation import Conversation
convo = Conversation()
for i in range(10):
convo.add_user_message(f"Message {i}")
convo.set_context_window(3)
len(convo.get_context_messages())3
Limit how many recent messages get_context_messages() returns.
Usage
When working with LLMs that have limited context, setting a window ensures only the most recent messages are sent, keeping token usage under control while preserving conversational continuity.
max_length: int