From 8d8e38b090fcaa964bd741ede6fb398a4331c468 Mon Sep 17 00:00:00 2001 From: Qier LU Date: Wed, 30 Oct 2024 21:57:20 +0800 Subject: [PATCH] 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. --- libs/community/langchain_community/vectorstores/redis/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/community/langchain_community/vectorstores/redis/base.py b/libs/community/langchain_community/vectorstores/redis/base.py index e88938ce2c6..e18660a6e32 100644 --- a/libs/community/langchain_community/vectorstores/redis/base.py +++ b/libs/community/langchain_community/vectorstores/redis/base.py @@ -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))