quivr/backend/modules/brain/service/api_brain_definition_service.py
Zineb El Bachiri 5bbc72eb09
feat: composite brains db (#1826)
# Description

- db for composite brains & repository
- composite brains creation
2023-12-06 08:40:18 +01:00

35 lines
1.3 KiB
Python

from typing import Optional
from uuid import UUID
from modules.brain.dto.inputs import CreateApiBrainDefinition
from modules.brain.entity.api_brain_definition_entity import ApiBrainDefinitionEntity
from modules.brain.repository.api_brain_definitions import ApiBrainDefinitions
from modules.brain.repository.interfaces import ApiBrainDefinitionsInterface
class ApiBrainDefinitionService:
repository: ApiBrainDefinitionsInterface
def __init__(self):
self.repository = ApiBrainDefinitions()
def add_api_brain_definition(
self, brain_id: UUID, api_brain_definition: CreateApiBrainDefinition
) -> None:
self.repository.add_api_brain_definition(brain_id, api_brain_definition)
def delete_api_brain_definition(self, brain_id: UUID) -> None:
self.repository.delete_api_brain_definition(brain_id)
def get_api_brain_definition(
self, brain_id: UUID
) -> Optional[ApiBrainDefinitionEntity]:
return self.repository.get_api_brain_definition(brain_id)
def update_api_brain_definition(
self, brain_id: UUID, api_brain_definition: ApiBrainDefinitionEntity
) -> Optional[ApiBrainDefinitionEntity]:
return self.repository.update_api_brain_definition(
brain_id, api_brain_definition
)