File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/neo4j_graphrag/experimental/components Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -354,12 +354,15 @@ def validate_chunk(
354
354
Perform validation after entity and relation extraction:
355
355
- Enforce schema if schema enforcement mode is on and schema is provided
356
356
"""
357
- # if enforcing_schema is on and schema is provided, clean the graph
358
- return (
359
- self ._clean_graph (chunk_graph , schema )
360
- if self .enforce_schema != SchemaEnforcementMode .NONE and schema .entities
361
- else chunk_graph
362
- )
357
+ if self .enforce_schema != SchemaEnforcementMode .NONE :
358
+ if not schema or not schema .entities : # schema is not provided
359
+ logger .warning (
360
+ "Schema enforcement is ON but the guiding schema is not provided."
361
+ )
362
+ else :
363
+ # if enforcing_schema is on and schema is provided, clean the graph
364
+ return self ._clean_graph (chunk_graph , schema )
365
+ return chunk_graph
363
366
364
367
def _clean_graph (
365
368
self ,
You can’t perform that action at this time.
0 commit comments