agent.chat_history
to get the chat history, you can pass it in with agent.chat("hello", chat_history=chat_history)
. Its a list of ChatMessage objects, which are pydantic, so serializablegenerate_wallet_tool = FunctionTool.from_defaults(fn=generate_solana_wallet)
# Wrap the transaction execution function
# execute_transaction_tool = FunctionTool.from_defaults(fn=execute_solana_transaction)
# Create the agent with the tools, memory, and LLM
agent = ReActAgent.from_tools([generate_wallet_tool], verbose=True)
agent.chat_history
response = agent.chat("what was the previous wallet address?")
chat_history = agent.chat_history chat_history_dicts = [x.model_dump() for x in chat_history] # dump in redis, mongodb, json.dump to disk, pickle, etc... # reload it from llama_index.core.llms import ChatMessage chat_history = [ChatMessage.model_validate(x) for x in chat_history_dicts] agent.chat("Hello", chat_history=chat_history)