Cypher AI Helper
A helper library for creating Cypher queries with OpenAI API.
Installation
pip install cypher-ai-helper
Usage
Start a local neo4j database:
sh infra/start_neo4j.sh
or
docker run \
--name neo4j \
-p 27474:7474 -p 27687:7687 \
-d \
-e NEO4J_AUTH=neo4j/pleaseletmein \
-e NEO4J_PLUGINS=\[\"apoc\"\] \
neo4j:latest
Then you can run the following:
Note: You need to set the
OPENAI_API_KEYenvironment variable to your OpenAI API key.
import functools
from neo4j import GraphDatabase
from pydantic import BaseModel, Field
from cypher_ai_helper.main import cypher_query, execute_query
from cypher_ai_helper.utils import pydantic_models_to_str
class User(BaseModel):
"""
A User class
"""
id: int = Field(..., description="The id of the user")
name: str = Field(..., description="The name of the user")
email: str = Field(..., description="The email of the user")
class Post(BaseModel):
"""
A Post class
"""
id: int = Field(..., description="The id of the post")
title: str = Field(..., description="The title of the post")
body: str = Field(..., description="The body of the post")
user_name: str = Field(..., description="The name of the user who created the post")
_q = cypher_query("del-all", pydantic_models_to_str([User, Post]),
"Delete all nodes and relations",
input_vars=[],
func=functools.partial(execute_query, driver=GraphDatabase.driver("bolt://localhost:27687",
auth=("neo4j",
"pleaseletmein")),
database="neo4j"))
_q = cypher_query("new-user", pydantic_models_to_str([User, Post]),
"Create a new user and return the created user",
input_vars=["id", "name", "email"],
func=functools.partial(execute_query, driver=GraphDatabase.driver("bolt://localhost:27687",
auth=("neo4j",
"pleaseletmein")),
database="neo4j", params={"id": 2, "name": "post_user", "email": "test"}))
Metadata
Release files for cypher-ai-helper 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cypher_ai_helper-0.1.5.tar.gz | 6.7 kB | Without provenance | Details for cypher_ai_helper-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cypher_ai_helper-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for cypher_ai_helper-0.1.5-py3-none-any.whl |
Total release size: 14.8 kB
Release files / cypher_ai_helper-0.1.5.tar.gz
| Download URL | cypher_ai_helper-0.1.5.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cbb99d0feaeb72fd3259ecb5887aed4246403e5f5c707ca7159e2abac8b3e25
|
|
BLAKE2b-256 checksum How to use checksums |
6de76572cf58a08b6130f3298efe17c3e97ecb3fc151b989be9dc1374c8ff957
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure
|
Release files / cypher_ai_helper-0.1.5-py3-none-any.whl
| Download URL | cypher_ai_helper-0.1.5-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a09885b86e0f8aaa1b11d85c5e4f03bfbe760c2e37ab765e82096e102c080cce
|
|
BLAKE2b-256 checksum How to use checksums |
b4969c43eae7a6b47ee90351bed7e8dcd5b42e39e2c8a0aab4d4a31e56301e16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure
|
Security for cypher-ai-helper 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.