BaseMessage
- role_name (str): The name of the user or assistant role.
- role_type (RoleType): The type of role, either :obj:
RoleType. ASSISTANTor :obj:RoleType.USER. - meta_dict (Optional[Dict[str, Any]]): Additional metadata dictionary for the message.
- content (str): The content of the message.
- video_bytes (Optional[bytes]): Optional bytes of a video associated with the message. (default: :obj:
None) - image_list (Optional[List[Union[Image.Image, str]]]): Optional list of PIL Image objects or image URLs (strings) associated with the message. (default: :obj:
None) - image_detail (
Literal["auto", "low", "high"]): Detail level of the images associated with the message. (default: :obj:auto) - video_detail (
Literal["auto", "low", "high"]): Detail level of the videos associated with the message. (default: :obj:auto) - parsed (Optional[Union[Type[BaseModel], dict]]): Optional object which is parsed from the content. (default: :obj:
None) - reasoning_content (Optional[str]): Optional reasoning trace associated with the message. (default: :obj:
None)
make_user_message
- role_name (str): The name of the user role.
- content (str): The content of the message.
- meta_dict (Optional[Dict[str, str]]): Additional metadata dictionary for the message.
- video_bytes (Optional[bytes]): Optional bytes of a video associated with the message.
- image_list (Optional[List[Union[Image.Image, str]]]): Optional list of PIL Image objects or image URLs (strings) associated with the message.
- image_detail (Union[OpenAIVisionDetailType, str]): Detail level of the images associated with the message.
- video_detail (Union[OpenAIVisionDetailType, str]): Detail level of the videos associated with the message.
make_assistant_message
- role_name (str): The name of the assistant role.
- content (str): The content of the message.
- meta_dict (Optional[Dict[str, str]]): Additional metadata dictionary for the message.
- video_bytes (Optional[bytes]): Optional bytes of a video associated with the message.
- image_list (Optional[List[Union[Image.Image, str]]]): Optional list of PIL Image objects or image URLs (strings) associated with the message.
- image_detail (Union[OpenAIVisionDetailType, str]): Detail level of the images associated with the message.
- video_detail (Union[OpenAIVisionDetailType, str]): Detail level of the videos associated with the message.
make_system_message
- content (str): The content of the system message.
- role_name (str): The name of the system role. (default: :obj:
"System") - meta_dict (Optional[Dict[str, str]]): Additional metadata dictionary for the message.
create_new_instance
BaseMessage with updated
content.
Parameters:
- content (str): The new content value.
BaseMessage.
add
BaseMessage.
Parameters:
- other (Any): The value to be added with.
mul
BaseMessage.
Parameters:
- other (Any): The value to be multiplied with.
len
contains
BaseMessage.
Parameters:
- item (str): The item to check for containment.
True if the item is contained in the content,
:obj:False otherwise.
extract_text_and_code_prompts
from_sharegpt
- message (ShareGPTMessage): ShareGPT message to convert.
- function_format (FunctionCallFormatter, optional): Function call formatter to use. (default: :obj:
HermesFunctionFormatter(). - role_mapping (Dict[str, List[str, RoleType]], optional): Role mapping to use. Defaults to a CAMEL specific mapping.
to_sharegpt
- function_format (FunctionCallFormatter): Function call formatter to use. Defaults to Hermes.
to_openai_message
OpenAIMessage object.
Parameters:
- role_at_backend (OpenAIBackendRole): The role of the message in OpenAI chat system.
OpenAIMessage object.
to_openai_system_message
OpenAISystemMessage
object.
to_openai_user_message
OpenAIUserMessage object.
to_openai_assistant_message
OpenAIAssistantMessage
object.