Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: add explicit return type annotations to BaseVector abstract methods (#32516)

longwaya1991c51e4eb
diff --git a/api/core/rag/datasource/vdb/vector_base.py b/api/core/rag/datasource/vdb/vector_base.py
index acf3465c5f5..f29b270e40f 100644
--- a/api/core/rag/datasource/vdb/vector_base.py
+++ b/api/core/rag/datasource/vdb/vector_base.py
@@ -19,7 +19,7 @@ class BaseVector(ABC):
raise NotImplementedError
@abstractmethod
- def add_texts(self, documents: list[Document], embeddings: list[list[float]], **kwargs):
+ def add_texts(self, documents: list[Document], embeddings: list[list[float]], **kwargs) -> list[str]:
raise NotImplementedError
@abstractmethod
@@ -27,14 +27,14 @@ class BaseVector(ABC):
raise NotImplementedError
@abstractmethod
- def delete_by_ids(self, ids: list[str]):
+ def delete_by_ids(self, ids: list[str]) -> None:
raise NotImplementedError
def get_ids_by_metadata_field(self, key: str, value: str):
raise NotImplementedError
@abstractmethod
- def delete_by_metadata_field(self, key: str, value: str):
+ def delete_by_metadata_field(self, key: str, value: str) -> None:
raise NotImplementedError
@abstractmethod
@@ -46,7 +46,7 @@ class BaseVector(ABC):
raise NotImplementedError
@abstractmethod
- def delete(self):
+ def delete(self) -> None:
raise NotImplementedError
def _filter_duplicate_texts(self, texts: list[Document]) -> list[Document]: