langchain.memory.chat_message_histories.file.FileChatMessageHistory¶
class langchain.memory.chat_message_histories.file.FileChatMessageHistory(file_path: str)[source]¶
Chat message history that stores history in a local file.
Parameters
file_path – path of the local file to store the messages.
Attributes
messages
Retrieve the messages from the local file
Methods
__init__(file_path)
add_ai_message(message)
Convenience method for adding an AI message string to the store.
add_message(message)
Append the message to the record in the local file
add_user_message(message)
Convenience method for adding a human message string to the store.
clear()
Clear session memory from the local file
__init__(file_path: str)[source]¶
add_ai_message(message: str) → None¶
Convenience method for adding an AI message string to the store.
Parameters
message – The string contents of an AI message.
add_message(message: BaseMessage) → None[source]¶
Append the message to the record in the local file
add_user_message(message: str) → None¶
Convenience method for adding a human message string to the store.
Parameters
message – The string contents of a human message.
clear() → None[source]¶
Clear session memory from the local file
Examples using FileChatMessageHistory¶
AutoGPT