This commit is contained in:
2025-12-27 02:32:33 -08:00
parent 38e9965d2e
commit 194597adbc
4 changed files with 190 additions and 4 deletions

15
main.py
View File

@@ -1,9 +1,18 @@
from dotenv import load_dotenv
import os
import dspy
from dotenv import load_dotenv
from modaic import PrecompiledProgram, PrecompiledConfig
from src.neo4j import Neo4j
load_dotenv()
# set up Neo4j using NEO4J_URI
neo4j = Neo4j(
uri=os.getenv("NEO4J_URI"),
user=os.getenv("NEO4J_USER"),
password=os.getenv("NEO4J_PASSWORD"),
)
class CypherFromText(dspy.Signature):
"""Instructions:
Create a Cypher MERGE statement to model all entities and relationships found in the text following these guidelines:
@@ -21,7 +30,7 @@ class CypherFromText(dspy.Signature):
class GenerateCypherConfig(PrecompiledConfig):
neo4j_schema: list[str] = []
model: str = "gpt-4"
model: str = "openai/gpt-4o"
max_tokens: int = 1024
@@ -43,6 +52,6 @@ class GenerateCypher(PrecompiledProgram):
if __name__ == "__main__":
generate_cypher = GenerateCypher(GenerateCypherConfig())
generate_cypher.push_to_hub("farouk1/text-to-cypher", with_code=True, tag="v0.0.2", commit_message="set LM")
generate_cypher.push_to_hub("farouk1/text-to-cypher", with_code=True, tag="v0.0.3", commit_message="set LM")