The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: chat message history mypy fixes (#17059)
Bagaturd93de71d0888
diff --git a/libs/community/langchain_community/chat_message_histories/elasticsearch.py b/libs/community/langchain_community/chat_message_histories/elasticsearch.pyindex a9e076563e..bbd621b98d 100644--- a/libs/community/langchain_community/chat_message_histories/elasticsearch.py+++ b/libs/community/langchain_community/chat_message_histories/elasticsearch.py@@ -47,7 +47,7 @@ class ElasticsearchChatMessageHistory(BaseChatMessageHistory):):self.index: str = indexself.session_id: str = session_id- self.ensure_ascii: bool = esnsure_ascii # type: ignore[assignment]+ self.ensure_ascii = esnsure_ascii# Initialize Elasticsearch client from passed client arg or connection infoif es_connection is not None:@@ -177,7 +177,7 @@ class ElasticsearchChatMessageHistory(BaseChatMessageHistory):"created_at": round(time() * 1000),"history": json.dumps(message_to_dict(message),- ensure_ascii=self.ensure_ascii,+ ensure_ascii=bool(self.ensure_ascii),),},refresh=True,diff --git a/libs/community/langchain_community/chat_message_histories/sql.py b/libs/community/langchain_community/chat_message_histories/sql.pyindex fcc3ac71ab..e30a86a52d 100644--- a/libs/community/langchain_community/chat_message_histories/sql.py+++ b/libs/community/langchain_community/chat_message_histories/sql.py@@ -39,7 +39,7 @@ class BaseMessageConverter(ABC):raise NotImplementedError-def create_message_model(table_name, DynamicBase): # type: ignore+def create_message_model(table_name: str, DynamicBase: Any) -> Any:"""Create a message model for a given table name.@@ -52,8 +52,8 @@ def create_message_model(table_name, DynamicBase): # type: ignore"""- # Model decleared inside a function to have a dynamic table name- class Message(DynamicBase):+ # Model declared inside a function to have a dynamic table name.+ class Message(DynamicBase): # type: ignore[valid-type, misc]__tablename__ = table_nameid = Column(Integer, primary_key=True)session_id = Column(Text)diff --git a/libs/community/langchain_community/chat_message_histories/tidb.py b/libs/community/langchain_community/chat_message_histories/tidb.pyindex 973e97820a..309ab6d7b1 100644--- a/libs/community/langchain_community/chat_message_histories/tidb.py+++ b/libs/community/langchain_community/chat_message_histories/tidb.py@@ -40,7 +40,7 @@ class TiDBChatMessageHistory(BaseChatMessageHistory):self.session_id = session_idself.table_name = table_nameself.earliest_time = earliest_time- self.cache = [] # type: ignore[var-annotated]+ self.cache: List = []# Set up SQLAlchemy engine and sessionself.engine = create_engine(connection_string)