Chat Messages | ü¶úÔ∏èüîó Langchain






Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryChat MessagesMemory typesMemory in LLMChainMemory in the Multi-Input ChainMemory in AgentMessage Memory in Agent backed by a databaseCustomizing Conversational MemoryCustom MemoryMultiple Memory classesAgentsCallbacksModulesSecurityGuidesMoreModulesMemoryChat MessagesChat MessagesinfoHead to Integrations for documentation on built-in memory integrations with 3rd-party databases and tools.One of the core utility classes underpinning most (if not all) memory modules is the ChatMessageHistory class.
This is a super lightweight wrapper that provides convenience methods for saving HumanMessages, AIMessages, and then fetching them all.You may want to use this class directly if you are managing memory outside of a chain.from langchain.memory import ChatMessageHistoryhistory = ChatMessageHistory()history.add_user_message("hi!")history.add_ai_message("whats up?")history.messages    [HumanMessage(content='hi!', additional_kwargs={}),     AIMessage(content='whats up?', additional_kwargs={})]PreviousMemoryNextMemory typesCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Head to Integrations for documentation on built-in memory integrations with 3rd-party databases and tools.
Head to Integrations for documentation on built-in memory integrations with 3rd-party databases and tools. ->: Chat Messages | ü¶úÔ∏èüîó Langchain






Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryChat MessagesMemory typesMemory in LLMChainMemory in the Multi-Input ChainMemory in AgentMessage Memory in Agent backed by a databaseCustomizing Conversational MemoryCustom MemoryMultiple Memory classesAgentsCallbacksModulesSecurityGuidesMoreModulesMemoryChat MessagesChat MessagesinfoHead to Integrations for documentation on built-in memory integrations with 3rd-party databases and tools.One of the core utility classes underpinning most (if not all) memory modules is the ChatMessageHistory class.
This is a super lightweight wrapper that provides convenience methods for saving HumanMessages, AIMessages, and then fetching them all.You may want to use this class directly if you are managing memory outside of a chain.from langchain.memory import ChatMessageHistoryhistory = ChatMessageHistory()history.add_user_message("hi!")history.add_ai_message("whats up?")history.messages    [HumanMessage(content='hi!', additional_kwargs={}),     AIMessage(content='whats up?', additional_kwargs={})]PreviousMemoryNextMemory typesCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.