Skip to content

Schema

Module for representing graph documents and their components.

Authors

Douglas Raevan Faisal (douglas.r.faisal@gdplabs.id)

References

[1] https://github.com/langchain-ai/langchain-community/blob/490057c052f00f4ef47ad843df294e473fcfb4c8/libs/community/langchain_community/graphs/graph_document.py

GraphDocument

Bases: BaseModel

Represents a graph document consisting of nodes and relationships.

Attributes:

Name Type Description
nodes list[Node]

A list of nodes in the graph.

relationships list[Relationship]

A list of relationships in the graph.

source Chunk

The document from which the graph information is derived.

GraphResponse

Bases: BaseModel

Represents a graph response generated by LM Invoker containing nodes and relationships.

Attributes:

Name Type Description
nodes list[Any] | None

A list of nodes generated by LM Invoker.

relationships list[Any] | None

A list of relationships generated by LM Invoker.

Node

Bases: BaseModel

Represents a node in a graph with associated properties.

Attributes:

Name Type Description
id str

A unique identifier for the node.

type str

The type or label of the node. Defaults to "Node".

properties dict

Additional properties and metadata associated with the node.

Relationship

Bases: BaseModel

Represents a directed relationship between two nodes in a graph.

Attributes:

Name Type Description
source Node

The source node of the relationship.

target Node

The target node of the relationship.

type str

The type of the relationship. Defaults to "Relationship".

properties dict

Additional properties associated with the relationship.