Spaces:
Runtime error

File size: 213 Bytes
2a24040
 
 
 
 
 
1
2
3
4
5
6
7
def truncate_conversation(history, max_tokens=1024):
    """
    Truncate the conversation history to fit within the token limit.
    """
    truncated_history = history[-max_tokens:]
    return truncated_history