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.
String文本内容。The text content
源码Source
io/agentscope/core/message/TextBlock.java:50–52toString
public String toString()
返回 toString 结果。
Returns the to string.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/core/message/TextBlock.java:54–57builder
public static Builder builder()
static
返回构建器实例。
Creates a new builder for constructing TextBlock instances.
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.