Skip to content

Commit b412a05

Browse files
Remove flag for automatic schema extraction
1 parent fef2e49 commit b412a05

File tree

4 files changed

+5
-14
lines changed

4 files changed

+5
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
### Added
66

7-
- Added support for automatic schema extraction from text using LLMs.
8-
7+
- Added support for automatic schema extraction from text using LLMs. In the `SimpleKGPipeline`, when the user provides no schema, the automatic schema extraction is enabled by default.
98
## 1.7.0
109

1110
### Added

docs/source/user_guide_kg_builder.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,6 @@ within the configuration file.
466466
["House", "RULES", "Planet"]
467467
]
468468
},
469-
/* Control automatic schema extraction */
470-
"auto_schema_extraction": false,
471469
"lexical_graph_config": {
472470
"chunk_node_label": "TextPart"
473471
}
@@ -511,8 +509,6 @@ or in YAML:
511509
- ["Person", "PARENT_OF", "Person"]
512510
- ["Person", "HEIR_OF", "House"]
513511
- ["House", "RULES", "Planet"]
514-
# Control automatic schema extraction
515-
auto_schema_extraction: false
516512
lexical_graph_config:
517513
chunk_node_label: TextPart
518514

src/neo4j_graphrag/experimental/pipeline/config/template_pipeline/simple_kg_builder.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ class SimpleKGPipelineConfig(TemplatePipelineConfig):
8989
perform_entity_resolution: bool = True
9090
lexical_graph_config: Optional[LexicalGraphConfig] = None
9191
neo4j_database: Optional[str] = None
92-
auto_schema_extraction: bool = False
9392

9493
pdf_loader: Optional[ComponentType] = None
9594
kg_writer: Optional[ComponentType] = None
@@ -170,7 +169,7 @@ def _get_schema(self) -> Union[SchemaBuilder, SchemaFromTextExtractor]:
170169
Get the appropriate schema component based on configuration.
171170
Return SchemaFromTextExtractor for automatic extraction or SchemaBuilder for manual schema.
172171
"""
173-
if self.auto_schema_extraction and not self.has_user_provided_schema():
172+
if not self.has_user_provided_schema():
174173
return SchemaFromTextExtractor(llm=self.get_default_llm())
175174
return SchemaBuilder()
176175

@@ -234,7 +233,7 @@ def _process_schema_with_precedence(
234233
return entities, relations, potential_schema
235234

236235
def _get_run_params_for_schema(self) -> dict[str, Any]:
237-
if self.auto_schema_extraction and not self.has_user_provided_schema():
236+
if not self.has_user_provided_schema():
238237
# for automatic extraction, the text parameter is needed (will flow through the pipeline connections)
239238
return {}
240239
else:
@@ -290,7 +289,7 @@ def _get_connections(self) -> list[ConnectionDefinition]:
290289
)
291290

292291
# handle automatic schema extraction
293-
if self.auto_schema_extraction and not self.has_user_provided_schema():
292+
if not self.has_user_provided_schema():
294293
connections.append(
295294
ConnectionDefinition(
296295
start="pdf_loader",
@@ -382,6 +381,6 @@ def get_run_params(self, user_input: dict[str, Any]) -> dict[str, Any]:
382381
)
383382
run_params["splitter"] = {"text": text}
384383
# Add full text to schema component for automatic schema extraction
385-
if self.auto_schema_extraction and not self.has_user_provided_schema():
384+
if not self.has_user_provided_schema():
386385
run_params["schema"] = {"text": text}
387386
return run_params

src/neo4j_graphrag/experimental/pipeline/kg_builder.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ def __init__(
124124
perform_entity_resolution=perform_entity_resolution,
125125
lexical_graph_config=lexical_graph_config,
126126
neo4j_database=neo4j_database,
127-
auto_schema_extraction=not bool(
128-
schema or entities or relations or potential_schema
129-
),
130127
)
131128
except (ValidationError, ValueError) as e:
132129
raise PipelineDefinitionError() from e

0 commit comments

Comments
 (0)