LLM-chat-app / utils.py
sanketchaudhary10
Adding files
2a24040
raw
history blame contribute delete
213 Bytes
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