BaseMessage
class is the backbone for all message objects in
the CAMEL chat system. It offers a consistent structure for agent
communication and easy conversion between message types.BaseMessage
instance, supply these arguments:RoleType.ASSISTANT
or RoleType.USER
BaseMessage
ClassBaseMessage
class lets you:new_message = message.create_new_instance(“new test content”)
openai_message =
message.to_openai_message(role_at_backend=OpenAIBackendRole.USER)
openai_system_message = message.to_openai_system_message()
openai_user_message = message.to_openai_user_message()
openai_assistant_message = message.to_openai_assistant_message()
message_dict = message.to_dict()
BaseMessage
into the
right format for different LLM APIs and agent flows.BaseMessage
with ChatAgent
BaseMessage
class is essential for structured, clear, and
flexible communication in the CAMEL-AI ecosystem—making it simple to create,
convert, and handle messages across any workflow.