From eb552afcdc04ec7fc429712bf275f65c60fbc92d Mon Sep 17 00:00:00 2001 From: Yannick Stephan Date: Sat, 8 Feb 2025 23:16:04 +0100 Subject: [PATCH] fixed base and generic --- lightrag/base.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lightrag/base.py b/lightrag/base.py index 661f1a79..23acb7ad 100644 --- a/lightrag/base.py +++ b/lightrag/base.py @@ -4,7 +4,6 @@ from typing import ( TypedDict, Union, Literal, - Generic, TypeVar, Optional, Dict, @@ -83,30 +82,30 @@ class BaseVectorStorage(StorageNameSpace): @dataclass -class BaseKVStorage(Generic[T], StorageNameSpace): +class BaseKVStorage(StorageNameSpace): embedding_func: EmbeddingFunc async def all_keys(self) -> list[str]: raise NotImplementedError - async def get_by_id(self, id: str) -> Union[T, None]: + async def get_by_id(self, id: str) -> Union[dict[str, Any], None]: raise NotImplementedError - async def get_by_ids(self, ids: list[str]) -> list[Union[T, None]]: + async def get_by_ids(self, ids: list[str]) -> list[Union[dict[str, Any], None]]: raise NotImplementedError async def filter_keys(self, data: list[str]) -> set[str]: """return un-exist keys""" raise NotImplementedError - async def upsert(self, data: dict[str, T]) -> None: + async def upsert(self, data: dict[str, Any]) -> None: raise NotImplementedError async def drop(self) -> None: raise NotImplementedError async def get_by_status_and_ids( - self, status: str, ids: list[str] + self, status: str ) -> list[dict[str, Any]]: raise NotImplementedError