From 75e00655dc70f73536ed4800310ef6b753f4cd3c Mon Sep 17 00:00:00 2001 From: leedotpang Date: Tue, 3 Sep 2024 12:20:30 -0400 Subject: [PATCH] Fixed linting and tests --- .../langchain_community/chat_message_histories/__init__.py | 2 +- .../langchain_community/chat_message_histories/opensearch.py | 5 +---- .../tests/unit_tests/chat_message_histories/test_imports.py | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libs/community/langchain_community/chat_message_histories/__init__.py b/libs/community/langchain_community/chat_message_histories/__init__.py index 0e59bcbabc1df1..f7823efbb13bf0 100644 --- a/libs/community/langchain_community/chat_message_histories/__init__.py +++ b/libs/community/langchain_community/chat_message_histories/__init__.py @@ -131,7 +131,7 @@ "MomentoChatMessageHistory": "langchain_community.chat_message_histories.momento", "MongoDBChatMessageHistory": "langchain_community.chat_message_histories.mongodb", "Neo4jChatMessageHistory": "langchain_community.chat_message_histories.neo4j", - "OpenSearchChatMessageHistory": "langchain_community.chat_message_histories.opensearch", + "OpenSearchChatMessageHistory": "langchain_community.chat_message_histories.opensearch", # noqa: E501 "PostgresChatMessageHistory": "langchain_community.chat_message_histories.postgres", "RedisChatMessageHistory": "langchain_community.chat_message_histories.redis", "RocksetChatMessageHistory": "langchain_community.chat_message_histories.rocksetdb", diff --git a/libs/community/langchain_community/chat_message_histories/opensearch.py b/libs/community/langchain_community/chat_message_histories/opensearch.py index 8a48d82a466c8d..6a2e564d13410b 100644 --- a/libs/community/langchain_community/chat_message_histories/opensearch.py +++ b/libs/community/langchain_community/chat_message_histories/opensearch.py @@ -1,14 +1,11 @@ import json import logging from time import time -from typing import TYPE_CHECKING, List +from typing import List from langchain_core.chat_history import BaseChatMessageHistory from langchain_core.messages import BaseMessage, message_to_dict, messages_from_dict -if TYPE_CHECKING: - from opensearchpy import OpenSearch - logger = logging.getLogger(__name__) DEFAULT_INDEX_NAME = "chat-history" diff --git a/libs/community/tests/unit_tests/chat_message_histories/test_imports.py b/libs/community/tests/unit_tests/chat_message_histories/test_imports.py index 4c14a0efd9a56c..3175258d41f934 100644 --- a/libs/community/tests/unit_tests/chat_message_histories/test_imports.py +++ b/libs/community/tests/unit_tests/chat_message_histories/test_imports.py @@ -12,6 +12,7 @@ "MomentoChatMessageHistory", "MongoDBChatMessageHistory", "Neo4jChatMessageHistory", + "OpenSearchChatMessageHistory", "PostgresChatMessageHistory", "RedisChatMessageHistory", "RocksetChatMessageHistory",