remove

The remove function from the History class is used to delete message blocks from the history based on their index. By default, the index is set to -1, which results in deleting the last message in the list.

Properties:

  • index — the index of the element to be deleted.

Example usage:

from litegpt.lib import History

# Creating a history object and removing a block by index
history = History()
history.remove(1)
print(history)

Thus, the remove function allows for efficient management of history by deleting messages at the specified index.

Last updated