Skip to content
Discussion options

You must be logged in to vote

The purpose of the context shift is to free space from the context sequence to make room for the next generation, so it only happens when the context sequence is full.
LlamaChat and LlamaChatSession attempt to use the existing context state as much as possible to avoid redundant context shifts, which is why you have to pass lastContextWindow.

The reason you pass lastContextShiftMetadata is to make it easier for the context shift algorithm to do the next context shift.
Every time the context shift function is called, it gets the full chat history, and the number of tokens the "rendered" chat state needs to fit - you can use the chat wrapper's generateContextState function to get the "rende…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@physimo
Comment options

@scenaristeur
Comment options

@giladgd
Comment options

@giladgd
Comment options

Answer selected by giladgd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants