FunctionCallingMessage

class FunctionCallingMessage(BaseMessage):
Class for message objects used specifically for function-related messages. Parameters:
  • func_name (Optional[str]): The name of the function used. (default: :obj:None)
  • args (Optional[Dict]): The dictionary of arguments passed to the function. (default: :obj:None)
  • result (Optional[Any]): The result of function execution. (default: :obj:None)
  • tool_call_id (Optional[str]): The ID of the tool call, if available. (default: :obj:None)
  • mask_output (Optional[bool]): Whether to return a sanitized placeholder instead of the raw tool output. (default: :obj:False)

to_openai_message

def to_openai_message(self, role_at_backend: OpenAIBackendRole):
Converts the message to an :obj:OpenAIMessage object. Parameters:
  • role_at_backend (OpenAIBackendRole): The role of the message in OpenAI chat system.
Returns: OpenAIMessage: The converted :obj:OpenAIMessage object.

to_sharegpt

def to_sharegpt(
    self,
    function_format: Optional[FunctionCallFormatter[ToolCall, ToolResponse]] = None
):
Convert FunctionCallingMessage to ShareGPT message.

to_openai_assistant_message

def to_openai_assistant_message(self):
Returns: OpenAIAssistantMessage: The converted :obj:OpenAIAssistantMessage object.

to_openai_tool_message

def to_openai_tool_message(self):
Returns: OpenAIToolMessageParam: The converted :obj:OpenAIToolMessageParam object with its role being “tool”.

to_dict

def to_dict(self):
Returns: dict: The converted dictionary.