cognee/cognee/infrastructure/databases/vector/vector_db_interface.py
Boris 14555a25d0
feat: pipelines and tasks (#119)
* feat: simple graph pipeline

* feat: implement incremental graph generation

* fix: various bug fixes

* fix: upgrade weaviate-client

---------

Co-authored-by: Vasilije <8619304+Vasilije1990@users.noreply.github.com>
2024-07-20 16:49:00 +02:00

63 lines
1.6 KiB
Python

from typing import List, Protocol, Optional
from abc import abstractmethod
from .models.DataPoint import DataPoint
from .models.PayloadSchema import PayloadSchema
class VectorDBInterface(Protocol):
""" Collections """
@abstractmethod
async def has_collection(self, collection_name: str) -> bool:
raise NotImplementedError
@abstractmethod
async def create_collection(
self,
collection_name: str,
payload_schema: Optional[PayloadSchema] = None,
): raise NotImplementedError
""" Data points """
@abstractmethod
async def create_data_points(
self,
collection_name: str,
data_points: List[DataPoint]
): raise NotImplementedError
@abstractmethod
async def retrieve(
self,
collection_name: str,
data_point_ids: list[str]
): raise NotImplementedError
""" Search """
@abstractmethod
async def search(
self,
collection_name: str,
query_text: Optional[str],
query_vector: Optional[List[float]],
limit: int,
with_vector: bool = False
): raise NotImplementedError
@abstractmethod
async def batch_search(
self,
collection_name: str,
query_texts: List[str],
limit: int,
with_vectors: bool = False
): raise NotImplementedError
@abstractmethod
async def delete_data_points(
self,
collection_name: str,
data_point_ids: list[str]
): raise NotImplementedError
@abstractmethod
async def prune(self): raise NotImplementedError