replicate / llama-chat

A boilerplate for creating a Llama 3 chat app
https://llama3.replicate.dev
Apache License 2.0
829 stars 306 forks source link

Truncate message history to accomodate LLaMA context window #12

Closed mattt closed 1 year ago

mattt commented 1 year ago

This PR attempts to truncate the message history to keep the prompt within the 4096 token context window of LLaMA 2. Assuming that the first message between the user and assistant sets a topic for the conversation, the truncation logic removes from the middle, following that initial exchange.