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:

LexicalGraphConfig

class neo4j_graphrag.experimental.components.types.LexicalGraphConfig(*, id_prefix='', document_node_label='Document', chunk_node_label='Chunk', chunk_to_document_relationship_type='FROM_DOCUMENT', next_chunk_relationship_type='NEXT_CHUNK', node_to_chunk_relationship_type='FROM_CHUNK', chunk_index_property='index', chunk_text_property='text', chunk_embedding_property='embedding')[source]

Configure all labels and property names in the lexical graph.

Parameters:
  • id_prefix (str)

  • document_node_label (str)

  • chunk_node_label (str)

  • chunk_to_document_relationship_type (str)

  • next_chunk_relationship_type (str)

  • node_to_chunk_relationship_type (str)

  • chunk_index_property (str)

  • chunk_text_property (str)

  • chunk_embedding_property (str)

Neo4jDriverType

class neo4j_graphrag.experimental.pipeline.config.object_config.Neo4jDriverType(root=PydanticUndefined)[source]

A model to wrap neo4j.Driver and Neo4jDriverConfig objects.

The parse method always returns a neo4j.Driver.

Parameters:

root (Driver | Neo4jDriverConfig)

Neo4jDriverConfig

class neo4j_graphrag.experimental.pipeline.config.object_config.Neo4jDriverConfig(*, class_=None, params_={})[source]
Parameters:

LLMType

class neo4j_graphrag.experimental.pipeline.config.object_config.LLMType(root=PydanticUndefined)[source]

A model to wrap LLMInterface and LLMConfig objects.

The parse method always returns an object inheriting from LLMInterface.

Parameters:

root (LLMInterface | LLMConfig)

LLMConfig

class neo4j_graphrag.experimental.pipeline.config.object_config.LLMConfig(*, class_=None, params_={})[source]

Configuration for any LLMInterface object.

By default, will try to import from neo4j_graphrag.llm.

Parameters:

EmbedderType

class neo4j_graphrag.experimental.pipeline.config.object_config.EmbedderType(root=PydanticUndefined)[source]

A model to wrap Embedder and EmbedderConfig objects.

The parse method always returns an object inheriting from Embedder.

Parameters:

root (Embedder | EmbedderConfig)

EmbedderConfig

class neo4j_graphrag.experimental.pipeline.config.object_config.EmbedderConfig(*, class_=None, params_={})[source]

Configuration for any Embedder object.

By default, will try to import from neo4j_graphrag.embeddings.

Parameters:

ComponentType

class neo4j_graphrag.experimental.pipeline.config.object_config.ComponentType(root=PydanticUndefined)[source]
Parameters:

root (Component | ComponentConfig)

ComponentConfig

class neo4j_graphrag.experimental.pipeline.config.object_config.ComponentConfig(*, class_=None, params_={}, run_params_={})[source]

A config model for all components.

In addition to the object config, components can have pre-defined parameters that will be passed to the run method, ie run_params_.

Parameters:

ParamFromEnvConfig

class neo4j_graphrag.experimental.pipeline.config.param_resolver.ParamFromEnvConfig(*, resolver_=ParamResolverEnum.ENV, var_)[source]
Parameters:
  • resolver_ (Literal[ParamResolverEnum.ENV])

  • var_ (str)