langchain.memory.chat_message_histories.streamlit.StreamlitChatMessageHistory¶
- class langchain.memory.chat_message_histories.streamlit.StreamlitChatMessageHistory(key: str = 'langchain_messages')[source]¶
Bases:
BaseChatMessageHistoryChat message history that stores messages in Streamlit session state.
- Parameters
key – The key to use in Streamlit session state for storing messages.
Methods
__init__([key])add_ai_message(message)Convenience method for adding an AI message string to the store.
add_message(message)Add a message to the session memory
add_user_message(message)Convenience method for adding a human message string to the store.
clear()Clear session memory
Attributes
Retrieve the current list of messages
- 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]¶
Add a message to the session memory
- 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 the current list of messages