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.2.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_graphdb_cypher-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e4aafcf7d695532cc97f3933f181991458cc39dd3fb8a78295cfd7fb2125439c
MD5 184839e7d7f7714e5d868ce75a74e544
BLAKE2b-256 409c8f7cdb5bc5d650099269ecb467b17ad9722d5a933a5afa9dfe946672ac1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_readers_graphdb_cypher-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 490e83d30041d3aceeb370a314c2069c60da2ae409a91034a333cc15f3d167b5
MD5 d000c8bd57eb913ecd783f69bdec7a5f
BLAKE2b-256 2de71c6b6c4413c477c7819223cbc53eef94ab675b613a6495bf17d8ab1a09c4

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