From 18d4b76aaaeca4041ab3b4b106fdf0436956ef32 Mon Sep 17 00:00:00 2001 From: BernardFaucher Date: Fri, 13 Dec 2024 16:47:18 +0000 Subject: [PATCH] prefer driver.executeQuery to session.run --- libs/langchain-community/src/stores/message/neo4j.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/langchain-community/src/stores/message/neo4j.ts b/libs/langchain-community/src/stores/message/neo4j.ts index a1c65e25084c..8c8fb5d358bf 100644 --- a/libs/langchain-community/src/stores/message/neo4j.ts +++ b/libs/langchain-community/src/stores/message/neo4j.ts @@ -100,10 +100,10 @@ export class Neo4jChatMessageHistory extends BaseListChatMessageHistory { `; try { - const messages = await this.driver.session().run(getMessagesCypherQuery, { + const { records } = await this.driver.executeQuery(getMessagesCypherQuery, { sessionId: this.sessionId, }); - const results = messages.records.map((record: Record) => + const results = records.map((record: Record) => record.get("result") ); @@ -130,7 +130,7 @@ export class Neo4jChatMessageHistory extends BaseListChatMessageHistory { `; try { - await this.driver.session().run(addMessageCypherQuery, { + await this.driver.executeQuery(addMessageCypherQuery, { sessionId: this.sessionId, type: message.getType(), content: message.content, @@ -151,7 +151,7 @@ export class Neo4jChatMessageHistory extends BaseListChatMessageHistory { `; try { - await this.driver.session().run(clearMessagesCypherQuery, { + await this.driver.executeQuery(clearMessagesCypherQuery, { sessionId: this.sessionId, }); } catch (e) {