Skip to content

Commit cec1088

Browse files
Fix mypy errors
1 parent 15eddc8 commit cec1088

File tree

1 file changed

+5
-7
lines changed
  • src/neo4j_graphrag/experimental/components

1 file changed

+5
-7
lines changed

src/neo4j_graphrag/experimental/components/schema.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,23 +144,21 @@ def validate_input_if_string(cls, data: EntityInputType) -> EntityInputType:
144144
# allow LLM to extract additional properties beyond the default "name"
145145
"additional_properties": True, # type: ignore[dict-item]
146146
}
147-
if (
148-
isinstance(data, dict)
149-
and "properties" not in data
150-
and data.get("additional_properties") is not False
151-
):
147+
if isinstance(data, dict) and "properties" not in data:
148+
if data.get("additional_properties") is False: # type: ignore[comparison-overlap]
149+
return data
152150
label = data.get("label", "")
153151
logger.info(
154152
f"No properties defined for NodeType '{label}'. "
155153
f"Adding default 'name' property and additional_properties=True "
156154
f"to allow flexible property extraction."
157155
)
158-
return { # type: ignore[return-value]
156+
return {
159157
**data,
160158
# added to satisfy the model validation (min_length=1 for properties of node types)
161159
"properties": [{"name": "name", "type": "STRING"}],
162160
# allow LLM to extract additional properties beyond the default "name"
163-
"additional_properties": data.get("additional_properties", True),
161+
"additional_properties": True, # type: ignore[dict-item]
164162
}
165163

166164
return data

0 commit comments

Comments
 (0)