Types¶
RawSearchResult¶
RetrieverResult¶
- class neo4j_graphrag.types.RetrieverResult(*, items, metadata=None)[source]¶
Represents a result returned from a retriever.
- Parameters:
items (list[RetrieverResultItem])
- items¶
A list of retrieved items.
- Type:
RetrieverResultItem¶
LLMUsage¶
- class neo4j_graphrag.llm.types.LLMUsage(*, request_tokens=None, response_tokens=None, total_tokens=None)[source]¶
Token usage statistics returned by an LLM call.
- request_tokens¶
Number of tokens in the prompt/request.
Nonewhen not reported by the provider.- Type:
Optional[int]
LLMResponse¶
LLMMessage¶
RagResultModel¶
- class neo4j_graphrag.generation.types.RagResultModel(*, answer, retriever_result=None)[source]¶
- Parameters:
answer (str)
retriever_result (RetrieverResult | None)
DocumentInfo¶
LoadedDocument¶
- class neo4j_graphrag.experimental.components.types.LoadedDocument(*, text, document_info)[source]¶
Extracted text and metadata for a file loaded by a
DataLoader.- Parameters:
text (str)
document_info (DocumentInfo)
TextChunk¶
TextChunks¶
Neo4jNode¶
Neo4jRelationship¶
Neo4jGraph¶
- class neo4j_graphrag.experimental.components.types.Neo4jGraph(*, nodes=<factory>, relationships=<factory>)[source]¶
Represents a Neo4j graph.
- Parameters:
relationships (list[Neo4jRelationship])
- relationships¶
A list of relationships in the graph.
- Type:
GeoPoint¶
KGWriterModel¶
- class neo4j_graphrag.experimental.components.kg_writer.KGWriterModel(*, status, metadata=None)[source]¶
Data model for the output of the Knowledge Graph writer.
- status¶
Whether the write operation was successful (“SUCCESS” or “FAILURE”).
- Type:
Literal[‘SUCCESS’, ‘FAILURE’]
- metadata¶
Optional dict. When status is SUCCESS, contains at least: - “statistics”: dict with node_count, relationship_count, nodes_per_label,
rel_per_type, input_files_count, input_files_total_size_bytes.
“files”: list of file descriptors with file_path, etc. (ParquetWriter). Each file entry includes
columns: a list of dicts withname,type,is_primary_key, andis_unique(KEY / synthetic__id__/from/tovs UNIQUENESS constraints perGraphSchema). Node files include aconstraintslist with at least one single-propertyKEY(__id__is injected when the schema has none). Relationship files includestart_node_primary_keys/end_node_primary_keysas a one-element list: the first single-property schemaKEYfor that label, or__id__.
PropertyType¶
NodeType¶
RelationshipType¶
- class neo4j_graphrag.experimental.components.schema.RelationshipType(*, label, description='', properties=[], additional_properties=<factory>)[source]¶
Represents a possible relationship between nodes in the graph.
- Parameters:
label (str)
description (str)
properties (list[PropertyType])
additional_properties (bool)
Pattern¶
GraphConstraintType¶
- class neo4j_graphrag.experimental.components.schema.GraphConstraintType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Constraint kinds for
ConstraintType.UNIQUENESSis for node properties only in this API. Supports composite (multi-property) constraints.EXISTENCEmarks a mandatory (non-null) node or relationship property (single property only — Neo4j does not support composite existence).KEYmatches Neo4j NODE KEY / RELATIONSHIP KEY: mandatory and unique; supports composite (multi-property) constraints.
ConstraintType¶
- class neo4j_graphrag.experimental.components.schema.ConstraintType(*, type, property_name='', property_names, node_type='', relationship_type=None)[source]¶
Represents a schema-level constraint on a node or relationship property.
UNIQUENESSapplies to node properties only.EXISTENCEandKEYuse exactly one ofnode_typeorrelationship_type(non-empty), like Neo4j node vs relationship scope.UNIQUENESSandKEYsupport composite (multi-property) constraints viaproperty_names.EXISTENCErequires exactly one property (Neo4j does not support composite existence constraints).Deprecated since version 0.x:
property_nameis deprecated in favour ofproperty_names. It is kept for backward compatibility and is automatically migrated.
GraphSchema¶
- class neo4j_graphrag.experimental.components.schema.GraphSchema(*, node_types, relationship_types=(), patterns=(), constraints=(), additional_node_types=<factory>, additional_relationship_types=<factory>, additional_patterns=<factory>)[source]¶
This model represents the expected node and relationship types in the graph.
It is used both for guiding the LLM in the entity and relation extraction component, and for cleaning the extracted graph in a post-processing step.
Warning
This model is immutable.
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_id_property='id', chunk_index_property='index', chunk_text_property='text', chunk_embedding_property='embedding')[source]¶
Configure all labels and property names in the lexical graph.
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¶
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¶
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¶
ComponentType¶
- class neo4j_graphrag.experimental.pipeline.config.object_config.ComponentType(root=PydanticUndefined)[source]¶
- Parameters:
root (Component | ComponentConfig)
ComponentConfig¶
ParamFromEnvConfig¶
EventType¶
- enum neo4j_graphrag.experimental.pipeline.notification.EventType(value)[source]¶
Valid values are as follows:
- PIPELINE_STARTED = <EventType.PIPELINE_STARTED: 'PIPELINE_STARTED'>¶
- TASK_STARTED = <EventType.TASK_STARTED: 'TASK_STARTED'>¶
- TASK_PROGRESS = <EventType.TASK_PROGRESS: 'TASK_PROGRESS'>¶
- TASK_FINISHED = <EventType.TASK_FINISHED: 'TASK_FINISHED'>¶
- PIPELINE_FINISHED = <EventType.PIPELINE_FINISHED: 'PIPELINE_FINISHED'>¶
- PIPELINE_FAILED = <EventType.PIPELINE_FAILED: 'PIPELINE_FAILED'>¶
PipelineEvent¶
TaskEvent¶
EventCallbackProtocol¶
TaskProgressCallbackProtocol¶
RunContext¶
- class neo4j_graphrag.experimental.pipeline.types.context.RunContext(*, run_id, task_name, notifier=None)[source]¶
Context passed to the component
- Parameters:
run_id (str)
task_name (str)
notifier (TaskProgressNotifierProtocol | None)