remove

The remove function from the AsyncHistoryclass 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 AsyncHistory
import asyncio

async def main():
    # Creating a history object and removing a block by index
    history = AsyncHistory()
    await history.remove(1)
    print(history)

asyncio.run(main())

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

Last updated