Skip to content

Added created_at:datetime on the :Session and :Message node #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/neo4j_graphrag/message_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Neo4jMessageHistoryModel,
)

CREATE_SESSION_NODE_QUERY = "MERGE (s:`{node_label}` {{id:$session_id}})"
CREATE_SESSION_NODE_QUERY = "MERGE (s:`{node_label}` {{id:$session_id, created_at: datetime()}})"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the property be createdAt to follow Neo4j convention? Otherwise looks good to me!


DELETE_SESSION_AND_MESSAGES_QUERY = (
"MATCH (s:`{node_label}`) "
Expand Down Expand Up @@ -56,7 +56,7 @@
"MATCH (s:`{node_label}`) WHERE s.id = $session_id "
"OPTIONAL MATCH (s)-[lm:LAST_MESSAGE]->(last_message) "
"CREATE (s)-[:LAST_MESSAGE]->(new:Message) "
"SET new += {{role:$role, content:$content}} "
"SET new += {{role:$role, content:$content, created_at: datetime()}} "
"WITH new, lm, last_message WHERE last_message IS NOT NULL "
"CREATE (last_message)-[:NEXT]->(new) "
"DELETE lm"
Expand Down
Loading