mirror of https://github.com/hwchase17/langchain
Fixes incorrect docstore creation in faiss.py (#7026)
- **Description**: Current implementation assumes that the length of `texts` and `ids` should be same but if the passed `ids` length is not equal to the passed length of `texts`, current code `dict(zip(index_to_id.values(), documents))` is not failing or giving any warning and silently creating docstores only for the passed `ids` i.e. if `ids = ['A']` and `texts=["I love Open Source","I love langchain"]` then only one `docstore` will be created. But either two docstores should be created assuming same id value for all the elements of `texts` or an error should be raised. - **Issue**: My change fixes this by using dictionary comprehension instead of `zip`. This was if lengths of `ids` and `texts` mismatches an explicit `IndexError` will be raised. @rlancemartin, @eyurtsevpull/7584/head
parent
3f7213586e
commit
603a0bea29
Loading…
Reference in New Issue