Class DashScopeMessageConverter

java.lang.Object
io.agentscope.extensions.model.dashscope.formatter.DashScopeMessageConverter

public class DashScopeMessageConverter extends Object
Converts AgentScope Msg objects to DashScope DTO message types.

This class provides unified conversion methods for both simple text messages and multimodal messages containing images, videos, and audio.

  • Constructor Details

    • DashScopeMessageConverter

      public DashScopeMessageConverter(Function<List<io.agentscope.core.message.ContentBlock>,String> toolResultConverter)
  • Method Details

    • convertToMessage

      public DashScopeMessage convertToMessage(io.agentscope.core.message.Msg msg, boolean useMultimodalFormat)
      Convert single Msg to DashScopeMessage.

      This is the main entry point for message conversion. It automatically selects the appropriate format based on the message content and the hasMediaContent flag.

      Parameters:
      msg - The message to convert
      useMultimodalFormat - Whether to use multimodal content format (List of content parts)
      Returns:
      The converted DashScopeMessage