MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / BaseMessage

Class BaseMessage

camel/messages/base.py:44–541  ·  view source on GitHub ↗

r"""Base class for message objects used in CAMEL chat system. Args: role_name (str): The name of the user or assistant role. role_type (RoleType): The type of role, either :obj:`RoleType. ASSISTANT` or :obj:`RoleType.USER`. meta_dict (Optional[Dict[str, str]]

Source from the content-addressed store, hash-verified

42
43@dataclass
44class BaseMessage:
45 r"""Base class for message objects used in CAMEL chat system.
46
47 Args:
48 role_name (str): The name of the user or assistant role.
49 role_type (RoleType): The type of role, either :obj:`RoleType.
50 ASSISTANT` or :obj:`RoleType.USER`.
51 meta_dict (Optional[Dict[str, str]]): Additional metadata dictionary
52 for the message.
53 content (str): The content of the message.
54 video_bytes (Optional[bytes]): Optional bytes of a video associated
55 with the message. (default: :obj:`None`)
56 image_list (Optional[List[Image.Image]]): Optional list of PIL Image
57 objects associated with the message. (default: :obj:`None`)
58 image_detail (Literal["auto", "low", "high"]): Detail level of the
59 images associated with the message. (default: :obj:`auto`)
60 video_detail (Literal["auto", "low", "high"]): Detail level of the
61 videos associated with the message. (default: :obj:`low`)
62 parsed: Optional[Union[Type[BaseModel], dict]]: Optional object which
63 is parsed from the content. (default: :obj:`None`)
64 """
65
66 role_name: str
67 role_type: RoleType
68 meta_dict: Optional[Dict[str, Any]]
69 content: str
70
71 video_bytes: Optional[bytes] = None
72 image_list: Optional[List[Image.Image]] = None
73 image_detail: Literal["auto", "low", "high"] = "auto"
74 video_detail: Literal["auto", "low", "high"] = "low"
75 parsed: Optional[Union[Type[BaseModel], dict]] = None
76
77 @classmethod
78 def make_user_message(
79 cls,
80 role_name: str,
81 content: str,
82 meta_dict: Optional[Dict[str, str]] = None,
83 video_bytes: Optional[bytes] = None,
84 image_list: Optional[List[Image.Image]] = None,
85 image_detail: Union[
86 OpenAIVisionDetailType, str
87 ] = OpenAIVisionDetailType.AUTO,
88 video_detail: Union[
89 OpenAIVisionDetailType, str
90 ] = OpenAIVisionDetailType.LOW,
91 ) -> "BaseMessage":
92 r"""Create a new user message.
93
94 Args:
95 role_name (str): The name of the user role.
96 content (str): The content of the message.
97 meta_dict (Optional[Dict[str, str]]): Additional metadata
98 dictionary for the message.
99 video_bytes (Optional[bytes]): Optional bytes of a video
100 associated with the message.
101 image_list (Optional[List[Image.Image]]): Optional list of PIL

Callers 15

from_dictMethod · 0.90
reduce_stepMethod · 0.90
__init__Method · 0.90
stepMethod · 0.90
get_optionMethod · 0.90
reduce_stepMethod · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected