The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Update MongoDBChatMessageHistory to create an index on SessionId (#5632)
Lucas Rodriguesc112d7334d6c
diff --git a/langchain/memory/chat_message_histories/mongodb.py b/langchain/memory/chat_message_histories/mongodb.pyindex 3455d81280..a6965af3c0 100644--- a/langchain/memory/chat_message_histories/mongodb.py+++ b/langchain/memory/chat_message_histories/mongodb.py@@ -47,6 +47,7 @@ class MongoDBChatMessageHistory(BaseChatMessageHistory):self.db = self.client[database_name]self.collection = self.db[collection_name]+ self.collection.create_index("SessionId")@propertydef messages(self) -> List[BaseMessage]: # type: ignore