fix: revert neo4j get_graph_data change
This commit is contained in:
parent
7858e3ff3f
commit
0c2eeb873b
2 changed files with 6 additions and 18 deletions
|
|
@ -955,22 +955,7 @@ class Neo4jAdapter(GraphDBInterface):
|
|||
f"Retrieved {len(nodes)} nodes and {len(edges)} edges in {retrieval_time:.2f} seconds"
|
||||
)
|
||||
|
||||
return (
|
||||
[
|
||||
(
|
||||
node_id,
|
||||
{
|
||||
**node_data,
|
||||
"id": node_id,
|
||||
"metadata": json.loads(node_data["metadata"])
|
||||
if "metadata" in node_data
|
||||
else {},
|
||||
},
|
||||
)
|
||||
for (node_id, node_data) in nodes
|
||||
],
|
||||
edges,
|
||||
)
|
||||
return (nodes, edges)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error during graph data retrieval: {str(e)}")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import json
|
||||
import pathlib
|
||||
import pytest
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
|
@ -149,7 +150,8 @@ async def main(mock_create_structured_output: AsyncMock):
|
|||
|
||||
for node in initial_nodes:
|
||||
node_data = node[1]
|
||||
collection_name = node_data["type"] + "_" + node_data["metadata"]["index_fields"][0]
|
||||
node_metadata = json.loads(node_data["metadata"])
|
||||
collection_name = node_data["type"] + "_" + node_metadata["index_fields"][0]
|
||||
if collection_name not in initial_nodes_by_vector_collection:
|
||||
initial_nodes_by_vector_collection[collection_name] = []
|
||||
initial_nodes_by_vector_collection[collection_name].append(node)
|
||||
|
|
@ -172,7 +174,8 @@ async def main(mock_create_structured_output: AsyncMock):
|
|||
after_delete_nodes_by_vector_collection = {}
|
||||
for node in initial_nodes:
|
||||
node_data = node[1]
|
||||
collection_name = node_data["type"] + "_" + node_data["metadata"]["index_fields"][0]
|
||||
node_metadata = json.loads(node_data["metadata"])
|
||||
collection_name = node_data["type"] + "_" + node_metadata["index_fields"][0]
|
||||
if collection_name not in after_delete_nodes_by_vector_collection:
|
||||
after_delete_nodes_by_vector_collection[collection_name] = []
|
||||
after_delete_nodes_by_vector_collection[collection_name].append(node)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue