Skip to content

Interface

ChatRepository

Bases: abc.ABC

Interface for the ChatRepository class,Defines the methods that the ChatRepository class should implement.

Parameters:

  • ABC (abc.ABC) –

    Abstract Base Class

Source code in src/project/database/Interface.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class ChatRepository(ABC):
    """Interface for the ChatRepository class,Defines the methods that the ChatRepository class should implement.

    Args:
        ABC (ABC): Abstract Base Class
    """

    @abstractmethod
    def create_new_session(self):
        """Method to create a new session.
        """
        pass

    @abstractmethod
    def get_all_session(self):
        """Method to get all the sessions.
        Returns:
            list: List of all the sessions
        """
        pass

    @abstractmethod
    def get_current(self):
        """Method to create a new session.
        Returns:
            Session: Current session
        """
        pass

    @abstractmethod
    def get_current_session(self, session_id: int):
        """Method to get session by id

        Args:
            session_id (int): Session id
        Returns:
            Session: Session with the given id
        """
        pass

    @abstractmethod
    def add_message(self, message: str, role: Role):
        """_summary_

        Args:
            message (str): Message to be added
            role (Role): Role of the user
        """
        pass
add_message(message, role) abstractmethod

summary

Parameters:

  • message (str) –

    Message to be added

  • role (database.Session.Role) –

    Role of the user

Source code in src/project/database/Interface.py
46
47
48
49
50
51
52
53
54
@abstractmethod
def add_message(self, message: str, role: Role):
    """_summary_

    Args:
        message (str): Message to be added
        role (Role): Role of the user
    """
    pass
create_new_session() abstractmethod

Method to create a new session.

Source code in src/project/database/Interface.py
13
14
15
16
17
@abstractmethod
def create_new_session(self):
    """Method to create a new session.
    """
    pass
get_all_session() abstractmethod

Method to get all the sessions. Returns: list: List of all the sessions

Source code in src/project/database/Interface.py
19
20
21
22
23
24
25
@abstractmethod
def get_all_session(self):
    """Method to get all the sessions.
    Returns:
        list: List of all the sessions
    """
    pass
get_current() abstractmethod

Method to create a new session. Returns: Session: Current session

Source code in src/project/database/Interface.py
27
28
29
30
31
32
33
@abstractmethod
def get_current(self):
    """Method to create a new session.
    Returns:
        Session: Current session
    """
    pass
get_current_session(session_id) abstractmethod

Method to get session by id

Parameters:

  • session_id (int) –

    Session id

Returns: Session: Session with the given id

Source code in src/project/database/Interface.py
35
36
37
38
39
40
41
42
43
44
@abstractmethod
def get_current_session(self, session_id: int):
    """Method to get session by id

    Args:
        session_id (int): Session id
    Returns:
        Session: Session with the given id
    """
    pass