类 DashScopeMessage

java.lang.Object
io.agentscope.core.formatter.dashscope.dto.DashScopeMessage

public class DashScopeMessage extends Object
DashScope message DTO.

This class represents a message in the DashScope API format. Content can be either a String (for text-only) or a List of DashScopeContentPart (for multimodal).

Example text message:


 {
   "role": "user",
   "content": "Hello"
 }
 

Example multimodal message:


 {
   "role": "user",
   "content": [
     {"text": "What's in this image?"},
     {"image": "https://example.com/image.jpg"}
   ]
 }
 
  • 构造器详细资料

    • DashScopeMessage

      public DashScopeMessage()
  • 方法详细资料

    • getRole

      public String getRole()
    • setRole

      public void setRole(String role)
    • getContent

      public Object getContent()
    • setContent

      public void setContent(Object content)
    • getContentAsString

      public String getContentAsString()
      Get content as String (for text-only messages).
      返回:
      the content as String, or null if multimodal
    • getContentAsList

      public List<DashScopeContentPart> getContentAsList()
      Get content as List (for multimodal messages).
      返回:
      the content as List, or null if text-only
    • isMultimodal

      public boolean isMultimodal()
      Check if this message has multimodal content.
      返回:
      true if content is a List
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getToolCallId

      public String getToolCallId()
    • setToolCallId

      public void setToolCallId(String toolCallId)
    • getToolCalls

      public List<DashScopeToolCall> getToolCalls()
    • setToolCalls

      public void setToolCalls(List<DashScopeToolCall> toolCalls)
    • getReasoningContent

      public String getReasoningContent()
    • setReasoningContent

      public void setReasoningContent(String reasoningContent)
    • getCacheControl

      public Map<String,String> getCacheControl()
    • setCacheControl

      public void setCacheControl(Map<String,String> cacheControl)
    • builder

      public static DashScopeMessage.Builder builder()