Skip to main content

llama-index readers graphdb_cypher integration

Project description

Graph Database Cypher Loader

pip install llama-index-readers-graphdb-cypher

This loader populates documents from results of Cypher queries from a Graph database endpoint. The user specifies a GraphDB endpoint URL with optional credentials to initialize the reader. By declaring the Cypher query and optional parameters the loader can fetch the nested result docs. The results will be turned into a yaml representation to be turned into a string for the document.

The approach should work for Neo4j, AWS Neptune and Memgraph.

Usage

Here's an example usage of the GraphDBCypherReader.

You can test out queries directly with the Neo4j labs demo server: demo.neo4jlabs.com or with a free instance https://neo4j.com/aura

import os

from llama_index.readers.graphdb_cypher import GraphDBCypherReader

uri = "neo4j+s://demo.neo4jlabs.com"
username = "stackoverflow"
password = "stackoverflow"
database = "stackoverflow"

query = """
    MATCH (q:Question)-[:TAGGED]->(:Tag {name:$tag})
    RETURN q.title as title
    ORDER BY q.createdAt DESC LIMIT 10
"""
reader = GraphDBCypherReader(uri, username, password, database)
documents = reader.load_data(query, parameters={"tag": "lua"})

This loader is designed to be used as a way to load data into LlamaIndex and/or subsequently used as a Tool in a LangChain Agent.

It uses the Neo4j Graph Database for the Cypher queries.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file llama_index_readers_graphdb_cypher-0.3.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_graphdb_cypher-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5e418b008c11f1326923a496d25692c72a98ec506f1158b148c7d3bb4e4e639f
MD5 e1da1f0993f2d5a0676c80845aecbafa
BLAKE2b-256 1e81c545319741f35ca5dd26843b1cc9af84cfdf6801f57f41d009fb8ed71e1f

See more details on using hashes here.

File details

Details for the file llama_index_readers_graphdb_cypher-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_graphdb_cypher-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b78e43b865fe728c93bca32ca1f362489408f7c2deca865493d3d6ca1123062
MD5 4438787e3257f0243b90f6960b7b0236
BLAKE2b-256 88ea62687cde7276eb2582c3a44a0735623983a4f440854b249ef0b28f4fb031

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page