类 URLSource

java.lang.Object
io.agentscope.core.message.Source
io.agentscope.core.message.URLSource

public class URLSource extends Source
Represents URL-based media content.

This source references media files accessible via URLs, supporting both remote HTTP/HTTPS URLs and local file URLs. This approach is preferred when media files are hosted externally or when file size makes Base64 encoding impractical.

Supported URL formats:

  • Remote URLs: https://example.com/image.jpg
  • Local files: file:///absolute/path/to/file.jpg

Using URL sources is more efficient for large media files and allows the system to stream content rather than loading everything into memory.

  • 构造器详细资料

    • URLSource

      public URLSource(String url)
      Creates a new URL source for JSON deserialization.
      参数:
      url - The URL pointing to the media content
      抛出:
      NullPointerException - if url is null
  • 方法详细资料

    • getUrl

      public String getUrl()
      Gets the URL that points to the media content.
      返回:
      The URL as a string
    • builder

      public static URLSource.Builder builder()
      Creates a new builder for constructing URLSource instances.
      返回:
      A new builder instance