Skip to main content

A package for Neo4j data ingestion using an AI agent.

Project description

neo-pusher

neo-pusher is a Python package designed to facilitate the seamless transfer of data from CSV files to a Neo4j database. Leveraging the power of OpenAI's GPT models and the LangChain framework, neo-pusher automates the process of schema generation, data preprocessing, and data insertion into Neo4j, ensuring data consistency and integrity.

Features

  • Automated Schema Generation: Automatically generates a Neo4j schema based on the CSV file's headers.
  • Data Preprocessing: Identifies and resolves inconsistencies in the data before pushing it to Neo4j.
  • Error Handling and Debugging: The agent reruns and debugs code automatically if any errors are encountered during the process.
  • Multiple Dataset Support: Capable of handling multiple datasets simultaneously, ensuring that all columns are properly represented in the database.

Usage

Here's an example of how to use neo-pusher to push data from a CSV file to a Neo4j database:

from neo_pusher.agent import NeoAgent

# Initialize the NeoAgent with your OpenAI API key
agent = NeoAgent(apikey="your_openai_api_key",lang_chain_api_key="your_lang_chain_api_key")

# Define the parameters for your Neo4j database and CSV file
path = "path/to/your/csvfile.csv"
username = "neo4j_username"
password = "neo4j_password"
url = "bolt://localhost:7687"
data = "head of your csv data"

# Run the agent to push data to Neo4j
response = agent.run(path, username, password, url, data)
print(response)

Parameters

  • apikey (str): Your OpenAI API key.
  • langchain_api_key (str): Your Langchain API key.
  • model (str): The OpenAI model to use. Defaults to "gpt-4o".
  • path (str): The path to the CSV file.
  • username (str): The username for the Neo4j database.
  • password (str): The password for the Neo4j database.
  • url (str): The URL of the Neo4j database.
  • data (str): The head of the CSV file. Defaults to None.

Return Value

  • The run method returns a response from the LLM, including the results of the schema generation, data preprocessing, and data insertion into Neo4j.

Example CSV Data

The following is an example of the CSV file headers that neo-pusher can process:

Dataset 1:

order_details_id order_id pizza_id quantity
1 1 hawaiian_m 1
2 2 classic_dlx_m 1

Dataset 2:

pizza_id pizza_type_id size price
bbq_ckn_s bbq_ckn S 12.75
bbq_ckn_m bbq_ckn M 16.75

Notes

  • The agent uses the neo4j Python package to connect to and push data into the Neo4j database.
  • Before pushing data, the agent checks for any inconsistencies and cleans the data accordingly.

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

neo_pusher-1.0.1.dev115.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

neo_pusher-1.0.1.dev115-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file neo_pusher-1.0.1.dev115.tar.gz.

File metadata

  • Download URL: neo_pusher-1.0.1.dev115.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for neo_pusher-1.0.1.dev115.tar.gz
Algorithm Hash digest
SHA256 8e66efa8b9daf246c037a2b16bb59950df28d6d0bcf5c64822c5f311abf98bc8
MD5 0e8a848bc795146fed8a13f958d69304
BLAKE2b-256 3c11f716aad1d531370f9e4d75cc5b1e6f30538c5ca044d9f1f0cf80b709b62c

See more details on using hashes here.

File details

Details for the file neo_pusher-1.0.1.dev115-py3-none-any.whl.

File metadata

File hashes

Hashes for neo_pusher-1.0.1.dev115-py3-none-any.whl
Algorithm Hash digest
SHA256 1b3bd42b726c82d6ecc97a970b015a815be33b4030e4ee28982441f1e149c1d5
MD5 b26d67829fe7ba140ed69ce0f42beadf
BLAKE2b-256 1e7fa09fd3aa50effa491bd489ab79739fa84efa4983c74987123f67a0ab37cc

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