Function
filter
v0.1
Context Length Filter
Function ID
context_length_filter
Creator
@joeykot
Downloads
37+
Filters messages to keep the system prompt and the last N non-system messages, optionally further truncating based on a maximum character count limit.
README

Context Length Filter

This function controls the context window length.

  1. N Last Messages: Controls the maximum number of messages, defaults to 4 (excluding system prompts).
  2. Max Chars: Controls the maximum number of characters, defaults to -1 (no limit).
    • This limit only applies if the character count of the 'N Last Messages' exceeds the 'Max Chars' value.