cleaned code

This commit is contained in:
Yannick Stephan
2025-02-15 22:37:32 +01:00
parent eaf1d553d2
commit 3319db0dba
3 changed files with 4 additions and 9 deletions

View File

@@ -163,17 +163,13 @@ class BaseGraphStorage(StorageNameSpace):
"""Get an edge by its source and target node ids.""" """Get an edge by its source and target node ids."""
async def get_edge( async def get_edge(
self, self, source_node_id: str, target_node_id: str
source_node_id: str, ) -> dict[str, str] | None:
target_node_id: str
) -> dict[str, str] | None :
raise NotImplementedError raise NotImplementedError
"""Get all edges connected to a node.""" """Get all edges connected to a node."""
async def get_node_edges( async def get_node_edges(self, source_node_id: str) -> list[tuple[str, str]] | None:
self, source_node_id: str
) -> list[tuple[str, str]] | None:
raise NotImplementedError raise NotImplementedError
"""Upsert a node into the graph.""" """Upsert a node into the graph."""

View File

@@ -1,4 +1,3 @@
from __future__ import annotations from __future__ import annotations
from pydantic import BaseModel from pydantic import BaseModel

View File

@@ -488,7 +488,7 @@ def cosine_similarity(v1, v2):
return dot_product / (norm1 * norm2) return dot_product / (norm1 * norm2)
def quantize_embedding(embedding: np.ndarray | list[float], bits: int=8) -> tuple: def quantize_embedding(embedding: np.ndarray | list[float], bits: int = 8) -> tuple:
"""Quantize embedding to specified bits""" """Quantize embedding to specified bits"""
# Convert list to numpy array if needed # Convert list to numpy array if needed
if isinstance(embedding, list): if isinstance(embedding, list):