Spaces:
Runtime error
Runtime error
Download utils.py from sanketchaudhary/LLM-chat-app: direct link, hf CLI and curl.
- Browser
- Download file 213 Bytes
-
https://huggingface.co/spaces/sanketchaudhary/LLM-chat-app/resolve/main/utils.py
- Command line
-
hf download hf://spaces/sanketchaudhary/LLM-chat-app/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/sanketchaudhary/LLM-chat-app/resolve/main/utils.py
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 | |