langchain_community.graphs: Neo4JGraph: prop min_size might be None (#23944)

When I used the Neo4JGraph enhanced_schema=True option, I ran into an
error because a prop min_size of None was compared numerically with an
int.

The fix I applied is similar to the pattern of skipping embeddings
elsewhere in the file.

Co-authored-by: ccurme <chester.curme@gmail.com>
This commit is contained in:
Nada Amin 2024-08-22 16:29:52 -04:00 committed by GitHub
parent 7d13a2f958
commit ac7b71e0d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -246,7 +246,7 @@ def _format_schema(schema: Dict, is_enhanced: bool) -> str:
)
elif prop["type"] == "LIST":
# Skip embeddings
if prop["min_size"] > LIST_LIMIT:
if not prop.get("min_size") or prop["min_size"] > LIST_LIMIT:
continue
example = (
f'Min Size: {prop["min_size"]}, Max Size: {prop["max_size"]}'