clear() — langchain Function Reference
Architecture documentation for the clear() function in chat_history.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 155354e7_2975_a5b8_c6f7_34c53a36f6f5["clear()"] 172321af_58bf_4793_da29_9eb028a48761["InMemoryChatMessageHistory"] 155354e7_2975_a5b8_c6f7_34c53a36f6f5 -->|defined in| 172321af_58bf_4793_da29_9eb028a48761 1a133819_288e_c6bf_e5a7_e1eb524d154e["clear()"] 1a133819_288e_c6bf_e5a7_e1eb524d154e -->|calls| 155354e7_2975_a5b8_c6f7_34c53a36f6f5 ab857f6e_1c4c_77ed_f91e_a23c51c57fd5["aclear()"] ab857f6e_1c4c_77ed_f91e_a23c51c57fd5 -->|calls| 155354e7_2975_a5b8_c6f7_34c53a36f6f5 1a133819_288e_c6bf_e5a7_e1eb524d154e["clear()"] 155354e7_2975_a5b8_c6f7_34c53a36f6f5 -->|calls| 1a133819_288e_c6bf_e5a7_e1eb524d154e style 155354e7_2975_a5b8_c6f7_34c53a36f6f5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/chat_history.py lines 240–242
def clear(self) -> None:
"""Clear all messages from the store."""
self.messages = []
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does clear() do?
clear() is a function in the langchain codebase, defined in libs/core/langchain_core/chat_history.py.
Where is clear() defined?
clear() is defined in libs/core/langchain_core/chat_history.py at line 240.
What does clear() call?
clear() calls 1 function(s): clear.
What calls clear()?
clear() is called by 2 function(s): aclear, clear.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free