Types

RawSearchResult

class neo4j_graphrag.types.RawSearchResult(*, records, metadata=None)[source]

Represents the raw result returned from the retriever get_search_result method. It needs to be formatted further before being returned as a RetrieverResult.

Parameters:
records

A list of records from neo4j.

Type:

list[neo4j.Record]

metadata

Record-related metadata, such as score.

Type:

dict[str, Any] | None

RetrieverResult

class neo4j_graphrag.types.RetrieverResult(*, items, metadata=None)[source]

Represents a result returned from a retriever.

Parameters:
items

A list of retrieved items.

Type:

list[RetrieverResultItem]

metadata

Context-related metadata such as generated Cypher query in the Text2CypherRetriever.

Type:

dict[str, Any] | None

RetrieverResultItem

class neo4j_graphrag.types.RetrieverResultItem(*, content, metadata=None)[source]

A single record returned from a retriever.

Parameters:
content

The context as will be provided to the LLM

Type:

str

metadata

Any metadata that can be included together with the text, related to that record (e.g. another node property)

Type:

Optional[dict]

LLMResponse

class neo4j_graphrag.llm.types.LLMResponse(*, content)[source]
Parameters:

content (str)

RagResultModel

class neo4j_graphrag.generation.types.RagResultModel(*, answer, retriever_result=None)[source]
Parameters:

TextChunk

class neo4j_graphrag.experimental.components.types.TextChunk(*, text, index, metadata=None)[source]

A chunk of text split from a document by a text splitter.

Parameters:
text

The raw chunk text.

Type:

str

index

The position of this chunk in the original document.

Type:

int

metadata

Metadata associated with this chunk such as the id of the next chunk in the original document.

Type:

Optional[dict[str, Any]]

TextChunks

class neo4j_graphrag.experimental.components.types.TextChunks(*, chunks)[source]

A collection of text chunks returned from a text splitter.

Parameters:

chunks (list[TextChunk])

chunks

A list of text chunks.

Type:

list[TextChunk]

Neo4jNode

class neo4j_graphrag.experimental.components.types.Neo4jNode(*, id, label, properties={}, embedding_properties=None)[source]

Represents a Neo4j node.

Parameters:
id

The element ID of the node.

Type:

str

label

The label of the node.

Type:

str

properties

A dictionary of properties attached to the node.

Type:

dict[str, Any]

embedding_properties

A list of embedding properties attached to the node.

Type:

Optional[dict[str, list[float]]]

Neo4jRelationship

class neo4j_graphrag.experimental.components.types.Neo4jRelationship(*, start_node_id, end_node_id, type, properties={}, embedding_properties=None)[source]

Represents a Neo4j relationship.

Parameters:
start_node_id

The ID of the start node.

Type:

str

end_node_id

The ID of the end node.

Type:

str

type

The relationship type.

Type:

str

properties

A dictionary of properties attached to the relationship.

Type:

dict[str, Any]

embedding_properties

A list of embedding properties attached to the relationship.

Type:

Optional[dict[str, list[float]]]

Neo4jGraph

class neo4j_graphrag.experimental.components.types.Neo4jGraph(*, nodes=[], relationships=[])[source]

Represents a Neo4j graph.

Parameters:
nodes

A list of nodes in the graph.

Type:

list[Neo4jNode]

relationships

A list of relationships in the graph.

Type:

list[Neo4jRelationship]

KGWriterModel

class neo4j_graphrag.experimental.components.kg_writer.KGWriterModel(*, status, metadata=None)[source]

Data model for the output of the Knowledge Graph writer.

Parameters:
status

Whether the write operation was successful.

Type:

Literal[“SUCCESS”, “FAILURE”]

SchemaProperty

class neo4j_graphrag.experimental.components.schema.SchemaProperty(*, name, type, description='')[source]

Represents a property on a node or relationship in the graph.

Parameters:
  • name (str)

  • type (Literal['BOOLEAN', 'DATE', 'DURATION', 'FLOAT', 'INTEGER', 'LIST', 'LOCAL_DATETIME', 'LOCAL_TIME', 'POINT', 'STRING', 'ZONED_DATETIME', 'ZONED_TIME'])

  • description (str)

SchemaEntity

class neo4j_graphrag.experimental.components.schema.SchemaEntity(*, label, description='', properties=[])[source]

Represents a possible node in the graph.

Parameters:

SchemaRelation

class neo4j_graphrag.experimental.components.schema.SchemaRelation(*, label, description='', properties=[])[source]

Represents a possible relationship between nodes in the graph.

Parameters:

SchemaConfig

class neo4j_graphrag.experimental.components.schema.SchemaConfig(*, entities, relations, potential_schema)[source]

Represents possible relationships between entities and relations in the graph.

Parameters: