neo4j-labs / llm-graph-builder

Neo4j graph construction from unstructured data using LLMs
https://neo4j.com/labs/genai-ecosystem/llm-graph-builder/
Apache License 2.0
2.54k stars 404 forks source link

Does NOT work with Neo4J Community Edition #839

Open sp-yang opened 4 weeks ago

sp-yang commented 4 weeks ago

The current up-to-date version of graph builder does not work with Neo4J Community Edition, e.g. some commands are not supported by Neo4j community edition. Please adapt it to neo4j community editon as much as you can. Thanks!

jexp commented 3 weeks ago

@sp-yang can you provide more details on what's not working? I'm don't think we use any EE only features right now. Most of the work is done in the python code anyhow.

sp-yang commented 3 weeks ago

@jexp For example, in backend/src/graphDB_dataAccess.py, the function check_account_access() uses command " SHOW USER PRIVILEGES YIELD WHERE graph = $database AND action IN ['read'] RETURN COUNT() AS readAccessCount", which is only supported by Neo4j EE version. CE version will throw an exception.

olaoluthomas commented 3 weeks ago

@jexp For example, in backend/src/graphDB_dataAccess.py, the function check_account_access() uses command " SHOW USER PRIVILEGES YIELD WHERE graph = $database AND action IN ['read'] RETURN COUNT() AS readAccessCount", which is only supported by Neo4j EE version. CE version will throw an exception.

I have the same error message with the current version. When I revert to a working tree that has the previous version, no errors.

bamalburg commented 3 weeks ago

I agree this would be nice to have! I suspect maybe it's somehow inferring that the user doesn't have edit permissions in the community edition, because the roles show as null, but in reality, per this documentation, "In Neo4j Community Edition there are no roles, but all users have implied administrator privileges."

jexp commented 3 weeks ago

Good point. This is a recent addition that we can fix.

icejean commented 2 weeks ago

The workaround is just return true when Exception occured.

    def check_account_access(self, database):
        query = """
        SHOW USER PRIVILEGES 
        YIELD * 
        WHERE graph = $database AND action IN ['read'] 
        RETURN COUNT(*) AS readAccessCount
        """
        try:
            logging.info(f"Checking access for database: {database}")

            result = self.graph.query(query, params={"database": database})
            read_access_count = result[0]["readAccessCount"] if result else 0

            logging.info(f"Read access count: {read_access_count}")

            if read_access_count > 0:
                logging.info("The account has read access.")
                return False
            else:
                logging.info("The account has write access.")
                return True

        except Exception as e:
            logging.error(f"Error checking account access: {e}")
            return True # False

Neo4j KGBuilder-1