mirror of
https://github.com/hwchase17/langchain
synced 2024-10-31 15:20:26 +00:00
23 lines
373 B
Plaintext
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>
|