Skip to main content

Streamlit Chat Message History

This notebook goes over how to use Streamlit to store chat message history. Note, StreamlitChatMessageHistory only works when run in a Streamlit app. For more on Streamlit check out their getting started documentation.

from langchain.memory import StreamlitChatMessageHistory

history = StreamlitChatMessageHistory("foo")

history.add_user_message("hi!")
history.add_ai_message("whats up?")

API Reference:

history.messages