text: Postgres Chat Message History | ğŸ¦œï¸�ğŸ”— Langchain
  
  
  
  
  
  Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryCassandra Chat Message HistoryDynamodb Chat Message HistoryEntity Memory with SQLite storageMomento Chat Message HistoryMongodb Chat Message HistoryMotÃ¶rhead MemoryMotÃ¶rhead Memory (Managed)Postgres Chat Message HistoryRedis Chat Message HistoryZep MemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerIntegrationsMemoryPostgres Chat Message HistoryPostgres Chat Message HistoryThis notebook goes over how to use Postgres to store chat message history.from langchain.memory import PostgresChatMessageHistoryhistory = PostgresChatMessageHistory(    connection_string="postgresql://postgres:mypassword@localhost/chat_history",    session_id="foo",)history.add_user_message("hi!")history.add_ai_message("whats up?")history.messagesPreviousMotÃ¶rhead Memory (Managed)NextRedis Chat Message HistoryCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.