Truncates the chat's in-memory turns to keep only the first keep_turns
user/assistant turns (ellmer counts each user and assistant message as a
separate turn, so a "round" is 2 turns). This is a pure in-memory operation
via Chat$set_turns(); persist afterwards with save_session() to make the
rewind durable.
Arguments
- chat
An
ellmer::Chatobject (modified in place).- keep_turns
Integer. Number of turns to keep from the start. If
NULLor larger than the current turn count, nothing is truncated.