From ec55ebf52ec670a478178e49f7f2ba7966210cc7 Mon Sep 17 00:00:00 2001 From: wendsomadil <149882992+wendsomadil@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:28:15 +0000 Subject: [PATCH] Update graph.ts --- src/modules/graph.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/graph.ts b/src/modules/graph.ts index ed9e1ed..904a546 100644 --- a/src/modules/graph.ts +++ b/src/modules/graph.ts @@ -7,13 +7,20 @@ import { Neo4jGraph } from "@langchain/community/graphs/neo4j_graph"; let graph: Neo4jGraph; /** - * <2> Return the existing `graph` object or create one + * Return the existing `graph` object or create one * has not already been created + * * @returns {Promise} */ export async function initGraph(): Promise { if (!graph) { - // TODO: Create singleton and wait for connection to be verified + // Create singleton and wait for connection to be verified + graph = await Neo4jGraph.initialize({ + url: process.env.NEO4J_URI as string, + username: process.env.NEO4J_USERNAME as string, + password: process.env.NEO4J_PASSWORD as string, + database: process.env.NEO4J_DATABASE as string | undefined, + }); } return graph;