cleaned code
Browse files- lightrag/base.py +3 -7
- lightrag/types.py +0 -1
- lightrag/utils.py +1 -1
lightrag/base.py
CHANGED
|
@@ -163,17 +163,13 @@ class BaseGraphStorage(StorageNameSpace):
|
|
| 163 |
"""Get an edge by its source and target node ids."""
|
| 164 |
|
| 165 |
async def get_edge(
|
| 166 |
-
self,
|
| 167 |
-
|
| 168 |
-
target_node_id: str
|
| 169 |
-
) -> dict[str, str] | None :
|
| 170 |
raise NotImplementedError
|
| 171 |
|
| 172 |
"""Get all edges connected to a node."""
|
| 173 |
|
| 174 |
-
async def get_node_edges(
|
| 175 |
-
self, source_node_id: str
|
| 176 |
-
) -> list[tuple[str, str]] | None:
|
| 177 |
raise NotImplementedError
|
| 178 |
|
| 179 |
"""Upsert a node into the graph."""
|
|
|
|
| 163 |
"""Get an edge by its source and target node ids."""
|
| 164 |
|
| 165 |
async def get_edge(
|
| 166 |
+
self, source_node_id: str, target_node_id: str
|
| 167 |
+
) -> dict[str, str] | None:
|
|
|
|
|
|
|
| 168 |
raise NotImplementedError
|
| 169 |
|
| 170 |
"""Get all edges connected to a node."""
|
| 171 |
|
| 172 |
+
async def get_node_edges(self, source_node_id: str) -> list[tuple[str, str]] | None:
|
|
|
|
|
|
|
| 173 |
raise NotImplementedError
|
| 174 |
|
| 175 |
"""Upsert a node into the graph."""
|
lightrag/types.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
from __future__ import annotations
|
| 3 |
|
| 4 |
from pydantic import BaseModel
|
|
|
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
from pydantic import BaseModel
|
lightrag/utils.py
CHANGED
|
@@ -488,7 +488,7 @@ def cosine_similarity(v1, v2):
|
|
| 488 |
return dot_product / (norm1 * norm2)
|
| 489 |
|
| 490 |
|
| 491 |
-
def quantize_embedding(embedding: np.ndarray | list[float], bits: int=8) -> tuple:
|
| 492 |
"""Quantize embedding to specified bits"""
|
| 493 |
# Convert list to numpy array if needed
|
| 494 |
if isinstance(embedding, list):
|
|
|
|
| 488 |
return dot_product / (norm1 * norm2)
|
| 489 |
|
| 490 |
|
| 491 |
+
def quantize_embedding(embedding: np.ndarray | list[float], bits: int = 8) -> tuple:
|
| 492 |
"""Quantize embedding to specified bits"""
|
| 493 |
# Convert list to numpy array if needed
|
| 494 |
if isinstance(embedding, list):
|