Skip to content

Commit

Permalink
Remove SchemaEntity/SchemaRelation as valid inputs in SimpleKGPipeline
Browse files Browse the repository at this point in the history
(not "simple")
  • Loading branch information
stellasia committed Nov 5, 2024
1 parent f02fa10 commit 71b0eda
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/neo4j_graphrag/experimental/pipeline/kg_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class SimpleKGPipelineConfig(BaseModel):
model_config = ConfigDict(arbitrary_types_allowed=True)


EntityInputType = Union[str, dict[str, str], SchemaEntity]
RelationInputType = Union[str, dict[str, str], SchemaRelation]
EntityInputType = Union[str, dict[str, Any]]
RelationInputType = Union[str, dict[str, Any]]


class SimpleKGPipeline:
Expand Down Expand Up @@ -166,16 +166,12 @@ def __init__(

@staticmethod
def to_schema_entity(entity: EntityInputType) -> SchemaEntity:
if isinstance(entity, SchemaEntity):
return entity
if isinstance(entity, dict):
return SchemaEntity(**entity)
return SchemaEntity(label=entity)

@staticmethod
def to_schema_relation(relation: RelationInputType) -> SchemaRelation:
if isinstance(relation, SchemaRelation):
return relation
if isinstance(relation, dict):
return SchemaRelation(**relation)
return SchemaRelation(label=relation)
Expand Down

0 comments on commit 71b0eda

Please sign in to comment.