1
1
from langchain_neo4j import Neo4jGraph
2
2
from langchain .docstore .document import Document
3
3
from src .shared .common_fn import load_embedding_model ,execute_graph_query
4
+ from src .shared .common_fn import load_embedding_model ,execute_graph_query
4
5
import logging
5
6
from typing import List
6
7
import os
@@ -34,6 +35,7 @@ def merge_relationship_between_chunk_and_entites(graph: Neo4jGraph, graph_docume
34
35
MERGE (c)-[:HAS_ENTITY]->(n)
35
36
"""
36
37
execute_graph_query (graph ,unwind_query , params = {"batch_data" : batch_data })
38
+ execute_graph_query (graph ,unwind_query , params = {"batch_data" : batch_data })
37
39
38
40
39
41
def create_chunk_embeddings (graph , chunkId_chunkDoc_list , file_name ):
@@ -60,6 +62,7 @@ def create_chunk_embeddings(graph, chunkId_chunkDoc_list, file_name):
60
62
MERGE (c)-[:PART_OF]->(d)
61
63
"""
62
64
execute_graph_query (graph ,query_to_create_embedding , params = {"fileName" :file_name , "data" :data_for_query })
65
+ execute_graph_query (graph ,query_to_create_embedding , params = {"fileName" :file_name , "data" :data_for_query })
63
66
64
67
def create_relation_between_chunks (graph , file_name , chunks : List [Document ])-> list :
65
68
logging .info ("creating FIRST_CHUNK and NEXT_CHUNK relationships between chunks" )
@@ -128,6 +131,7 @@ def create_relation_between_chunks(graph, file_name, chunks: List[Document])->li
128
131
MERGE (c)-[:PART_OF]->(d)
129
132
"""
130
133
execute_graph_query (graph ,query_to_create_chunk_and_PART_OF_relation , params = {"batch_data" : batch_data })
134
+ execute_graph_query (graph ,query_to_create_chunk_and_PART_OF_relation , params = {"batch_data" : batch_data })
131
135
132
136
query_to_create_FIRST_relation = """
133
137
UNWIND $relationships AS relationship
@@ -137,6 +141,7 @@ def create_relation_between_chunks(graph, file_name, chunks: List[Document])->li
137
141
MERGE (d)-[:FIRST_CHUNK]->(c))
138
142
"""
139
143
execute_graph_query (graph ,query_to_create_FIRST_relation , params = {"f_name" : file_name , "relationships" : relationships })
144
+ execute_graph_query (graph ,query_to_create_FIRST_relation , params = {"f_name" : file_name , "relationships" : relationships })
140
145
141
146
query_to_create_NEXT_CHUNK_relation = """
142
147
UNWIND $relationships AS relationship
0 commit comments