AS AgentScopeAPI 手册 / API Reference

ImageBlock

@JsonInclude(JsonInclude.Include.NON_NULL) public final class ImageBlock extends ContentBlock
源码Source io/agentscope/core/message/ImageBlock.java:36–163

表示图像内容 in 消息使用 URL 或 Base64 来源。位于 io.agentscope.core.message 包,继承自 ContentBlock。核心成员包括 getSource、getMinPixels、getMaxPixels、builder、ImageBlock。

Represents image content in a message with URL or Base64 source.

This content block supports images from two sources:

  • URL source - images accessible via HTTP/HTTPS URLs or local file URLs

  • Base64 source - images encoded as Base64 strings with MIME type

Image blocks are essential for multimodal AI interactions where agents need to process visual information from images, diagrams, screenshots, or other visual content.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
Builder for constructing ImageBlock instances.

构造器摘要Constructor Summary

构造器Constructor说明Description
public ImageBlock(Source source)
创建新的图像块使用来源。
Creates a new image block with source.

方法摘要Method Summary

方法Method说明Description
public Source getSource()
获取来源的此图像。
Gets the source of this image.
public Integer getMinPixels()
获取 `getMinPixels`。
Gets the minimum pixel threshold for input image.
public Integer getMaxPixels()
获取 `getMaxPixels`。
Gets the maximum pixel threshold for input image.
public static Builder builder()
static
返回构建器实例。
Creates a new builder for constructing ImageBlock instances.

构造器详情Constructor Detail

ImageBlock

public ImageBlock(Source source)

创建新的图像块使用来源。

Creates a new image block with source.

参数Parameters
名称Name类型Type说明Description
sourceSource图像来源(URL 或 Base64)。The image source (URL or Base64)
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if source is null
源码Source io/agentscope/core/message/ImageBlock.java:51–53

方法详情Method Detail

getSource

public Source getSource()

获取来源的此图像。

Gets the source of this image.

返回Returns Source
返回来源。The image source containing URL or Base64 data
源码Source io/agentscope/core/message/ImageBlock.java:78–80

getMinPixels

public Integer getMinPixels()

获取 getMinPixels。

Gets the minimum pixel threshold for input image.

返回Returns Integer
返回数值结果。The minimum pixel threshold
源码Source io/agentscope/core/message/ImageBlock.java:87–89

getMaxPixels

public Integer getMaxPixels()

获取 getMaxPixels。

Gets the maximum pixel threshold for input image.

返回Returns Integer
返回数值结果。The maximum pixel threshold
源码Source io/agentscope/core/message/ImageBlock.java:96–98

builder

public static Builder builder()
static

返回构建器实例。

Creates a new builder for constructing ImageBlock instances.

返回Returns Builder
一种新的构建器实例。A new builder instance
源码Source io/agentscope/core/message/ImageBlock.java:105–107

嵌套类详情Nested Class Detail

Builder

public static class Builder

构建器,用于构建并配置目标实例。位于 io.agentscope.core.message 包。核心成员包括 source、minPixels、maxPixels、build。

Builder for constructing ImageBlock instances.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.