AS AgentScopeAPI 手册 / API Reference

DataBlock

@JsonInclude(JsonInclude.Include.NON_NULL) public final class DataBlock extends ContentBlock
源码Source io/agentscope/core/message/DataBlock.java:34–153

数据块,在智能体、模型与前端之间传递结构化消息和事件。位于 io.agentscope.core.message 包,继承自 ContentBlock。核心成员包括 getSource、getId、getName、builder。

Unified data block for arbitrary binary media (image / audio / video / file).

Unlike the legacy ImageBlock, AudioBlock, VideoBlock subclasses — which the SDK retains for back-compat — DataBlock is the forward-looking polymorphic container for every binary modality. New code should prefer DataBlock over the legacy subclasses; the legacy types stay around as valid MsgRole#USER payloads to keep existing pipelines working.

嵌套类摘要Nested Class Summary

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

方法摘要Method Summary

方法Method说明Description
public Source getSource()
获取来源的此数据块。
Gets the source of this data block.
public String getId()
获取标识。
Gets the identifier of this data block.
public String getName()
获取可选名称的此数据块。
Gets the optional name of this data block.
public static Builder builder()
static
返回构建器实例。
Creates a new builder for constructing DataBlock instances.

方法详情Method Detail

getSource

public Source getSource()

获取来源的此数据块。

Gets the source of this data block.

返回Returns Source
返回来源。The data source containing URL or Base64 data
源码Source io/agentscope/core/message/DataBlock.java:67–69

getId

public String getId()

获取标识。

Gets the identifier of this data block.

返回Returns String
返回字符串结果。The block id; never null
源码Source io/agentscope/core/message/DataBlock.java:76–78

getName

public String getName()

获取可选名称的此数据块。

Gets the optional name of this data block.

返回Returns String
返回字符串结果。The block name, or null if not set
源码Source io/agentscope/core/message/DataBlock.java:85–87

builder

public static Builder builder()
static

返回构建器实例。

Creates a new builder for constructing DataBlock instances.

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

嵌套类详情Nested Class Detail

Builder

public static class Builder

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

Builder for constructing DataBlock 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.