langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Update combined.py

Open mzamini92 opened this issue 1 year ago • 1 comments

from my understanding, the check_repeated_memory_variable validator will raise an error if any of the variables in the memories list are repeated. However, the load_memory_variables method does not check for repeated variables. This means that it is possible for the CombinedMemory instance to return a dictionary of memory variables that contains duplicate values. This code will check for repeated variables in the data dictionary returned by the load_memory_variables method of each sub-memory. If a repeated variable is found, an error will be raised.

mzamini92 avatar Jul 11 '23 13:07 mzamini92

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Aug 1, 2023 0:53am

vercel[bot] avatar Jul 11 '23 13:07 vercel[bot]

from my understanding, the check_repeated_memory_variable validator will raise an error if any of the variables in the memories list are repeated. However, the load_memory_variables method does not check for repeated variables. This means that it is possible for the CombinedMemory instance to return a dictionary of memory variables that contains duplicate values. This code will check for repeated variables in the data dictionary returned by the load_memory_variables method of each sub-memory. If a repeated variable is found, an error will be raised.

dictionaries can't contain duplicate keys, so current logic would actually overwrite the stuff in memory_data with data if there was a duplicate. which idk if that's desirable either. thoughts @hwchase17?

baskaryan avatar Jul 11 '23 19:07 baskaryan