From d85e46321aa7fedd4c86919d52fdd2743fabb5f6 Mon Sep 17 00:00:00 2001 From: Tomaz Bratanic Date: Mon, 20 May 2024 19:25:58 +0200 Subject: [PATCH] community[patch]: Better error message for neo4j vector when text is null (#21861) --- .../vectorstores/neo4j_vector.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/community/langchain_community/vectorstores/neo4j_vector.py b/libs/community/langchain_community/vectorstores/neo4j_vector.py index d09145b1b7f..eba9945ae6a 100644 --- a/libs/community/langchain_community/vectorstores/neo4j_vector.py +++ b/libs/community/langchain_community/vectorstores/neo4j_vector.py @@ -1043,6 +1043,19 @@ class Neo4jVector(VectorStore): results = self.query(read_query, params=parameters) + if any(result["text"] is None for result in results): + if not self.retrieval_query: + raise ValueError( + f"Make sure that none of the `{self.text_node_property}` " + f"properties on nodes with label `{self.node_label}` " + "are missing or empty" + ) + else: + raise ValueError( + "Inspect the `retrieval_query` and ensure it doesn't " + "return None for the `text` column" + ) + docs = [ ( Document(