add

The add function from the AsyncHistory class is used to supplement the history. It adds a new block to the message history.

Properties:

  • role — the role from which the message is written:

    • system — AI behavior rules.

    • assistant — Cloude AI.

    • user — message from your side.

  • content — the text of the message.

Example usage:

from litegpt.lib import AsyncHistory
import asyncio

async def main():
    
    # Creating a AsyncHistory object and adding a new block
    history = AsyncHistory()
    await history.add("system", "system options here!")
    print(history)
asyncio.run(main())

Thus, the add function allows for easy addition of new elements to the history.

Last updated