AS AgentScopeAPI 手册 / API Reference

Builder

public static class Builder
源码Source io/agentscope/core/message/ToolUseBlock.java:200–285

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

Builder for constructing ToolUseBlock instances.

方法摘要Method Summary

方法Method说明Description
public Builder id(String id)
设置标识。
Sets the unique identifier for the tool call.
public Builder name(String name)
设置名称的工具到执行。
Sets the name of the tool to execute.
public Builder input(Map<String, Object> input)
设置输入参数用于工具。
Sets the input parameters for the tool.
public Builder content(String content)
设置原始内容用于流式工具调用。
Sets the raw content for streaming tool calls.
public Builder metadata(Map<String, Object> metadata)
设置元数据。
Sets the provider-specific metadata.
public Builder state(ToolCallState state)
设置工具调用状态。
Sets the tool call state.
public ToolUseBlock build()
构建并返回最终实例。
Builds a new ToolUseBlock with the configured properties.

方法详情Method Detail

id

public Builder id(String id)

设置标识。

Sets the unique identifier for the tool call.

参数Parameters
名称Name类型Type说明Description
idString工具调用标识。The tool call ID
返回Returns Builder
返回当前实例,以支持链式调用。This builder for chaining
源码Source io/agentscope/core/message/ToolUseBlock.java:214–217

name

public Builder name(String name)

设置名称的工具到执行。

Sets the name of the tool to execute.

参数Parameters
名称Name类型Type说明Description
nameString工具名称。The tool name
返回Returns Builder
返回当前实例,以支持链式调用。This builder for chaining
源码Source io/agentscope/core/message/ToolUseBlock.java:225–228

input

public Builder input(Map<String, Object> input)

设置输入参数用于工具。

Sets the input parameters for the tool.

参数Parameters
名称Name类型Type说明Description
inputMap<String, Object>工具输入参数映射。The tool input parameters map
返回Returns Builder
返回当前实例,以支持链式调用。This builder for chaining
源码Source io/agentscope/core/message/ToolUseBlock.java:236–239

content

public Builder content(String content)

设置原始内容用于流式工具调用。

Sets the raw content for streaming tool calls.

参数Parameters
名称Name类型Type说明Description
contentString原始内容用于流式。The raw content for streaming
返回Returns Builder
返回当前实例,以支持链式调用。This builder for chaining
源码Source io/agentscope/core/message/ToolUseBlock.java:247–250

metadata

public Builder metadata(Map<String, Object> metadata)

设置元数据。

Sets the provider-specific metadata.

参数Parameters
名称Name类型Type说明Description
metadataMap<String, Object>元数据映射。The metadata map
返回Returns Builder
返回当前实例,以支持链式调用。This builder for chaining
源码Source io/agentscope/core/message/ToolUseBlock.java:261–264

state

public Builder state(ToolCallState state)

设置工具调用状态。

Sets the tool call state.

参数Parameters
名称Name类型Type说明Description
stateToolCallState工具调用状态。The tool call state
返回Returns Builder
返回当前实例,以支持链式调用。This builder for chaining
源码Source io/agentscope/core/message/ToolUseBlock.java:272–275

build

public ToolUseBlock build()

构建并返回最终实例。

Builds a new ToolUseBlock with the configured properties.

返回Returns ToolUseBlock
一种新的ToolUseBlock 实例。A new ToolUseBlock instance
源码Source io/agentscope/core/message/ToolUseBlock.java:282–284
基于官方固定版本源码静态生成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.