ERROR:neo4j_graphrag.experimental.components.entity_relation_extractor:LLM response has improper format for chunk_index=5251

I am creating my knowledge graph from unstructured text data:

    pipeline = SimpleKGPipeline(
        driver=self.driver,
        text_splitter=self.text_splitter,
        embedder=self.embedder,
        entities=self.entities,
        relations=self.relations,
        potential_schema=self.potential_schema,
        llm=self.llm,
        on_error="IGNORE",
        from_pdf=False,  # We're handling PDF extraction manually
    )
    await pipeline.run_async(text=text_with_metadata)

it's been running with good progress, but sometimes it throws error messages like this during the pipeline process:
ERROR:neo4j_graphrag.experimental.components.entity_relation_extractor:LLM response has improper format for chunk_index=5251

I wonder why and how to prevent this?

Hi Jerry,

This error is due to the LLM not returning the proper JSON format, which is not yet handled in the package. If this happens, the chunk node will be created but no entities will be attached to it. At the moment, there is no much you can do except retrying the entity extraction for these failing chunks after the process is done.
For more context and info, you can follow this issue on GitHub.