Skip to main content

prune_history

Method
This is a method of the Agent class in the agent module.
Prune chat history to keep only the last N messages. Useful for cleaning up large history after image analysis sessions to prevent context window saturation.

Signature

def prune_history(keep_last: int) -> int

Parameters

keep_last
int
default:"5"
Number of recent messages to keep

Returns

Returns
int
Number of messages deleted