community[pathch]: Add missing custom content_key handling in Redis vector store (#27736)

This fix an error caused by missing custom content_key handling in Redis
vector store in function similarity_search_with_score.
This commit is contained in:
Qier LU 2024-10-30 21:57:20 +08:00 committed by GitHub
parent 5a2cfb49e0
commit 8d8e38b090
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -866,7 +866,8 @@ class Redis(VectorStore):
metadata = {"id": result.id}
metadata.update(self._collect_metadata(result))
doc = Document(page_content=result.content, metadata=metadata)
content_key = self._schema.content_key
doc = Document(page_content=getattr(result, content_key), metadata=metadata)
distance = self._calculate_fp_distance(result.distance)
docs_with_scores.append((doc, distance))