langchain.memory.chat_message_histories.sql.SQLChatMessageHistory¶
- class langchain.memory.chat_message_histories.sql.SQLChatMessageHistory(session_id: str, connection_string: str, table_name: str = 'message_store')[source]¶
Bases:
BaseChatMessageHistoryChat message history stored in an SQL database.
Methods
__init__(session_id, connection_string[, ...])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 db
add_user_message(message)Convenience method for adding a human message string to the store.
clear()Clear session memory from db
Attributes
Retrieve all messages from db
- 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 db
- 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.
- property messages: List[langchain.schema.messages.BaseMessage]¶
Retrieve all messages from db