insert

The insert function from the History class is used for multi-layered addition of blocks to the history. It allows adding multiple messages in a single call.

Properties:

  • data — a list containing the message blocks to be added.

Example usage:

from litegpt.lib import History

# Creating a history object and adding multiple blocks
history = History()
history.insert([
    ("system", "system options here!"),
    ("assistant", "assistant first message!"),
    ("user", "user message here!"),
    ("assistant", "assistant second message!")
])
print(history)

Thus, the insert function allows for easy and quick addition of multiple messages to the history, preserving the sequence and structure of the data.

Last updated