From 960080e86e011e5d3f502f80589139806ba38c7f Mon Sep 17 00:00:00 2001 From: leedotpang Date: Tue, 3 Sep 2024 16:13:51 -0400 Subject: [PATCH] Fix Union for 3.8 --- .../chat_message_histories/opensearch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/community/langchain_community/chat_message_histories/opensearch.py b/libs/community/langchain_community/chat_message_histories/opensearch.py index a501964476177c..19c063662c9552 100644 --- a/libs/community/langchain_community/chat_message_histories/opensearch.py +++ b/libs/community/langchain_community/chat_message_histories/opensearch.py @@ -1,7 +1,7 @@ import json import logging from time import time -from typing import Any, List +from typing import Any, List, Union from langchain_core.chat_history import BaseChatMessageHistory from langchain_core.messages import BaseMessage, message_to_dict, messages_from_dict @@ -39,7 +39,9 @@ def __init__( self.index = index self.session_id = session_id - opensearch_connection: "OpenSearch" | None = kwargs.get("opensearch_connection") + opensearch_connection: Union["OpenSearch", None] = kwargs.get( + "opensearch_connection" + ) try: from opensearchpy import OpenSearch