Fix: renames new vector db and cogneegraph methods

This commit is contained in:
hajdul88 2024-11-27 13:47:26 +01:00
parent 94dc545fcd
commit 3146ef75c9
7 changed files with 8 additions and 8 deletions

View file

@ -142,7 +142,7 @@ class LanceDBAdapter(VectorDBInterface):
score = 0,
) for result in results.to_dict("index").values()]
async def get_distances_of_collection(
async def get_distance_from_collection_elements(
self,
collection_name: str,
query_text: str = None,

View file

@ -176,7 +176,7 @@ class PGVectorAdapter(SQLAlchemyAdapter, VectorDBInterface):
) for result in results
]
async def get_distances_of_collection(
async def get_distance_from_collection_elements(
self,
collection_name: str,
query_text: str = None,

View file

@ -142,7 +142,7 @@ class QDrantAdapter(VectorDBInterface):
await client.close()
return results
async def get_distances_of_collection(
async def get_distance_from_collection_elements(
self,
collection_name: str,
query_text: str = None,

View file

@ -153,7 +153,7 @@ class WeaviateAdapter(VectorDBInterface):
return await future
async def get_distances_of_collection(
async def get_distance_from_collection_elements(
self,
collection_name: str,
query_text: str = None,

View file

@ -42,7 +42,7 @@ class CogneeGraph(CogneeAbstractGraph):
def get_node(self, node_id: str) -> Node:
return self.nodes.get(node_id, None)
def get_edges_of_node(self, node_id: str) -> List[Edge]:
def get_edges_from_node(self, node_id: str) -> List[Edge]:
node = self.get_node(node_id)
if node:
return node.skeleton_edges

View file

@ -114,7 +114,7 @@ async def brute_force_search(
try:
results = await asyncio.gather(
*[vector_engine.get_distances_of_collection(collection, query_text=query) for collection in collections]
*[vector_engine.get_distance_from_collection_elements(collection, query_text=query) for collection in collections]
)
############################################# :TODO: Change when vector db does not contain duplicates

View file

@ -77,11 +77,11 @@ def test_get_edges_success(setup_graph):
graph.add_node(node2)
edge = Edge(node1, node2)
graph.add_edge(edge)
assert edge in graph.get_edges_of_node("node1")
assert edge in graph.get_edges_from_node("node1")
def test_get_edges_nonexistent_node(setup_graph):
"""Test retrieving edges for a nonexistent node raises an exception."""
graph = setup_graph
with pytest.raises(ValueError, match="Node with id nonexistent does not exist."):
graph.get_edges_of_node("nonexistent")
graph.get_edges_from_node("nonexistent")