This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| neo4j-agent-memory + LangFlow Integration | |
| ========================================== | |
| Demonstrates Reasoning Memory: every tool call the agent makes is stored | |
| as a graph node in Neo4j, giving you a full, queryable audit trail. | |
| SETUP | |
| ----- | |
| pip install neo4j-agent-memory langchain langchain-ollama langflow neo4j |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE CONSTRAINT IF NOT EXISTS FOR (n:Parcel) REQUIRE n.neo4jImportId IS UNIQUE; | |
| CREATE CONSTRAINT IF NOT EXISTS FOR (n:Subject) REQUIRE n.neo4jImportId IS UNIQUE; | |
| CREATE CONSTRAINT IF NOT EXISTS FOR (n:Bill) REQUIRE n.neo4jImportId IS UNIQUE; | |
| CREATE CONSTRAINT IF NOT EXISTS FOR (n:Committee) REQUIRE n.neo4jImportId IS UNIQUE; | |
| CREATE CONSTRAINT IF NOT EXISTS FOR (n:Legislator) REQUIRE n.neo4jImportId IS UNIQUE; | |
| CREATE CONSTRAINT IF NOT EXISTS FOR (n:Trip) REQUIRE n.neo4jImportId IS UNIQUE; | |
| CREATE CONSTRAINT IF NOT EXISTS FOR (n:Organization) REQUIRE n.neo4jImportId IS UNIQUE; | |
| CREATE CONSTRAINT IF NOT EXISTS FOR (n:Destination) REQUIRE n.neo4jImportId IS UNIQUE; | |
| CALL apoc.import.json("https://cdn.neo4jlabs.com/data/landgraph/landgraph.json"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| "lyonwj", | |
| "johnymontana" | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Movie { | |
| _id: Long! | |
| countries: [String] | |
| imdbId: String! | |
| imdbRating: Float | |
| imdbVotes: Int | |
| languages: [String] | |
| movieId: String! | |
| plot: String | |
| poster: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Legislator { | |
| bioguideID: String! | |
| birthday: String! | |
| currentParty: String! | |
| district: String | |
| fecIDs: String! | |
| firstName: String! | |
| gender: String! | |
| govtrackID: String! | |
| lastName: String! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { makeAugmentedSchema, inferSchema } from 'neo4j-graphql-js'; | |
| import { ApolloServer } from 'apollo-server'; | |
| import { v1 as neo4j } from 'neo4j-driver'; | |
| // Create Neo4j driver instance | |
| const driver = neo4j.driver( | |
| process.env.NEO4J_URI || 'bolt://localhost:7687', | |
| neo4j.auth.basic( | |
| process.env.NEO4J_USER || 'neo4j', | |
| process.env.NEO4J_PASSWORD || 'letmein' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { Component } from "react"; | |
| import { withStyles } from "@material-ui/core/styles"; | |
| import neo4j from "neo4j-driver/lib/browser/neo4j-web"; | |
| import ElGrapho from "elgrapho"; | |
| const styles = theme => ({ | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE CONSTRAINT ON (c:Company) ASSERT c.companyNumber IS UNIQUE; | |
| CREATE CONSTRAINT ON (p:Person) ASSERT (p.birthMonth, p.birthYear, p.name ) IS NODE KEY; | |
| CREATE CONSTRAINT ON (p:Property) ASSERT p.titleNumber IS UNIQUE; | |
| LOAD CSV WITH HEADERS FROM "file:///data/PSCAmericans.csv" AS row | |
| MERGE (c:Company {companyNumber: row.company_number}) | |
| MERGE (p:Person {name: row.`data.name`, birthYear: row.`data.date_of_birth.year`, birthMonth: row.`data.date_of_birth.month`}) | |
| ON CREATE SET p.nationality = row.`data.nationality`, | |
| p.countryOfResidence = row.`data.country_of_residence` | |
| // TODO: Address |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CALL apoc.load.json("file:///Users/lyonwj/Desktop/issue_comments_000001.json") YIELD value | |
| WITH value WHERE value.issue IS NOT NULL | |
| MERGE (ic:IssueComment {url: value.url}) | |
| SET ic += value {.body, created_at: DateTime(value.created_at)} | |
| MERGE (u:User {url: value.user}) | |
| MERGE (u)-[:AUTHORED]->(ic) | |
| MERGE (r:Issue {url: value.issue}) | |
| MERGE (r)-[:HAS_COMMENT]->(ic) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CALL apoc.load.json("file:///Users/lyonwj/Desktop/issues_000001.json") YIELD value | |
| MERGE (i:Issue {url: value.url}) | |
| SET i += value {.title, .body, created_at: DateTime(value.created_at), closed_at: DateTime(value.closed_at)} | |
| MERGE (u:User {url: value.user}) | |
| MERGE (u)-[:OPENED]->(i) | |
| MERGE (r:Repository {url: value.repository}) | |
| MERGE (i)<-[:HAS_ISSUE]-(r) |
NewerOlder