Skip to content

Commit d5d1070

Browse files
authored
Change field value from "CONTINUE" to "IGNORE" to match enum field name (#171)
* Change field value from "IGNORE" to "CONTINUE" to match enum field name * Update CHANGELOG.md
1 parent 86f88bf commit d5d1070

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
### Fixed
66
- Fix a bug where `openai` Python client and `numpy` were required to import any embedder or LLM.
77

8+
### Changed
9+
- The value associated to the enum field `OnError.IGNORE` has been changed from "CONTINUE" to "IGNORE" to stick to the convention and match the field name.
10+
811
## 1.0.0a1
912

1013
## 1.0.0a0

src/neo4j_graphrag/experimental/components/entity_relation_extractor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545

4646
class OnError(enum.Enum):
4747
RAISE = "RAISE"
48-
IGNORE = "CONTINUE"
48+
IGNORE = "IGNORE"
49+
50+
@classmethod
51+
def possible_values(cls) -> List[str]:
52+
return [e.value for e in cls]
4953

5054

5155
CHUNK_NODE_LABEL = "Chunk"

src/neo4j_graphrag/experimental/pipeline/kg_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class SimpleKGPipeline:
8181
text_splitter (Optional[Any]): A text splitter component. Defaults to FixedSizeSplitter().
8282
pdf_loader (Optional[Any]): A PDF loader component. Defaults to PdfLoader().
8383
kg_writer (Optional[Any]): A knowledge graph writer component. Defaults to Neo4jWriter().
84-
on_error (str): Error handling strategy. Defaults to "CONTINUE". Possible values: "RAISE" or "CONTINUE".
84+
on_error (str): Error handling strategy for the Entity and relation extractor. Defaults to "IGNORE", where chunk will be ignored if extraction fails. Possible values: "RAISE" or "IGNORE".
8585
perform_entity_resolution (bool): Merge entities with same label and name. Default: True
8686
prompt_template (str): A custom prompt template to use for extraction.
8787
"""
@@ -98,7 +98,7 @@ def __init__(
9898
text_splitter: Optional[Any] = None,
9999
pdf_loader: Optional[Any] = None,
100100
kg_writer: Optional[Any] = None,
101-
on_error: str = "CONTINUE",
101+
on_error: str = "IGNORE",
102102
prompt_template: Union[ERExtractionTemplate, str] = ERExtractionTemplate(),
103103
perform_entity_resolution: bool = True,
104104
):
@@ -110,7 +110,7 @@ def __init__(
110110
on_error_enum = OnError(on_error)
111111
except ValueError:
112112
raise PipelineDefinitionError(
113-
f"Invalid value for on_error: {on_error}. Expected 'RAISE' or 'CONTINUE'."
113+
f"Invalid value for on_error: {on_error}. Expected one of {OnError.possible_values()}."
114114
)
115115

116116
config = SimpleKGPipelineConfig(

tests/unit/experimental/pipeline/test_kg_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ def test_simple_kg_pipeline_on_error_invalid_value() -> None:
259259
llm=llm,
260260
driver=driver,
261261
embedder=embedder,
262-
on_error="IGNORE",
262+
on_error="INVALID_VALUE",
263263
)
264264

265-
assert "Expected 'RAISE' or 'CONTINUE'" in str(exc_info.value)
265+
assert "Expected one of ['RAISE', 'IGNORE']" in str(exc_info.value)
266266

267267

268268
def test_simple_kg_pipeline_no_entity_resolution() -> None:
@@ -274,7 +274,7 @@ def test_simple_kg_pipeline_no_entity_resolution() -> None:
274274
llm=llm,
275275
driver=driver,
276276
embedder=embedder,
277-
on_error="CONTINUE",
277+
on_error="IGNORE",
278278
perform_entity_resolution=False,
279279
)
280280

0 commit comments

Comments
 (0)