AS AgentScopeAPI 手册 / API Reference

TextBlock

public final class TextBlock extends ContentBlock
源码Source io/agentscope/core/message/TextBlock.java:31–95

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

Represents plain text content in a message.

This is the most basic content block type, containing simple text content. Text blocks are commonly used for user messages, assistant responses, and any other textual communication.

The text content can be empty but never null. The toString() method returns the text content for convenience.

嵌套类摘要Nested Class Summary

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

方法摘要Method Summary

方法Method说明Description
public String getText()
获取文本内容的此块。
Gets the text content of this block.
public String toString()
返回 `toString` 结果。
Returns the to string.
public static Builder builder()
static
返回构建器实例。
Creates a new builder for constructing TextBlock instances.

方法详情Method Detail

getText

public String getText()

获取文本内容的此块。

Gets the text content of this block.

返回Returns String
文本内容。The text content
源码Source io/agentscope/core/message/TextBlock.java:50–52

toString

public String toString()

返回 toString 结果。

Returns the to string.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/message/TextBlock.java:54–57

builder

public static Builder builder()
static

返回构建器实例。

Creates a new builder for constructing TextBlock instances.

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

嵌套类详情Nested Class Detail

Builder

public static class Builder

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

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