community[patch]: missing unpack operator for or_clause in pgvector document filter (#16148)

- Fix for #16146 
- Adding unpack operation to "or" and "and" filter for pgvector
retriever. #
This commit is contained in:
Felix Krones 2024-01-17 18:10:43 +01:00 committed by GitHub
parent 3606c5d5e9
commit d91126fc64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -545,13 +545,13 @@ class PGVector(VectorStore):
self._create_filter_clause(key, sub_value)
for sub_value in value_case_insensitive[OR]
]
filter_by_metadata = sqlalchemy.or_(or_clauses)
filter_by_metadata = sqlalchemy.or_(*or_clauses)
elif AND in map(str.lower, value):
and_clauses = [
self._create_filter_clause(key, sub_value)
for sub_value in value_case_insensitive[AND]
]
filter_by_metadata = sqlalchemy.and_(and_clauses)
filter_by_metadata = sqlalchemy.and_(*and_clauses)
else:
filter_by_metadata = None