Builder
public static class Builder
源码Source
io/agentscope/core/message/ToolResultBlock.java:351–432构建器,用于构建并配置目标实例。位于 io.agentscope.core.message 包。核心成员包括 id、name、output、metadata、state、build。
Builder for constructing ToolResultBlock instances.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder id(String id) | 设置工具调用标识。 Sets the tool call ID. |
public Builder name(String name) | 设置工具名称。 Sets the tool name. |
public Builder output(ContentBlock output) | 设置输出。 Sets a single content block as output. |
public Builder output(List<ContentBlock> output) | 设置输出。 Sets a list of content blocks as output. |
public Builder metadata(Map<String, Object> metadata) | 设置元数据用于工具结果。 Sets the metadata for the tool result. |
public Builder state(ToolResultState state) | 设置工具结果状态。 Sets the tool result state. |
public ToolResultBlock build() | 构建并返回最终实例。 Builds a new ToolResultBlock with the configured properties. |
方法详情Method Detail
id
public Builder id(String id)
设置工具调用标识。
Sets the tool call ID.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
id | String | 工具调用标识。The tool call ID |
Builder返回当前实例,以支持链式调用。This builder for chaining
源码Source
io/agentscope/core/message/ToolResultBlock.java:364–367name
public Builder name(String name)
设置工具名称。
Sets the tool name.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 工具名称。The tool name |
Builder返回当前实例,以支持链式调用。This builder for chaining
源码Source
io/agentscope/core/message/ToolResultBlock.java:375–378output
public Builder output(ContentBlock output)
设置输出。
Sets a single content block as output.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
output | ContentBlock | 输出(类型 `ContentBlock`)。Single content block |
Builder返回当前实例,以支持链式调用。This builder for chaining
源码Source
io/agentscope/core/message/ToolResultBlock.java:386–389output
public Builder output(List<ContentBlock> output)
设置输出。
Sets a list of content blocks as output.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
output | List<ContentBlock> | 输出(类型 `List`)。List of content blocks |
Builder返回当前实例,以支持链式调用。This builder for chaining
源码Source
io/agentscope/core/message/ToolResultBlock.java:397–400metadata
public Builder metadata(Map<String, Object> metadata)
设置元数据用于工具结果。
Sets the metadata for the tool result.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
metadata | Map<String, Object> | 元数据(类型 `Map`)。Metadata map |
Builder返回当前实例,以支持链式调用。This builder for chaining
源码Source
io/agentscope/core/message/ToolResultBlock.java:408–411state
public Builder state(ToolResultState state)
设置工具结果状态。
Sets the tool result state.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
state | ToolResultState | 工具结果状态。The tool result state |
Builder返回当前实例,以支持链式调用。This builder for chaining
源码Source
io/agentscope/core/message/ToolResultBlock.java:419–422build
public ToolResultBlock build()
构建并返回最终实例。
Builds a new ToolResultBlock with the configured properties.
ToolResultBlock一种新的ToolResultBlock 实例。A new ToolResultBlock instance
源码Source
io/agentscope/core/message/ToolResultBlock.java:429–431