Skip to content

[BUG]: The LLMEntityRelationExtractor does not create relationships between Chunks and Entites, when providing a LexicalGraphconfig and havind a previous lexical graph already created with Documentand Chunks. #470

@lauracastee

Description

@lauracastee

Before You Report a Bug, Please Confirm You Have Done The Following...

  • I have updated to the latest version of the packages.
  • I have searched for both existing issues and closed issues and found none that matched my issue.

neo4j-graphrag-python's version

1.12.0

Python version

3.12.10

Operating System

Windows 11

Dependencies

accelerate==1.12.0
annotated-types==0.7.0
antlr4-python3-runtime==4.9.3
anyio==4.12.1
attrs==25.4.0
beautifulsoup4==4.14.3
blis==1.3.3
catalogue==2.0.10
certifi==2026.1.4
charset-normalizer==3.4.4
click==8.3.1
cloudpathlib==0.23.0
colorama==0.4.6
colorlog==6.10.1
confection==0.1.5
cymem==2.0.13
dill==0.4.1
distro==1.9.0
docling==2.70.0
docling-core==2.61.0
docling-ibm-models==3.11.0
docling-parse==4.7.3
en_core_web_lg @ https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.8.0/en_core_web_lg-3.8.0-py3-none-any.whl#sha256=293e9547a655b25499198ab15a525b05b9407a75f10255e405e8c3854329ab63
et_xmlfile==2.0.0
Faker==40.1.2
filelock==3.20.3
filetype==1.2.0
fsspec==2024.12.0
greenlet==3.3.1
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
huggingface-hub==0.36.0
idna==3.11
Jinja2==3.1.6
jiter==0.12.0
joblib==1.5.3
json_repair==0.44.1
jsonlines==4.0.0
jsonpatch==1.33
jsonpointer==3.0.0
jsonref==1.1.0
jsonschema==4.26.0
jsonschema-specifications==2025.9.1
langchain-classic==1.0.1
langchain-core==1.2.7
langchain-neo4j==0.8.0
langchain-openai==1.1.7
langchain-text-splitters==1.1.0
langcodes==3.5.1
langdetect==1.0.9
langgraph==1.0.7
langgraph-checkpoint==4.0.0
langgraph-prebuilt==1.0.7
langgraph-sdk==0.3.3
langsmith==0.6.6
latex2mathml==3.78.1
lxml==6.0.2
markdown-it-py==4.0.0
marko==2.2.2
MarkupSafe==3.0.3
mdurl==0.1.2
mpire==2.10.2
mpmath==1.3.0
multiprocess==0.70.19
murmurhash==1.0.15
neo4j==6.1.0
neo4j-graphrag==1.12.0
networkx==3.6.1
nltk==3.9.2
numpy==2.4.1
omegaconf==2.3.0
openai==2.16.0
opencv-python==4.13.0.90
openpyxl==3.1.5
orjson==3.11.5
ormsgpack==1.12.2
packaging==25.0
pandas==2.3.3
pillow==11.3.0
pluggy==1.6.0
polyfactory==3.2.0
preshed==3.0.12
psutil==7.2.2
pyclipper==1.4.0
pydantic==2.12.5
pydantic-settings==2.12.0
pydantic_core==2.41.5
Pygments==2.19.2
pylatexenc==2.10
pypdf==6.6.2
pypdfium2==5.3.0
python-dateutil==2.9.0.post0
python-docx==1.2.0
python-dotenv==1.2.1
python-pptx==1.0.2
pytz==2025.2
pywin32==311
PyYAML==6.0.3
rapidocr==3.6.0
referencing==0.37.0
regex==2026.1.15
reportlab==4.4.9
requests==2.32.5
requests-toolbelt==1.0.0
rich==14.3.1
rpds-py==0.30.0
rtree==1.4.1
safetensors==0.7.0
scipy==1.17.0
semchunk==2.2.2
setuptools==80.10.2
shapely==2.1.2
shellingham==1.5.4
six==1.17.0
smart_open==7.5.0
sniffio==1.3.1
soupsieve==2.8.3
spacy==3.8.7
spacy-legacy==3.0.12
spacy-loggers==1.0.5
SQLAlchemy==2.0.46
srsly==2.5.2
sympy==1.14.0
tabulate==0.9.0
tenacity==9.1.2
thinc==8.3.10
tiktoken==0.12.0
tokenizers==0.22.2
torch==2.10.0
torchvision==0.25.0
tqdm==4.67.1
transformers==4.57.6
tree-sitter==0.25.2
tree-sitter-c==0.24.1
tree-sitter-javascript==0.25.0
tree-sitter-python==0.25.0
tree-sitter-typescript==0.23.2
typer==0.19.2
typer-slim==0.21.1
types-PyYAML==6.0.12.20250915
typing-inspection==0.4.2
typing_extensions==4.15.0
tzdata==2025.3
urllib3==2.6.3
uuid_utils==0.14.0
wasabi==1.1.3
weasel==0.4.3
wrapt==2.0.1
xlsxwriter==3.2.9
xxhash==3.6.0
zstandard==0.25.0

Reproducible example

config_lexical_graph = LexicalGraphConfig(
            chunk_node_label="Chunk",
            document_node_label="Document",
            chunk_to_document_relationship_type="OF_DOCUMENT", 
            next_chunk_relationship_type="NEXT",
            node_to_chunk_relationship_type="FROM_CHUNK",       
            chunk_text_property="text",                          
            chunk_index_property="chunk_id",
            chunk_id_property="chunk_id",
            chunk_embedding_property="embedding",
            
        )
    reader = Neo4jChunkReader(driver)
    chunks = await reader.run(lexical_graph_config=config_lexical_graph)

    # Inicializar extractor LLM
    extractor = LLMEntityRelationExtractor(
        llm=AzureOpenAILLM(
            azure_endpoint= #my info
            api_key= #my info
            api_version= #my info
            model_name= #my info
            model_params={
                "max_completion_tokens": 5000,
                "response_format": {"type": "json_object"},
            },
        ),
        prompt_template= prompt_template,
        create_lexical_graph=False,
        on_error=OnError.RAISE,
    )
    
    graph = await extractor.run(chunks=chunks, lexical_graph_config=config_lexical_graph)

    writer = Neo4jWriter(driver)
    await writer.run(graph=graph, lexical_graph_config=config_lexical_graph)

Relevant Log Output

It does not appear any error in the terminal, but when i open my neo4j graph on desktop the relationships between entities and chunks dont exist

Expected Result

I expected to have Entities related (I have them) and relationships between this entites and my chunks (dont appear)

What happened instead?

No response

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions