graphiti icon indicating copy to clipboard operation
graphiti copied to clipboard

[BUG] Incomplete graph structure in Neo4j

Open lovepeace-max opened this issue 2 months ago • 2 comments

Bug Description

I followed the official example in this documentation and I installed Neo4j Desktop as graph database. But it seems to create incomplete graph structures as shown in Neo4j.

Steps to Reproduce

The code is below:

 # Initialize the graph database with graphiti's indices. This only needs to be done once.
        await graphiti.build_indices_and_constraints()

        #################################################
        # ADDING EPISODES
        #################################################
        # Episodes are the primary units of information
        # in Graphiti. They can be text or structured JSON
        # and are automatically processed to extract entities
        # and relationships.
        #################################################

        # Example: Add Episodes
        # Episodes list containing both text and JSON episodes
        episodes = [
            {
                'content': 'Kamala Harris is the Attorney General of California. She was previously '
                'the district attorney for San Francisco.',
                'type': EpisodeType.text,
                'description': 'podcast transcript',
            },
            {
                'content': 'As AG, Harris was in office from January 3, 2011 – January 3, 2017',
                'type': EpisodeType.text,
                'description': 'podcast transcript',
            },
            {
                'content': {
                    'name': 'Gavin Newsom',
                    'position': 'Governor',
                    'state': 'California',
                    'previous_role': 'Lieutenant Governor',
                    'previous_location': 'San Francisco',
                },
                'type': EpisodeType.json,
                'description': 'podcast metadata',
            },
            {
                'content': {
                    'name': 'Gavin Newsom',
                    'position': 'Governor',
                    'term_start': 'January 7, 2019',
                    'term_end': 'Present',
                },
                'type': EpisodeType.json,
                'description': 'podcast metadata',
            },
        ]

        # Add episodes to the graph
        for i, episode in enumerate(episodes):
            await graphiti.add_episode(
                name=f'Freakonomics Radio {i}',
                episode_body=episode['content']
                if isinstance(episode['content'], str)
                else json.dumps(episode['content']),
                source=episode['type'],
                source_description=episode['description'],
                reference_time=datetime.now(timezone.utc),
            )
            print(f'Added episode: Freakonomics Radio {i} ({episode["type"].value})')

Expected Behavior

It indeed outputs :

Added episode: Freakonomics Radio 0 (text) Added episode: Freakonomics Radio 1 (text) Added episode: Freakonomics Radio 2 (json) Added episode: Freakonomics Radio 3 (json)

but It shows only one episode (Freakonomics Radio 0) in the Neo4j, as shown in the image.

Actual Behavior

Image

Environment

  • Graphiti Version: [e.g. 0.15.1]
  • Python Version: [e.g. 3.11.5]
  • Operating System: [e.g. macOS 14.0]
  • Database Backend: [e.g. Neo4j Desktop]
  • LLM Provider & Model: [e.g. OpenAI gpt-4.1, Anthropic claude-4-sonnet, Google gemini-2.5-flash]

Installation Method

  • [ ] pip install

Error Messages/Traceback


Configuration

# Relevant configuration or initialization code

Additional Context

  • Does this happen consistently or intermittently?
  • Which component are you using? (core library, REST server, MCP server)
  • Any recent changes to your environment?
  • Related issues or similar problems you've encountered?

Possible Solution

If you have ideas about what might be causing the issue or how to fix it, please share them here.

lovepeace-max avatar Oct 23 '25 03:10 lovepeace-max

Please provide the information requested in the PR template. In particular:

Graphiti Version: [e.g. 0.15.1] Python Version: [e.g. 3.11.5] Operating System: [e.g. macOS 14.0] Database Backend: [e.g. Neo4j Desktop] LLM Provider & Model: [e.g. OpenAI gpt-4.1, Anthropic claude-4-sonnet, Google gemini-2.5-flash]

danielchalef avatar Oct 30 '25 02:10 danielchalef

@lovepeace-max Is this still an issue? Please confirm within 14 days or this issue will be closed.

claude[bot] avatar Nov 17 '25 00:11 claude[bot]