llama-index readers graphdb_cypher integration
Project description
Graph Database Cypher Loader
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
from llama_index import download_loader
import os
GraphDBCypherReader = download_loader("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. See here for examples.
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
Hashes for llama_index_readers_graphdb_cypher-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e802c43070fe75db018cfaadfee27e8275c901e9ebe0b41014c1a8bd78b5a081 |
|
MD5 | cec44a9e9b0f6bee36a9fe9ff57ad21a |
|
BLAKE2b-256 | c21441e1649756429d65c7d8aa3afce901746040c32a748806ea7d1f5f7029c2 |
Hashes for llama_index_readers_graphdb_cypher-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 327b3391f94ac7b7d5ce6c37e54740859ad6e536d1162d1f8756f6724b50ef13 |
|
MD5 | 31a73eb7dd789fa7bdd514abf70de446 |
|
BLAKE2b-256 | 1837558b5175b87c62022a975025dfb642ca71daa6a03eb58ea661a2e4beabbd |