From 1ac61323d3533ca198e3f4e7cf723ecbfcd639d2 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Tue, 23 Apr 2024 16:41:30 -0400 Subject: [PATCH] x --- .../langchain_community/memory/__init__.py | 2 +- libs/community/langchain_community/memory/entity.py | 5 ++--- libs/community/langchain_community/memory/kg.py | 13 +++++++------ .../langchain_community/memory/motorhead_memory.py | 1 - .../langchain_community/memory/zep_memory.py | 3 ++- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libs/community/langchain_community/memory/__init__.py b/libs/community/langchain_community/memory/__init__.py index 30d5f340f3f..a05c4e7ce01 100644 --- a/libs/community/langchain_community/memory/__init__.py +++ b/libs/community/langchain_community/memory/__init__.py @@ -1,7 +1,7 @@ from langchain_community.memory.entity import ( RedisEntityStore, - UpstashRedisEntityStore, SQLiteEntityStore, + UpstashRedisEntityStore, ) from langchain_community.memory.kg import ConversationKGMemory from langchain_community.memory.motorhead_memory import MotorheadMemory diff --git a/libs/community/langchain_community/memory/entity.py b/libs/community/langchain_community/memory/entity.py index fa3d26738f0..d14c90d975c 100644 --- a/libs/community/langchain_community/memory/entity.py +++ b/libs/community/langchain_community/memory/entity.py @@ -2,9 +2,10 @@ import logging from itertools import islice from typing import Any, Iterable, Optional -from langchain_community.utilities.redis import get_client from langchain_core.legacy.memory.entity import BaseEntityStore +from langchain_community.utilities.redis import get_client + logger = logging.getLogger(__name__) @@ -265,5 +266,3 @@ class SQLiteEntityStore(BaseEntityStore): """ with self.conn: self.conn.execute(query) - - diff --git a/libs/community/langchain_community/memory/kg.py b/libs/community/langchain_community/memory/kg.py index 2dab6622801..f54f359ccab 100644 --- a/libs/community/langchain_community/memory/kg.py +++ b/libs/community/langchain_community/memory/kg.py @@ -1,11 +1,5 @@ from typing import Any, Dict, List, Type, Union -from langchain_community.graphs import NetworkxEntityGraph -from langchain_community.graphs.networkx_graph import ( - KnowledgeTriple, - get_entities, - parse_triples, -) from langchain_core.language_models import BaseLanguageModel from langchain_core.legacy.chains.llm import LLMChain from langchain_core.legacy.memory.chat_memory import BaseChatMemory @@ -18,6 +12,13 @@ from langchain_core.messages import BaseMessage, SystemMessage, get_buffer_strin from langchain_core.prompts import BasePromptTemplate from langchain_core.pydantic_v1 import Field +from langchain_community.graphs import NetworkxEntityGraph +from langchain_community.graphs.networkx_graph import ( + KnowledgeTriple, + get_entities, + parse_triples, +) + class ConversationKGMemory(BaseChatMemory): """Knowledge graph conversation memory. diff --git a/libs/community/langchain_community/memory/motorhead_memory.py b/libs/community/langchain_community/memory/motorhead_memory.py index e028f7c3ddc..0058ba0046b 100644 --- a/libs/community/langchain_community/memory/motorhead_memory.py +++ b/libs/community/langchain_community/memory/motorhead_memory.py @@ -1,7 +1,6 @@ from typing import Any, Dict, List, Optional import requests - from langchain_core.legacy.memory.chat_memory import BaseChatMemory from langchain_core.messages import get_buffer_string diff --git a/libs/community/langchain_community/memory/zep_memory.py b/libs/community/langchain_community/memory/zep_memory.py index 828f0676809..47a60432f05 100644 --- a/libs/community/langchain_community/memory/zep_memory.py +++ b/libs/community/langchain_community/memory/zep_memory.py @@ -2,9 +2,10 @@ from __future__ import annotations from typing import Any, Dict, Optional -from langchain_community.chat_message_histories import ZepChatMessageHistory from langchain_core.legacy.memory import ConversationBufferMemory +from langchain_community.chat_message_histories import ZepChatMessageHistory + class ZepMemory(ConversationBufferMemory): """Persist your chain history to the Zep MemoryStore.