mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-18 20:01:52 +03:00
9766befb53
# Description - Refactor knowledge to a module - This PR breaks the Github Processor function -> need to comment brain and file imports as it creates a circular dependency issue. Should be fixed and reverted in next PR.
59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
from abc import ABC, abstractmethod
|
|
from typing import List
|
|
from uuid import UUID
|
|
|
|
from modules.knowledge.dto.inputs import CreateKnowledgeProperties
|
|
from modules.knowledge.dto.outputs import DeleteKnowledgeResponse
|
|
from modules.knowledge.entity.knowledge import Knowledge
|
|
|
|
|
|
class KnowledgeInterface(ABC):
|
|
@abstractmethod
|
|
def insert_knowledge(self, knowledge: CreateKnowledgeProperties) -> Knowledge:
|
|
"""
|
|
Add a knowledge
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def remove_knowledge_by_id(
|
|
# todo: update remove brain endpoints to first delete the knowledge
|
|
self,
|
|
knowledge_id: UUID,
|
|
) -> DeleteKnowledgeResponse:
|
|
"""
|
|
Args:
|
|
knowledge_id (UUID): The id of the knowledge
|
|
|
|
Returns:
|
|
str: Status message
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_knowledge_by_id(self, knowledge_id: UUID) -> Knowledge:
|
|
"""
|
|
Get a knowledge by its id
|
|
Args:
|
|
brain_id (UUID): The id of the brain
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_all_knowledge_in_brain(self, brain_id: UUID) -> List[Knowledge]:
|
|
"""
|
|
Get all the knowledge in a brain
|
|
Args:
|
|
brain_id (UUID): The id of the brain
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def remove_brain_all_knowledge(self, brain_id: UUID) -> None:
|
|
"""
|
|
Remove all knowledge in a brain
|
|
Args:
|
|
brain_id (UUID): The id of the brain
|
|
"""
|
|
pass
|