mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-09 06:53:59 +00:00
Add ZepMemory; improve ZepChatMessageHistory handling of metadata; Fix bugs (#7444)
Hey @hwchase17 - This PR adds a `ZepMemory` class, improves handling of Zep's message metadata, and makes it easier for folks building custom chains to persist metadata alongside their chat history. We've had plenty confused users unfamiliar with ChatMessageHistory classes and how to wrap the `ZepChatMessageHistory` in a `ConversationBufferMemory`. So we've created the `ZepMemory` class as a light wrapper for `ZepChatMessageHistory`. Details: - add ZepMemory, modify notebook to demo use of ZepMemory - Modify summary to be SystemMessage - add metadata argument to add_message; add Zep metadata to Message.additional_kwargs - support passing in metadata
This commit is contained in:
@@ -4,7 +4,7 @@ import pytest
|
||||
from pytest_mock import MockerFixture
|
||||
|
||||
from langchain.memory.chat_message_histories import ZepChatMessageHistory
|
||||
from langchain.schema.messages import AIMessage, HumanMessage
|
||||
from langchain.schema.messages import AIMessage, HumanMessage, SystemMessage
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from zep_python import ZepClient
|
||||
@@ -39,7 +39,7 @@ def test_messages(mocker: MockerFixture, zep_chat: ZepChatMessageHistory) -> Non
|
||||
result = zep_chat.messages
|
||||
|
||||
assert len(result) == 3
|
||||
assert isinstance(result[0], HumanMessage) # summary
|
||||
assert isinstance(result[0], SystemMessage) # summary
|
||||
assert isinstance(result[1], AIMessage)
|
||||
assert isinstance(result[2], HumanMessage)
|
||||
|
||||
|
Reference in New Issue
Block a user