langchain/docs/snippets/modules/memory/chat_messages/get_started.mdx
Harrison Chase 25b8cc7e3d
Harrison/update memory docs (#8384)
Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-07-27 17:18:19 -07:00

23 lines
373 B
Plaintext

```python
from langchain.memory import ChatMessageHistory
history = ChatMessageHistory()
history.add_user_message("hi!")
history.add_ai_message("whats up?")
```
```python
history.messages
```
<CodeOutputBlock lang="python">
```
[HumanMessage(content='hi!', additional_kwargs={}),
AIMessage(content='whats up?', additional_kwargs={})]
```
</CodeOutputBlock>