File size: 805 Bytes
a495cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""message model to manage browsering questions as agent"""
from Brain.src.service.llm.base import Message


class MessageModel:
    def __init__(self, role: str, content: str):
        self.role = role
        self.content = content

    def to_json(self) -> Message:
        return {"role": self.role, "content": self.content}

    @classmethod
    def create_chat_message(cls, role: str, content: str) -> Message:
        """
        Create a chat message with the given role and content.

        Args:
        role (str): The role of the message sender, e.g., "system", "user", or "assistant".
        content (str): The content of the message.

        Returns:
        dict: A dictionary containing the role and content of the message.
        """
        return {"role": role, "content": content}